@@ -6,53 +6,43 @@ import {
6
6
type MetaFunction ,
7
7
} from '@remix-run/node'
8
8
import {
9
- Form ,
10
9
Link ,
11
10
Links ,
12
11
Meta ,
13
12
Outlet ,
14
13
Scripts ,
15
14
ScrollRestoration ,
16
15
useLoaderData ,
17
- useSubmit ,
18
16
} from '@remix-run/react'
19
17
import { withSentry } from '@sentry/remix'
20
- import { useRef , useState } from 'react'
18
+ import { useState } from 'react'
21
19
import { HoneypotProvider } from 'remix-utils/honeypot/react'
20
+ import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
22
21
import { LogoIcon , MenuIcon , XIcon } from '#app/components/icons'
22
+ import { EpicProgress } from '#app/components/progress-bar.tsx'
23
23
import SiteFooter from '#app/components/site-footer.js'
24
+ import { useToast } from '#app/components/toaster.tsx'
25
+ import { Button } from '#app/components/ui/button.tsx'
26
+ import { href as iconsHref } from '#app/components/ui/icon.tsx'
24
27
import {
25
28
SheetTrigger ,
26
29
SheetClose ,
27
30
SheetContent ,
28
31
Sheet ,
29
32
} from '#app/components/ui/sheet'
30
- import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
31
- import { EpicProgress } from '#app/components/progress-bar.tsx'
32
- import { useToast } from '#app/components/toaster.tsx'
33
- import { Button } from '#app/components/ui/button.tsx'
34
- import {
35
- DropdownMenu ,
36
- DropdownMenuContent ,
37
- DropdownMenuItem ,
38
- DropdownMenuPortal ,
39
- DropdownMenuTrigger ,
40
- } from '#app/components/ui/dropdown-menu.tsx'
41
- import { Icon , href as iconsHref } from '#app/components/ui/icon.tsx'
42
33
import { EpicToaster } from '#app/components/ui/sonner.tsx'
43
- import tailwindStyleSheetUrl from './styles/tailwind.css?url '
34
+ import { ThemeSwitch , useTheme } from '#app/routes/resources+/theme '
44
35
import { getUserId , logout } from '#app/utils/auth.server.ts'
45
36
import { ClientHintCheck , getHints } from '#app/utils/client-hints.tsx'
46
37
import { prisma } from '#app/utils/db.server.ts'
47
38
import { getEnv } from '#app/utils/env.server.ts'
48
39
import { honeypot } from '#app/utils/honeypot.server.ts'
49
- import { combineHeaders , getDomainUrl , getUserImgSrc } from '#app/utils/misc.tsx'
40
+ import { combineHeaders , getDomainUrl } from '#app/utils/misc.tsx'
50
41
import { useNonce } from '#app/utils/nonce-provider.ts'
51
42
import { type Theme , getTheme } from '#app/utils/theme.server.ts'
52
43
import { makeTimings , time } from '#app/utils/timing.server.ts'
53
44
import { getToast } from '#app/utils/toast.server.ts'
54
- import { useUser } from '#app/utils/user.ts'
55
- import { ThemeSwitch , useTheme } from '#app/routes/resources+/theme'
45
+ import tailwindStyleSheetUrl from './styles/tailwind.css?url'
56
46
57
47
export const links : LinksFunction = ( ) => {
58
48
return [
@@ -307,67 +297,6 @@ function AppWithProviders() {
307
297
308
298
export default withSentry ( AppWithProviders )
309
299
310
- export function UserDropdown ( ) {
311
- const user = useUser ( )
312
- const submit = useSubmit ( )
313
- const formRef = useRef < HTMLFormElement > ( null )
314
- return (
315
- < DropdownMenu >
316
- < DropdownMenuTrigger asChild >
317
- < Button asChild variant = "secondary" >
318
- < Link
319
- to = { `/users/${ user . username } ` }
320
- // this is for progressive enhancement
321
- onClick = { e => e . preventDefault ( ) }
322
- className = "flex items-center gap-2"
323
- >
324
- < img
325
- className = "h-8 w-8 rounded-full object-cover"
326
- alt = { user . name ?? user . username }
327
- src = { getUserImgSrc ( user . image ?. id ) }
328
- />
329
- < span className = "text-body-sm font-bold" >
330
- { user . name ?? user . username }
331
- </ span >
332
- </ Link >
333
- </ Button >
334
- </ DropdownMenuTrigger >
335
- < DropdownMenuPortal >
336
- < DropdownMenuContent sideOffset = { 8 } align = "start" >
337
- < DropdownMenuItem asChild >
338
- < Link prefetch = "intent" to = { `/users/${ user . username } ` } >
339
- < Icon className = "text-body-md" name = "avatar" >
340
- Profile
341
- </ Icon >
342
- </ Link >
343
- </ DropdownMenuItem >
344
- < DropdownMenuItem asChild >
345
- < Link prefetch = "intent" to = { `/users/${ user . username } /notes` } >
346
- < Icon className = "text-body-md" name = "pencil-2" >
347
- Notes
348
- </ Icon >
349
- </ Link >
350
- </ DropdownMenuItem >
351
- < DropdownMenuItem
352
- asChild
353
- // this prevents the menu from closing before the form submission is completed
354
- onSelect = { event => {
355
- event . preventDefault ( )
356
- submit ( formRef . current )
357
- } }
358
- >
359
- < Form action = "/logout" method = "POST" ref = { formRef } >
360
- < Icon className = "text-body-md" name = "exit" >
361
- < button type = "submit" > Logout</ button >
362
- </ Icon >
363
- </ Form >
364
- </ DropdownMenuItem >
365
- </ DropdownMenuContent >
366
- </ DropdownMenuPortal >
367
- </ DropdownMenu >
368
- )
369
- }
370
-
371
300
export function ErrorBoundary ( ) {
372
301
// the nonce doesn't rely on the loader so we can access that
373
302
const nonce = useNonce ( )
0 commit comments