mirror of
https://github.com/supabase/supabase.git
synced 2026-10-10 11:55:05 +03:00
* show cms blog posts in www * remove contentlayer from www * outputFileTracingExcludes * update remotePatterns * fetch cms posts server-side with revalidation * add cms env vars to turbo.json * add www env vars to turbo.json * include cms posts in www sitemap * add migration to remove image from cms post * update cms meta image mapping in www
63 lines
1.4 KiB
TypeScript
63 lines
1.4 KiB
TypeScript
'use client'
|
|
|
|
import type { User } from '@supabase/supabase-js'
|
|
import { Command, Database, LogOut, Settings, UserIcon } from 'lucide-react'
|
|
import { logOut } from 'common'
|
|
|
|
import type { menuItem } from 'ui-patterns/AuthenticatedDropdownMenu'
|
|
import { useSetCommandMenuOpen } from 'ui-patterns'
|
|
import { useRouter } from 'next/compat/router'
|
|
|
|
const useDropdownMenu = (user: User | null) => {
|
|
const router = useRouter()
|
|
const setCommandMenuOpen = useSetCommandMenuOpen()
|
|
|
|
const menu: menuItem[][] = [
|
|
[
|
|
{
|
|
label: user?.email ?? "You're logged in",
|
|
type: 'text',
|
|
icon: UserIcon,
|
|
},
|
|
{
|
|
label: 'Account Preferences',
|
|
icon: Settings,
|
|
href: 'https://supabase.com/dashboard/account/me',
|
|
},
|
|
{
|
|
label: 'All Projects',
|
|
icon: Database,
|
|
href: 'https://supabase.com/dashboard/projects',
|
|
},
|
|
{
|
|
label: 'Command Menu',
|
|
icon: Command,
|
|
type: 'button',
|
|
onClick: () => setCommandMenuOpen(true),
|
|
shortcut: '⌘K',
|
|
},
|
|
],
|
|
[
|
|
{
|
|
label: 'Theme',
|
|
type: 'theme',
|
|
},
|
|
],
|
|
[
|
|
{
|
|
label: 'Logout',
|
|
type: 'button',
|
|
icon: LogOut,
|
|
onClick: async () => {
|
|
await logOut()
|
|
router?.reload()
|
|
},
|
|
},
|
|
],
|
|
]
|
|
|
|
return menu
|
|
}
|
|
|
|
export default useDropdownMenu
|