feat: build dashboard lead funnel
This commit is contained in:
@@ -6,6 +6,7 @@ import { LogOut } from "lucide-react";
|
||||
|
||||
import { authClient } from "@/lib/auth-client";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { DashboardThemeToggle } from "@/components/dashboard-theme";
|
||||
import { dashboardNavigation } from "@/lib/dashboard-navigation";
|
||||
import { useState } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
@@ -15,6 +16,7 @@ export function DashboardSidebar() {
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
const [isSigningOut, setIsSigningOut] = useState(false);
|
||||
const [signOutError, setSignOutError] = useState<string | null>(null);
|
||||
const { data: session, isPending } = authClient.useSession();
|
||||
|
||||
return (
|
||||
@@ -46,7 +48,7 @@ export function DashboardSidebar() {
|
||||
<Link
|
||||
aria-current={isActive ? "page" : undefined}
|
||||
className={cn(
|
||||
"flex h-9 shrink-0 items-center gap-2 rounded-lg px-3 text-sm font-medium transition-colors",
|
||||
"flex h-9 shrink-0 items-center gap-2 rounded-lg px-3 text-sm font-medium outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50",
|
||||
isActive
|
||||
? "bg-sidebar-primary text-sidebar-primary-foreground"
|
||||
: "text-muted-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
||||
@@ -70,20 +72,36 @@ export function DashboardSidebar() {
|
||||
{session?.user?.email ?? "admin@local"}
|
||||
</p>
|
||||
</div>
|
||||
<div className="mb-2">
|
||||
<DashboardThemeToggle />
|
||||
</div>
|
||||
<Button
|
||||
className="w-full justify-start"
|
||||
variant="outline"
|
||||
onClick={async () => {
|
||||
setIsSigningOut(true);
|
||||
await authClient.signOut();
|
||||
router.replace("/login");
|
||||
router.refresh();
|
||||
setSignOutError(null);
|
||||
|
||||
try {
|
||||
await authClient.signOut();
|
||||
router.replace("/login");
|
||||
router.refresh();
|
||||
} catch {
|
||||
setSignOutError("Abmeldung fehlgeschlagen.");
|
||||
} finally {
|
||||
setIsSigningOut(false);
|
||||
}
|
||||
}}
|
||||
disabled={isSigningOut}
|
||||
>
|
||||
<LogOut />
|
||||
{isSigningOut ? "Abmeldung..." : "Abmelden"}
|
||||
{isSigningOut ? "Abmeldung läuft..." : "Abmelden"}
|
||||
</Button>
|
||||
{signOutError ? (
|
||||
<p className="mt-2 text-xs text-destructive" role="status">
|
||||
{signOutError}
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
</aside>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user