@@ -6,34 +6,22 @@ import {
6
6
type MetaFunction ,
7
7
} from '@remix-run/node'
8
8
import {
9
- Form ,
10
- Link ,
11
9
Links ,
12
10
Meta ,
13
11
Outlet ,
14
12
Scripts ,
15
13
ScrollRestoration ,
16
14
useLoaderData ,
17
- useSubmit ,
18
15
} from '@remix-run/react'
19
16
import { withSentry } from '@sentry/remix'
20
- import { useRef } from 'react'
21
17
import { HoneypotProvider } from 'remix-utils/honeypot/react'
22
18
import { GeneralErrorBoundary } from './components/error-boundary.tsx'
23
19
import { EpicProgress } from './components/progress-bar.tsx'
24
20
import { useToast } from './components/toaster.tsx'
25
- import { Button } from './components/ui/button.tsx'
26
- import {
27
- DropdownMenu ,
28
- DropdownMenuContent ,
29
- DropdownMenuItem ,
30
- DropdownMenuPortal ,
31
- DropdownMenuTrigger ,
32
- } from './components/ui/dropdown-menu.tsx'
33
- import { Icon , href as iconsHref } from './components/ui/icon.tsx'
21
+ import { href as iconsHref } from './components/ui/icon.tsx'
34
22
import { EpicToaster } from './components/ui/sonner.tsx'
35
23
import { TooltipProvider } from './components/ui/tooltip.tsx'
36
- import { ThemeSwitch , useTheme } from './routes/resources+/theme-switch.tsx'
24
+ import { useTheme } from './routes/resources+/theme-switch.tsx'
37
25
import tailwindStyleSheetUrl from './styles/tailwind.css?url'
38
26
import { getUserId , logout } from './utils/auth.server.ts'
39
27
import { ClientHintCheck , getHints } from './utils/client-hints.tsx'
@@ -42,11 +30,9 @@ import { getEnv } from './utils/env.server.ts'
42
30
import { honeypot } from './utils/honeypot.server.ts'
43
31
import { combineHeaders , getDomainUrl } from './utils/misc.tsx'
44
32
import { useNonce } from './utils/nonce-provider.ts'
45
- import { getCustomerProducts } from './utils/stripe.server.ts'
46
33
import { getTheme , type Theme } from './utils/theme.server.ts'
47
34
import { makeTimings , time } from './utils/timing.server.ts'
48
35
import { getToast } from './utils/toast.server.ts'
49
- import { useOptionalUser , useUser } from './utils/user.ts'
50
36
51
37
export const links : LinksFunction = ( ) => {
52
38
return [
@@ -121,9 +107,6 @@ export async function loader({ request }: LoaderFunctionArgs) {
121
107
return json (
122
108
{
123
109
user,
124
- isSubscribed : user ?. stripeId
125
- ? Boolean ( ( await getCustomerProducts ( user . stripeId ) ) . products . length )
126
- : false ,
127
110
requestInfo : {
128
111
hints : getHints ( request ) ,
129
112
origin : getDomainUrl ( request ) ,
@@ -195,7 +178,6 @@ function Document({
195
178
function App ( ) {
196
179
const data = useLoaderData < typeof loader > ( )
197
180
const nonce = useNonce ( )
198
- const user = useOptionalUser ( )
199
181
const theme = useTheme ( )
200
182
const allowIndexing = data . ENV . ALLOW_INDEXING !== 'false'
201
183
useToast ( data . toast )
@@ -207,91 +189,13 @@ function App() {
207
189
allowIndexing = { allowIndexing }
208
190
env = { data . ENV }
209
191
>
210
- < div className = "flex h-screen flex-col justify-between" >
211
- < header className = "container py-6" >
212
- < nav className = "flex flex-wrap items-center justify-between gap-4 sm:flex-nowrap md:gap-8" >
213
- < Logo />
214
- < div className = "flex items-center gap-10" >
215
- { user ? (
216
- < div className = "flex gap-4" >
217
- { data . isSubscribed ? null : (
218
- < Button variant = "outline" asChild >
219
- < Link to = "/settings/profile/subscription" >
220
- Start your free trial
221
- </ Link >
222
- </ Button >
223
- ) }
224
- < UserDropdown />
225
- </ div >
226
- ) : (
227
- < Button asChild variant = "default" size = "lg" >
228
- < Link to = "/login" > Log In</ Link >
229
- </ Button >
230
- ) }
231
- </ div >
232
- </ nav >
233
- </ header >
234
- < div className = "flex-1" >
235
- < Outlet />
236
- </ div >
237
- < footer className = "container my-4 flex items-center justify-between pb-5" >
238
- < div className = "flex items-center gap-4" >
239
- < Logo />
240
- < nav >
241
- < ul className = "flex list-none flex-col gap-2 md:flex-row md:gap-4" >
242
- < li >
243
- < Link
244
- to = "/about"
245
- className = "text-gray-600 hover:text-gray-900"
246
- >
247
- About
248
- </ Link >
249
- </ li >
250
- < li >
251
- < Link
252
- to = "/privacy"
253
- className = "text-gray-600 hover:text-gray-900"
254
- >
255
- Privacy
256
- </ Link >
257
- </ li >
258
- < li >
259
- < Link to = "/tos" className = "text-gray-600 hover:text-gray-900" >
260
- Terms of Service
261
- </ Link >
262
- </ li >
263
- < li >
264
- < Link
265
- to = "/support"
266
- className = "text-gray-600 hover:text-gray-900"
267
- >
268
- Support
269
- </ Link >
270
- </ li >
271
- < li >
272
- < Link
273
- to = "/contact"
274
- className = "text-gray-600 hover:text-gray-900"
275
- >
276
- Contact
277
- </ Link >
278
- </ li >
279
- </ ul >
280
- </ nav >
281
- </ div >
282
- < ThemeSwitch userPreference = { data . requestInfo . userPrefs . theme } />
283
- </ footer > { ' ' }
284
- </ div >
192
+ < Outlet />
285
193
< EpicToaster closeButton position = "top-center" theme = { theme } />
286
194
< EpicProgress />
287
195
</ Document >
288
196
)
289
197
}
290
198
291
- function Logo ( ) {
292
- return < Link to = "/" > GratiText</ Link >
293
- }
294
-
295
199
function AppWithProviders ( ) {
296
200
const data = useLoaderData < typeof loader > ( )
297
201
return (
@@ -305,62 +209,6 @@ function AppWithProviders() {
305
209
306
210
export default withSentry ( AppWithProviders )
307
211
308
- function UserDropdown ( ) {
309
- const user = useUser ( )
310
- const submit = useSubmit ( )
311
- const formRef = useRef < HTMLFormElement > ( null )
312
- return (
313
- < DropdownMenu >
314
- < DropdownMenuTrigger asChild >
315
- < Button asChild variant = "secondary" >
316
- < Link
317
- to = { `/users/${ user . username } ` }
318
- // this is for progressive enhancement
319
- onClick = { e => e . preventDefault ( ) }
320
- className = "flex items-center gap-2"
321
- >
322
- < span className = "text-body-sm font-bold" >
323
- { user . name ?? user . username }
324
- </ span >
325
- </ Link >
326
- </ Button >
327
- </ DropdownMenuTrigger >
328
- < DropdownMenuPortal >
329
- < DropdownMenuContent sideOffset = { 8 } align = "start" >
330
- < DropdownMenuItem asChild >
331
- < Link prefetch = "intent" to = { `/users/${ user . username } ` } >
332
- < Icon className = "text-body-md" name = "avatar" >
333
- Profile
334
- </ Icon >
335
- </ Link >
336
- </ DropdownMenuItem >
337
- < DropdownMenuItem asChild >
338
- < Link prefetch = "intent" to = { `/recipients` } >
339
- < Icon className = "text-body-md" name = "pencil-2" >
340
- Recipients
341
- </ Icon >
342
- </ Link >
343
- </ DropdownMenuItem >
344
- < DropdownMenuItem
345
- asChild
346
- // this prevents the menu from closing before the form submission is completed
347
- onSelect = { event => {
348
- event . preventDefault ( )
349
- submit ( formRef . current )
350
- } }
351
- >
352
- < Form action = "/logout" method = "POST" ref = { formRef } >
353
- < Icon className = "text-body-md" name = "exit" >
354
- < button type = "submit" > Logout</ button >
355
- </ Icon >
356
- </ Form >
357
- </ DropdownMenuItem >
358
- </ DropdownMenuContent >
359
- </ DropdownMenuPortal >
360
- </ DropdownMenu >
361
- )
362
- }
363
-
364
212
export function ErrorBoundary ( ) {
365
213
// the nonce doesn't rely on the loader so we can access that
366
214
const nonce = useNonce ( )
0 commit comments