diff --git a/app/components/user-dropdown.tsx b/app/components/user-dropdown.tsx new file mode 100644 index 00000000..2155afe3 --- /dev/null +++ b/app/components/user-dropdown.tsx @@ -0,0 +1,74 @@ +import { useRef } from 'react' +import { useSubmit, Link, Form } from 'react-router' +import { getUserImgSrc } from '#app/utils/misc.tsx' +import { useUser } from '#app/utils/user.ts' +import { Button } from './ui/button' +import { + DropdownMenu, + DropdownMenuTrigger, + DropdownMenuPortal, + DropdownMenuContent, + DropdownMenuItem, +} from './ui/dropdown-menu' +import { Icon } from './ui/icon' + +export function UserDropdown() { + const user = useUser() + const submit = useSubmit() + const formRef = useRef(null) + return ( + + + + + + + + + + Profile + + + + + + + Notes + + + + { + event.preventDefault() + await submit(formRef.current) + }} + > +
+ + + +
+
+
+
+
+ ) +} diff --git a/app/root.tsx b/app/root.tsx index bce9d40a..312bfc7c 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -1,7 +1,5 @@ -import { useRef } from 'react' import { data, - Form, Link, Links, Meta, @@ -10,7 +8,6 @@ import { ScrollRestoration, useLoaderData, useMatches, - useSubmit, } from 'react-router' import { HoneypotProvider } from 'remix-utils/honeypot/react' import { type Route } from './+types/root.ts' @@ -21,15 +18,9 @@ import { EpicProgress } from './components/progress-bar.tsx' import { SearchBar } from './components/search-bar.tsx' import { useToast } from './components/toaster.tsx' import { Button } from './components/ui/button.tsx' -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuPortal, - DropdownMenuTrigger, -} from './components/ui/dropdown-menu.tsx' -import { Icon, href as iconsHref } from './components/ui/icon.tsx' +import { href as iconsHref } from './components/ui/icon.tsx' import { EpicToaster } from './components/ui/sonner.tsx' +import { UserDropdown } from './components/user-dropdown.tsx' import { ThemeSwitch, useOptionalTheme, @@ -42,12 +33,12 @@ import { prisma } from './utils/db.server.ts' import { getEnv } from './utils/env.server.ts' import { pipeHeaders } from './utils/headers.server.ts' import { honeypot } from './utils/honeypot.server.ts' -import { combineHeaders, getDomainUrl, getUserImgSrc } from './utils/misc.tsx' +import { combineHeaders, getDomainUrl } from './utils/misc.tsx' import { useNonce } from './utils/nonce-provider.ts' import { type Theme, getTheme } from './utils/theme.server.ts' import { makeTimings, time } from './utils/timing.server.ts' import { getToast } from './utils/toast.server.ts' -import { useOptionalUser, useUser } from './utils/user.ts' +import { useOptionalUser } from './utils/user.ts' export const links: Route.LinksFunction = () => { return [ @@ -264,67 +255,6 @@ function AppWithProviders() { export default AppWithProviders -function UserDropdown() { - const user = useUser() - const submit = useSubmit() - const formRef = useRef(null) - return ( - - - - - - - - - - Profile - - - - - - - Notes - - - - { - event.preventDefault() - await submit(formRef.current) - }} - > -
- - - -
-
-
-
-
- ) -} - // this is a last resort error boundary. There's not much useful information we // can offer at this level. export const ErrorBoundary = GeneralErrorBoundary diff --git a/package.json b/package.json index b346fa0a..f5588dd2 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "sideEffects": false, "license": "MIT", "epic-stack": { - "head": "5c5328b38e442d78933d5be8fae21fe317296c29", - "date": "2025-01-17T19:16:26Z" + "head": "8468b0101fbee9d09f7ea426eaefec74583641b4", + "date": "2025-01-17T22:03:13Z" }, "author": "Kent C. Dodds (https://kentcdodds.com/)", "type": "module",