generated from kevisual/vite-react-template
feat: add repository management dialogs and store functionality
- Implement CreateRepoDialog for creating new repositories with form validation. - Implement EditRepoDialog for editing existing repository details. - Implement SyncRepoDialog for syncing repositories with Gitea, including repository creation if necessary. - Implement WorkspaceDetailDialog for managing workspace links and actions. - Enhance the repo store with new state management for repository actions, including creating, editing, and syncing repositories. - Add build configuration utilities for repository synchronization. - Create a new page for repository management, integrating all dialogs and functionalities. - Add login route for authentication.
This commit is contained in:
@@ -1,56 +1,27 @@
|
||||
import { Link, Outlet, createRootRoute, useNavigate } from '@tanstack/react-router'
|
||||
import { LayoutMain } from '@/pages/auth/modules/BaseHeader';
|
||||
import { Outlet, createRootRoute } from '@tanstack/react-router'
|
||||
import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
|
||||
import { Toaster } from '@/components/ui/sonner'
|
||||
import { useConfigStore } from '@/app/config/store'
|
||||
import { useEffect } from 'react'
|
||||
import { Settings } from 'lucide-react'
|
||||
import { AuthProvider } from '@/pages/auth'
|
||||
import { TooltipProvider } from '@/components/ui/tooltip'
|
||||
export const Route = createRootRoute({
|
||||
component: RootComponent,
|
||||
})
|
||||
|
||||
|
||||
function RootComponent() {
|
||||
const navigate = useNavigate()
|
||||
useEffect(() => {
|
||||
const config = useConfigStore.getState().config;
|
||||
if (!config.CNB_API_KEY) {
|
||||
navigate({
|
||||
to: '/config'
|
||||
})
|
||||
}
|
||||
}, [])
|
||||
return (
|
||||
<div className='h-full overflow-hidden'>
|
||||
|
||||
<div className="p-2 flex gap-2 text-lg items-center">
|
||||
<Link
|
||||
to="/"
|
||||
activeProps={{
|
||||
className: 'text-gray-800',
|
||||
}}
|
||||
inactiveProps={{
|
||||
className: 'text-gray-500',
|
||||
}}
|
||||
>
|
||||
仓库列表
|
||||
</Link>
|
||||
<Link to='/config' activeProps={{
|
||||
className: 'text-gray-800',
|
||||
}}
|
||||
inactiveProps={{
|
||||
className: 'text-gray-500',
|
||||
}}
|
||||
>
|
||||
<Settings className="h-5 w-5" />
|
||||
</Link>
|
||||
</div>
|
||||
<hr />
|
||||
<main className='h-[calc(100%-4rem)] overflow-auto scrollbar'>
|
||||
|
||||
<Outlet />
|
||||
</main>
|
||||
<LayoutMain />
|
||||
<AuthProvider mustLogin={false}>
|
||||
<TooltipProvider>
|
||||
<main className='h-[calc(100%-3rem)] overflow-auto scrollbar'>
|
||||
<Outlet />
|
||||
</main>
|
||||
</TooltipProvider>
|
||||
</AuthProvider>
|
||||
<TanStackRouterDevtools position="bottom-right" />
|
||||
<Toaster />
|
||||
</div>
|
||||
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user