forked from rajun/ar-test
41 lines
1.7 KiB
TypeScript
41 lines
1.7 KiB
TypeScript
import { useNavigate } from 'react-router';
|
|
import { LogOut, Settings } from 'lucide-react';
|
|
import { toast } from 'sonner';
|
|
import { Button } from '~/components/ui/button';
|
|
import { Text } from '~/components/ui/text';
|
|
import { SidebarLink } from '~/components/admin/sidebar/sidebar-link';
|
|
import { ROUTES } from '~/data/routes';
|
|
import { useAdminData } from '~/hooks/admin/use-admin-data';
|
|
import { signOut } from '~/services/auth';
|
|
|
|
export function SidebarFooter({ settingsActive, onNavigate }: { settingsActive: boolean; onNavigate?: () => void }) {
|
|
const { email } = useAdminData();
|
|
const navigate = useNavigate();
|
|
|
|
return (
|
|
<div className='flex flex-col gap-2'>
|
|
<SidebarLink size='nav' to={ROUTES.settings} label='Settings' active={settingsActive} leading={<Settings size={14} />} onNavigate={onNavigate} />
|
|
<div className='flex flex-col items-start gap-2 border-t border-border-divider px-1.5 pt-3'>
|
|
{email && (
|
|
<Text variant='caption' tone='secondary' truncate className='max-w-full'>
|
|
{email}
|
|
</Text>
|
|
)}
|
|
<Button
|
|
variant='link'
|
|
size='sm'
|
|
className='h-auto gap-2 text-text-subtle hover:text-text-primary'
|
|
onClick={() => {
|
|
signOut();
|
|
toast.success('Signed out');
|
|
navigate(ROUTES.login, { replace: true });
|
|
}}
|
|
>
|
|
<LogOut size={13} />
|
|
Sign out
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|