version 1
Build and Deploy / test-backend (push) Successful in 1m11s
Build and Deploy / lint-frontend (push) Successful in 21s
Build and Deploy / build-backend (push) Successful in 58s
Build and Deploy / deploy (push) Canceled after 0s
Build and Deploy / build-frontend (push) Canceled after 5m38s
Build and Deploy / test-backend (push) Successful in 1m11s
Build and Deploy / lint-frontend (push) Successful in 21s
Build and Deploy / build-backend (push) Successful in 58s
Build and Deploy / deploy (push) Canceled after 0s
Build and Deploy / build-frontend (push) Canceled after 5m38s
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
"use client";
|
||||
|
||||
import { KeyIcon, ListIcon, LogOutIcon } from "lucide-react";
|
||||
import Logo from "./logo";
|
||||
import { ThemeToggler } from "./themeToggler";
|
||||
import Link from "next/link";
|
||||
import { Button } from "./ui/button";
|
||||
import { LocaleSwitcher } from "./localeSwitcher";
|
||||
import { logout } from "@/app/actions/logout";
|
||||
import { useTranslations } from "next-intl";
|
||||
import type { User } from "@/types/api";
|
||||
|
||||
interface HeaderProps {
|
||||
user: User | null;
|
||||
}
|
||||
|
||||
export default function Header({ user }: HeaderProps) {
|
||||
const t = useTranslations("Header");
|
||||
|
||||
const handleLogout = async () => {
|
||||
await logout();
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-row items-center justify-between">
|
||||
<Logo />
|
||||
<div className="flex flex-row gap-2">
|
||||
{user ? (
|
||||
<>
|
||||
<Button
|
||||
nativeButton={false}
|
||||
render={<Link href="/collections" />}
|
||||
variant="outline"
|
||||
size="icon"
|
||||
aria-label={t("collections")}
|
||||
>
|
||||
<ListIcon />
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
onClick={handleLogout}
|
||||
aria-label={t("logout")}
|
||||
>
|
||||
<LogOutIcon />
|
||||
</Button>
|
||||
</>
|
||||
) : (
|
||||
<Button
|
||||
nativeButton={false}
|
||||
render={<Link href="/oauth/login" />}
|
||||
size="icon"
|
||||
aria-label={t("login")}
|
||||
>
|
||||
<KeyIcon />
|
||||
</Button>
|
||||
)}
|
||||
<ThemeToggler />
|
||||
<LocaleSwitcher />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user