'use client';
import {
Skeleton,
Avatar,
Group,
Alert,
Menu,
Card,
Text,
UnstyledButton,
Stack,
} from '@mantine/core';
import { useMantineColorScheme } from '@mantine/core';
import useMyProfile from '../../lib/queries/useMyProfile';
import {
MdOutlineBugReport,
MdOutlineCollectionsBookmark,
MdOutlineSmartphone,
MdOutlineDarkMode,
MdOutlineLightMode,
} from 'react-icons/md';
import { TbStackForward } from 'react-icons/tb';
import { useAuth } from '@/hooks/useAuth';
import { useRouter } from 'next/navigation';
import Link from 'next/link';
import { IoMdLogOut } from 'react-icons/io';
import { useNavbarContext } from '@/providers/navbar';
import { useOs } from '@mantine/hooks';
import { BsThreeDots } from 'react-icons/bs';
import styles from './ProfileMenu.module.css';
import { sanitizeText } from '@/lib/utils/text';
import { isBotAccount } from '@/features/platforms/bluesky/lib/utils/account';
import BotLabel from '../botLabel/BotLabel';
const schemes = ['light', 'dark', 'auto'] as const;
type ColorScheme = (typeof schemes)[number];
const schemeConfig: Record<
ColorScheme,
{ icon: React.ReactNode; label: string; next: ColorScheme }
> = {
light: {
icon: ,
label: 'Light',
next: 'dark',
},
dark: { icon: , label: 'Dark', next: 'auto' },
auto: {
icon: ,
label: 'Auto',
next: 'light',
},
};
export default function ProfileMenu() {
const router = useRouter();
const os = useOs();
const { toggleMobile } = useNavbarContext();
const { data, error, isPending } = useMyProfile();
const { logout } = useAuth();
const { colorScheme, setColorScheme } = useMantineColorScheme();
const current = schemeConfig[colorScheme as ColorScheme] ?? schemeConfig.auto;
const handleLogout = async () => {
try {
await logout();
router.push('/');
} catch (error) {
console.error('Error logging out:', error);
}
};
if (isPending || !data) {
return ;
}
if (error) {
return ;
}
return (
);
}