- Replace top login/register buttons with magic dock navigation - Add dock items: home, downloads, blog, and conditional login/logout - Show dashboard icon in dock when authenticated - Extract HomePageClient for client-side dialog state
39 lines
932 B
TypeScript
39 lines
932 B
TypeScript
"use client";
|
|
|
|
import {
|
|
Dialog,
|
|
DialogContent,
|
|
DialogHeader,
|
|
DialogTitle,
|
|
DialogTrigger,
|
|
} from "@/components/ui/dialog";
|
|
import { LoginForm } from "./login/login-form";
|
|
import { ReactNode, useState } from "react";
|
|
|
|
export function LoginDialog({
|
|
hasKeycloak,
|
|
children,
|
|
}: {
|
|
hasKeycloak: boolean;
|
|
children?: ReactNode;
|
|
}) {
|
|
const [open, setOpen] = useState(false);
|
|
|
|
return (
|
|
<Dialog open={open} onOpenChange={setOpen}>
|
|
<DialogTrigger className="rounded-lg bg-slate-900 px-5 py-2.5 text-sm font-medium text-white hover:bg-slate-800">
|
|
{children ?? "登录"}
|
|
</DialogTrigger>
|
|
<DialogContent className="sm:max-w-md">
|
|
<DialogHeader>
|
|
<DialogTitle className="text-center">登录</DialogTitle>
|
|
</DialogHeader>
|
|
<LoginForm
|
|
hasKeycloak={hasKeycloak}
|
|
onSuccess={() => setOpen(false)}
|
|
/>
|
|
</DialogContent>
|
|
</Dialog>
|
|
);
|
|
}
|