import * as React from 'react'; import { LogOut, User, Settings } from 'lucide-react'; import { useNavigate } from '@tanstack/react-router'; import { useAuthStore, useSession } from '@imphnen-frontend-service/service'; import { cn } from '@imphnen-frontend-service/utils'; import { Avatar, AvatarFallback, AvatarImage, } from '../../atoms/avatar'; import { Button } from '../../atoms/button'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from '../../atoms/dropdown-menu'; import { Separator } from '../../atoms/separator'; import { SidebarTrigger } from '../../atoms/sidebar'; export type TBackofficeWrapperProps = { children: React.ReactNode; title?: string; description?: string; actions?: React.ReactNode; className?: string; classHeader?: string; classTitle?: string; }; export const BackofficeWrapper: React.FC = ({ children, title, description, actions, className, classHeader, classTitle, }) => { const { session } = useAuthStore(); const { signOut } = useSession(); const navigate = useNavigate(); const user = session?.user; const initials = (user?.fullname ?? 'U') .split(' ') .map((s) => s[0]) .slice(0, 2) .join('') .toUpperCase(); return (
{title && (

{title}

{description && (

{description}

)}
)}
{actions} {user?.fullname ?? 'Admin'} {user?.email ?? 'admin@imphnen.dev'} Profile Settings { signOut(); navigate({ to: '/auth/login' }); }} > Log out
{children}
); };