feat(core): setup postgres, minio, and authentik next-auth
This commit is contained in:
@@ -1,14 +1,25 @@
|
||||
'use client';
|
||||
"use client";
|
||||
|
||||
import { useTheme } from 'next-themes';
|
||||
import { Moon, Sun, PanelLeft } from 'lucide-react';
|
||||
import { Button } from '@/shared/components/ui/button';
|
||||
import { useTheme } from "next-themes";
|
||||
import {
|
||||
Moon,
|
||||
Sun,
|
||||
PanelLeft,
|
||||
User as UserIcon,
|
||||
LogOut,
|
||||
LogIn,
|
||||
} from "lucide-react";
|
||||
import { Button } from "@/shared/components/ui/button";
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/shared/components/ui/dropdown-menu';
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuLabel,
|
||||
} from "@/shared/components/ui/dropdown-menu";
|
||||
import { useAuth } from "@/core/auth";
|
||||
import { signIn, signOut } from "next-auth/react";
|
||||
|
||||
interface HeaderProps {
|
||||
onToggleSidebar?: () => void;
|
||||
@@ -16,6 +27,7 @@ interface HeaderProps {
|
||||
|
||||
export function Header({ onToggleSidebar }: HeaderProps) {
|
||||
const { setTheme } = useTheme();
|
||||
const { user, isAuthenticated } = useAuth();
|
||||
|
||||
return (
|
||||
<header className="flex h-14 items-center justify-between border-b bg-card px-4">
|
||||
@@ -40,17 +52,59 @@ export function Header({ onToggleSidebar }: HeaderProps) {
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuItem onClick={() => setTheme('light')}>
|
||||
<DropdownMenuItem onClick={() => setTheme("light")}>
|
||||
Luminos
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={() => setTheme('dark')}>
|
||||
<DropdownMenuItem onClick={() => setTheme("dark")}>
|
||||
Întunecat
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={() => setTheme('system')}>
|
||||
<DropdownMenuItem onClick={() => setTheme("system")}>
|
||||
Sistem
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="rounded-full bg-muted"
|
||||
>
|
||||
<UserIcon className="h-4 w-4" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" className="w-56">
|
||||
{isAuthenticated && user ? (
|
||||
<>
|
||||
<DropdownMenuLabel className="font-normal">
|
||||
<div className="flex flex-col space-y-1">
|
||||
<p className="text-sm font-medium leading-none">
|
||||
{user.name}
|
||||
</p>
|
||||
<p className="text-xs leading-none text-muted-foreground">
|
||||
{user.email}
|
||||
</p>
|
||||
</div>
|
||||
</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem onClick={() => signOut()}>
|
||||
<LogOut className="mr-2 h-4 w-4" />
|
||||
<span>Deconectare</span>
|
||||
</DropdownMenuItem>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<DropdownMenuLabel>Neautentificat</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem onClick={() => signIn("authentik")}>
|
||||
<LogIn className="mr-2 h-4 w-4" />
|
||||
<span>Autentificare (Authentik)</span>
|
||||
</DropdownMenuItem>
|
||||
</>
|
||||
)}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user