feat: dashboard v2, esm, upgrades (#211)
* esm * wip * wip * wip * wip * wip * wip * subscription notice * wip * wip * wip * fix envs * fix: update docker build * fix * esm/types * delete dashboard :D * add patches to dockerfiles * update packages + catalogs + ts * wip * remove native libs * ts * improvements * fix redirects and fetching session * try fix favicon * fixes * fix * order and resize reportds within a dashboard * improvements * wip * added userjot to dashboard * fix * add op * wip * different cache key * improve date picker * fix table * event details loading * redo onboarding completely * fix login * fix * fix * extend session, billing and improve bars * fix * reduce price on 10M
This commit is contained in:
committed by
GitHub
parent
436e81ecc9
commit
81a7e5d62e
70
apps/start/src/components/profile-toggle.tsx
Normal file
70
apps/start/src/components/profile-toggle.tsx
Normal file
@@ -0,0 +1,70 @@
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuShortcut,
|
||||
DropdownMenuSub,
|
||||
DropdownMenuSubContent,
|
||||
DropdownMenuSubTrigger,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu';
|
||||
import { useTheme } from '@/hooks/use-theme';
|
||||
import { CheckIcon, UserIcon } from 'lucide-react';
|
||||
|
||||
import { useLogout } from '@/hooks/use-logout';
|
||||
import { themeConfig } from './theme-provider';
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function ProfileToggle({ className }: Props) {
|
||||
const { setTheme, userTheme, themes } = useTheme();
|
||||
const logout = useLogout();
|
||||
|
||||
return (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="outline" size="icon" className={className}>
|
||||
<UserIcon className="size-4" />
|
||||
<span className="sr-only">Profile</span>
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="center" className="w-56">
|
||||
<DropdownMenuSub>
|
||||
<DropdownMenuSubTrigger className="flex w-full items-center justify-between">
|
||||
Theme
|
||||
<DropdownMenuShortcut>
|
||||
<span className="mr-2">{themeConfig[userTheme].icon}</span>
|
||||
{themeConfig[userTheme].label}
|
||||
</DropdownMenuShortcut>
|
||||
</DropdownMenuSubTrigger>
|
||||
<DropdownMenuSubContent className="p-0">
|
||||
{themes.map((themeOption) => (
|
||||
<DropdownMenuItem
|
||||
key={themeOption.key}
|
||||
onClick={() => setTheme(themeOption.key)}
|
||||
className="capitalize"
|
||||
>
|
||||
<span className="mr-2">{themeOption.icon}</span>
|
||||
{themeOption.label}
|
||||
{userTheme === themeOption.key && (
|
||||
<CheckIcon className="ml-2 h-4 w-4" />
|
||||
)}
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
</DropdownMenuSubContent>
|
||||
</DropdownMenuSub>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem
|
||||
className="text-red-600"
|
||||
onClick={() => logout.mutate()}
|
||||
>
|
||||
Logout
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user