diff --git a/components/admin/admin-header.tsx b/components/admin/admin-header.tsx index 53bb720..c5d8105 100644 --- a/components/admin/admin-header.tsx +++ b/components/admin/admin-header.tsx @@ -11,11 +11,13 @@ import { ClipboardListIcon, MessagesSquareIcon, LogOutIcon, + MenuIcon, PlusIcon, SwordsIcon, } from "lucide-react"; -import { Button } from "@/components/ui/button"; +import { Button, buttonVariants } from "@/components/ui/button"; +import { Sheet, SheetClose, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet"; import { authClient } from "@/lib/auth/client"; import { unsubscribeCommissionPush } from "@/components/commission/push-client"; import { CommissionPushEntryPrompt } from "@/components/commission/push-entry-prompt"; @@ -23,19 +25,40 @@ import { CommissionPushEntryPrompt } from "@/components/commission/push-entry-pr export function AdminHeader() { const pathname = usePathname(); const router = useRouter(); + const mobileLinks = [ + { href: "/admin/commission", label: "Commission", icon: MessagesSquareIcon, active: pathname.startsWith("/admin/commission") }, + { href: "/admin/stygian", label: "Stygian", icon: SwordsIcon, active: pathname === "/admin/stygian" }, + { href: "/admin/activity", label: "Activity", icon: ClipboardListIcon, active: pathname === "/admin/activity" }, + { href: "/admin/glossary", label: "Glossary", icon: BookOpenIcon, active: pathname === "/admin/glossary" }, + { href: "/admin", label: "Dashboard", icon: LayoutDashboardIcon, active: pathname === "/admin" }, + { href: "/admin/create", label: "New Guide", icon: PlusIcon, active: pathname === "/admin/create" }, + { href: "/admin/image/overview", label: "Image Generator", icon: ImageIcon, active: pathname.startsWith("/admin/image") }, + ]; + const signOut = async () => { + await unsubscribeCommissionPush().catch(() => undefined); + await authClient.signOut({ + fetchOptions: { + onSuccess: () => { + router.push("/admin/login"); + router.refresh(); + }, + }, + }); + }; return (<>
-
+
ไกด์เกนชินไม่ใช่เกมมือถือ -
diff --git a/components/public/site-header.tsx b/components/public/site-header.tsx index f627d86..ef652b1 100644 --- a/components/public/site-header.tsx +++ b/components/public/site-header.tsx @@ -1,38 +1,44 @@ import Image from "next/image"; import Link from "next/link"; import { Suspense } from "react"; +import { MenuIcon } from "lucide-react"; -import { Button } from "@/components/ui/button"; +import { Button, buttonVariants } from "@/components/ui/button"; +import { Sheet, SheetClose, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet"; import { VisitorPresence } from "@/components/public/visitor-presence"; import { getAdminSession } from "@/lib/auth/server"; -async function AdminEditLink({ editHref }: { editHref: string }) { +async function AdminEditLink({ editHref, mobile = false }: { editHref: string; mobile?: boolean }) { const isAdmin = Boolean(await getAdminSession()); return isAdmin ? ( - + mobile ? ( + } + > + ไปหน้าแก้ไข + + ) : ( + + ) ) : null; } export function SiteHeader({ editHref = "/admin", guideId }: { editHref?: string; guideId?: string } = {}) { return (
-
+
ไกด์เกนชินไม่ใช่เกมมือถือ -
); diff --git a/components/public/visitor-presence.tsx b/components/public/visitor-presence.tsx index 2716ecc..ee5879c 100644 --- a/components/public/visitor-presence.tsx +++ b/components/public/visitor-presence.tsx @@ -11,19 +11,22 @@ export function VisitorPresence({ guideId }: { guideId?: string }) {
- ทั้งหมด {counts?.global ?? "-"} + ทั้งหมด {counts?.global ?? "-"} {guideId ? ( - ไกด์นี้ {counts?.guide ?? "-"} + ไกด์นี้ + {counts?.guide ?? "-"} ) : null}