mirror of
https://github.com/supabase/supabase.git
synced 2026-10-09 11:25:06 +03:00
* First * Fix the parsing of SQL. * Get thread data action * Remove old page * Wait for data to complete * SSR everywhere * Remove unused * Add monaco settings * update loaders * Add sorting * supress hydration warnings * Fix profile layout * more server action action * fixes * Update page.tsx * Update actions.ts * Update AssistantChatForm.tsx * init * add polling * Update actions.ts * redirect to message id * Update page.tsx * Update page.tsx * handle run loading states with use client state with valtio * reduce first load JS * test action v1 * test action v2 * server action test 3 * test action 4 * test action 5 * test 6 * test 7 * test 7 * test 8 * test 9 * test 10 * test 11 * TEST 12 * TEST 13 * try and make it work * Update page.tsx * Update actions.ts * redirect added in * Update page.tsx * Update SchemaFlow.tsx * Update SchemaFlowHandler.tsx * 14 * Update SchemaFlow.tsx * move parse tables to client * a11y fixes --------- Co-authored-by: Terry Sutton <saltcod@gmail.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
import { createClient } from '@/lib/supabase/server'
|
|
import { User2 } from 'lucide-react'
|
|
import { cookies } from 'next/headers'
|
|
import { Suspense } from 'react'
|
|
import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from 'ui'
|
|
import AvatarDropdown from './AvatarDropdown'
|
|
import NoUserDropdown from './NoUserDropdown'
|
|
|
|
const EmptyUserButton = () => (
|
|
<Button type="outline" className="p-1.5 rounded-full" icon={<User2 size={16} />} />
|
|
)
|
|
|
|
export function UserDropdown() {
|
|
return (
|
|
<Suspense fallback={<EmptyUserButton />}>
|
|
<Dropdowns />
|
|
</Suspense>
|
|
)
|
|
}
|
|
|
|
async function Dropdowns() {
|
|
const cookieStore = cookies()
|
|
const supabase = createClient(cookieStore)
|
|
|
|
const {
|
|
data: { user },
|
|
} = await supabase.auth.getUser()
|
|
|
|
return (
|
|
<DropdownMenu modal={false}>
|
|
<DropdownMenuTrigger asChild className="flex">
|
|
{user ? (
|
|
<button
|
|
title="User dropdown menu"
|
|
className="border border-foreground-lighter rounded-full w-[30px] h-[30px] bg-no-repeat bg-center bg-cover"
|
|
style={{ backgroundImage: `url('${user.user_metadata.avatar_url}')` }}
|
|
/>
|
|
) : (
|
|
<EmptyUserButton />
|
|
)}
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent side="bottom" align="end" className="w-64">
|
|
{user ? <AvatarDropdown user={user} /> : <NoUserDropdown />}
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
)
|
|
}
|
|
|
|
export default UserDropdown
|