调整dashboard项目结构

This commit is contained in:
mlogclub
2026-04-24 11:27:49 +08:00
parent eb353cbbc8
commit 5fa30d29ef
88 changed files with 71 additions and 40 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ export function AppSidebar({ ...props }: ComponentProps<typeof Sidebar>) {
<SidebarMenuItem>
<SidebarMenuButton
className="data-[slot=sidebar-menu-button]:p-1.5!"
render={<Link href="/" />}
render={<Link href="/dashboard" />}
>
<BotMessageSquareIcon className="size-5!" />
<span className="text-base font-semibold">AGENT</span>
+5 -4
View File
@@ -33,6 +33,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
const router = useRouter()
const [session, setSession] = useState<AuthSession | null>(null)
const [ready, setReady] = useState(false)
const requiresAuth = pathname?.startsWith("/dashboard") ?? false
const refreshProfile = useCallback(async () => {
const stored = readSession()
@@ -55,7 +56,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
} catch {
clearSession()
setSession(null)
if (pathname && !pathname.startsWith("/login")) {
if (requiresAuth) {
startTransition(() => {
router.replace("/login")
})
@@ -63,7 +64,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
} finally {
setReady(true)
}
}, [pathname, router])
}, [requiresAuth, router])
async function signOut() {
const current = readSession()
@@ -83,12 +84,12 @@ export function AuthProvider({ children }: { children: ReactNode }) {
}
setReady(true)
if (pathname && !pathname.startsWith("/login")) {
if (requiresAuth) {
startTransition(() => {
router.replace("/login")
})
}
}, [pathname, refreshProfile, router])
}, [requiresAuth, refreshProfile, router])
return (
<AuthContext.Provider value={{ session, ready, refreshProfile, signOut }}>
+1 -1
View File
@@ -4,7 +4,7 @@ import { useEffect, useMemo, useState } from "react"
import { ChevronsUpDownIcon, PlusIcon } from "lucide-react"
import { toast } from "sonner"
import { EditDialog as CompanyEditDialog } from "@/app/(dashboard)/companies/_components/edit"
import { EditDialog as CompanyEditDialog } from "@/app/dashboard/companies/_components/edit"
import { Button } from "@/components/ui/button"
import {
Command,
+1 -1
View File
@@ -36,7 +36,7 @@ export function LoginForm({
const nextPath = searchParams.get("next")
const wxworkError = searchParams.get("wxworkError")
const redirectPath =
nextPath && nextPath.startsWith("/") ? nextPath : "/"
nextPath && nextPath.startsWith("/") ? nextPath : "/dashboard"
useEffect(() => {
if (session) {