import { Briefcase, FileCheck2, FileUser, History, LayoutDashboard, LogOut, Menu, Moon, Plus, Search, Settings, Sun, UploadCloud, X } from "lucide-react";
import { useState, type ReactNode } from "react";
import { Link, NavLink, useNavigate } from "react-router-dom";
import { useAuth } from "../lib/auth";
import { useI18n } from "../lib/i18n";
import { Logo, useTheme } from "./ui";
export function LangSwitch() {
const { lang, setLang } = useI18n();
return (
);
}
export function ThemeSwitch() {
const [dark, toggle] = useTheme();
const { t } = useI18n();
return (
);
}
export function PublicHeader() {
const { profile } = useAuth();
const { t } = useI18n();
return (
);
}
export function AppShell({ children }: { children: ReactNode }) {
const { profile, signOut } = useAuth();
const { t } = useI18n();
const nav = useNavigate();
const [open, setOpen] = useState(false);
const isRecruiter = profile?.role === "recruiter";
const links = isRecruiter
? [
{ to: "/app", icon: LayoutDashboard, label: t("nav_overview"), end: true },
{ to: "/app/jobs", icon: Briefcase, label: t("nav_jobs") },
]
: [
{ to: "/app", icon: LayoutDashboard, label: t("nav_dashboard"), end: true },
{ to: "/app/board", icon: Search, label: t("nav_board") },
{ to: "/app/applications", icon: FileCheck2, label: t("nav_applications") },
{ to: "/app/cv", icon: FileUser, label: t("nav_cv") },
{ to: "/app/new", icon: Plus, label: t("nav_new") },
{ to: "/app/history", icon: History, label: t("nav_history") },
];
const item = "flex items-center gap-3 rounded-xl px-3 py-2.5 text-[15px] font-medium transition-colors";
const sidebar = (
setOpen(false)}>
{links.map((l) => (
setOpen(false)}
className={({ isActive }) => `${item} ${isActive ? "bg-nile-soft text-nile-deep" : "text-muted hover:bg-sunken hover:text-ink"}`}>
{l.label}
))}
{t("nav_quick")}
setOpen(false)}
className={({ isActive }) => `${item} ${isActive ? "bg-nile-soft text-nile-deep" : "text-muted hover:bg-sunken hover:text-ink"}`}>
{t("nav_settings")}
{profile &&
{profile.full_name || profile.email}{profile.company ? `, ${profile.company.name}` : ""}
}
);
return (
{open && (
setOpen(false)} />
{sidebar}
)}
{children}
);
}