Skip to content

Commit 5279e81

Browse files
committed
fix: move meta export to JSX
1 parent 9a93959 commit 5279e81

File tree

13 files changed

+76
-120
lines changed

13 files changed

+76
-120
lines changed

.vscode/remix.code-snippets

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,6 @@
5656
"}",
5757
],
5858
},
59-
"meta": {
60-
"prefix": "/meta",
61-
"scope": "typescriptreact,javascriptreact,typescript,javascript",
62-
"body": [
63-
"import type { MetaFunction } from '@remix-run/node'",
64-
"",
65-
"export const meta: MetaFunction<typeof loader> = ({ data }) => [{",
66-
" title: 'Title',",
67-
"}]",
68-
],
69-
},
7059
"shouldRevalidate": {
7160
"prefix": "/shouldRevalidate",
7261
"scope": "typescriptreact,javascriptreact,typescript,javascript",

app/root.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,6 @@ export const links: LinksFunction = () => {
7070
].filter(Boolean)
7171
}
7272

73-
export const meta: MetaFunction<typeof loader> = ({ data }) => {
74-
return [
75-
{ title: data ? 'Epic Notes' : 'Error | Epic Notes' },
76-
{ name: 'description', content: `Your own captain's log` },
77-
]
78-
}
79-
8073
export async function loader({ request }: LoaderFunctionArgs) {
8174
const timings = makeTimings('root loader')
8275
const userId = await time(() => getUserId(request), {
@@ -168,6 +161,7 @@ function Document({
168161
<Meta />
169162
<meta charSet="utf-8" />
170163
<meta name="viewport" content="width=device-width,initial-scale=1" />
164+
<meta name="description" content="Your own captain's log" />
171165
{allowIndexing ? null : (
172166
<meta name="robots" content="noindex, nofollow" />
173167
)}
@@ -194,7 +188,7 @@ function App() {
194188
const user = useOptionalUser()
195189
const theme = useTheme()
196190
const matches = useMatches()
197-
const isOnSearchPage = matches.find((m) => m.id === 'routes/users+/index')
191+
const isOnSearchPage = matches.find(m => m.id === 'routes/users+/index')
198192
const searchBar = isOnSearchPage ? null : <SearchBar status="idle" />
199193
const allowIndexing = data.ENV.ALLOW_INDEXING !== 'false'
200194
useToast(data.toast)
@@ -206,6 +200,8 @@ function App() {
206200
allowIndexing={allowIndexing}
207201
env={data.ENV}
208202
>
203+
<title>Epic Notes</title>
204+
209205
<div className="flex h-screen flex-col justify-between">
210206
<header className="container py-6">
211207
<nav className="flex flex-wrap items-center justify-between gap-4 sm:flex-nowrap md:gap-8">
@@ -276,7 +272,7 @@ function UserDropdown() {
276272
<Link
277273
to={`/users/${user.username}`}
278274
// this is for progressive enhancement
279-
onClick={(e) => e.preventDefault()}
275+
onClick={e => e.preventDefault()}
280276
className="flex items-center gap-2"
281277
>
282278
<img
@@ -309,7 +305,7 @@ function UserDropdown() {
309305
<DropdownMenuItem
310306
asChild
311307
// this prevents the menu from closing before the form submission is completed
312-
onSelect={(event) => {
308+
onSelect={event => {
313309
event.preventDefault()
314310
submit(formRef.current)
315311
}}
@@ -340,6 +336,7 @@ export function ErrorBoundary() {
340336

341337
return (
342338
<Document nonce={nonce}>
339+
<title>Error | Epic Notes</title>
343340
<GeneralErrorBoundary />
344341
</Document>
345342
)

app/routes/_auth+/forgot-password.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ function ForgotPasswordEmail({
118118
)
119119
}
120120

121-
export const meta: MetaFunction = () => {
122-
return [{ title: 'Password Recovery for Epic Notes' }]
123-
}
124-
125121
export default function ForgotPasswordRoute() {
126122
const forgotPassword = useFetcher<typeof action>()
127123

@@ -140,6 +136,7 @@ export default function ForgotPasswordRoute() {
140136
<div className="flex flex-col justify-center">
141137
<div className="text-center">
142138
<h1 className="text-h1">Forgot Password</h1>
139+
<title>Password Recovery for Epic Notes </title>
143140
<p className="mt-3 text-body-md text-muted-foreground">
144141
No worries, we'll send you reset instructions.
145142
</p>

app/routes/_auth+/login.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export async function action({ request }: ActionFunctionArgs) {
4545
const formData = await request.formData()
4646
checkHoneypot(formData)
4747
const submission = await parseWithZod(formData, {
48-
schema: (intent) =>
48+
schema: intent =>
4949
LoginFormSchema.transform(async (data, ctx) => {
5050
if (intent !== null) return { ...data, session: null }
5151

@@ -102,6 +102,7 @@ export default function LoginPage() {
102102
<div className="mx-auto w-full max-w-md">
103103
<div className="flex flex-col gap-3 text-center">
104104
<h1 className="text-h1">Welcome back!</h1>
105+
<title>Login to Epic Notes</title>
105106
<p className="text-body-md text-muted-foreground">
106107
Please enter your details.
107108
</p>
@@ -172,7 +173,7 @@ export default function LoginPage() {
172173
</div>
173174
</Form>
174175
<ul className="mt-5 flex flex-col gap-5 border-b-2 border-t-2 border-border py-3">
175-
{providerNames.map((providerName) => (
176+
{providerNames.map(providerName => (
176177
<li key={providerName}>
177178
<ProviderConnectionForm
178179
type="Login"
@@ -201,10 +202,6 @@ export default function LoginPage() {
201202
)
202203
}
203204

204-
export const meta: MetaFunction = () => {
205-
return [{ title: 'Login to Epic Notes' }]
206-
}
207-
208205
export function ErrorBoundary() {
209206
return <GeneralErrorBoundary />
210207
}

app/routes/_auth+/onboarding.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export async function action({ request }: ActionFunctionArgs) {
6969
const formData = await request.formData()
7070
checkHoneypot(formData)
7171
const submission = await parseWithZod(formData, {
72-
schema: (intent) =>
72+
schema: intent =>
7373
SignupFormSchema.superRefine(async (data, ctx) => {
7474
const existingUser = await prisma.user.findUnique({
7575
where: { username: data.username },
@@ -83,7 +83,7 @@ export async function action({ request }: ActionFunctionArgs) {
8383
})
8484
return
8585
}
86-
}).transform(async (data) => {
86+
}).transform(async data => {
8787
if (intent !== null) return { ...data, session: null }
8888

8989
const session = await signup({ ...data, email })
@@ -125,10 +125,6 @@ export async function action({ request }: ActionFunctionArgs) {
125125
)
126126
}
127127

128-
export const meta: MetaFunction = () => {
129-
return [{ title: 'Setup Epic Notes Account' }]
130-
}
131-
132128
export default function OnboardingRoute() {
133129
const data = useLoaderData<typeof loader>()
134130
const actionData = useActionData<typeof action>()
@@ -152,6 +148,7 @@ export default function OnboardingRoute() {
152148
<div className="mx-auto w-full max-w-lg">
153149
<div className="flex flex-col gap-3 text-center">
154150
<h1 className="text-h1">Welcome aboard {data.email}!</h1>
151+
<title>Setup Epic Notes Account</title>
155152
<p className="text-body-md text-muted-foreground">
156153
Please enter your details.
157154
</p>

app/routes/_auth+/onboarding_.$provider.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
130130
})
131131
return
132132
}
133-
}).transform(async (data) => {
133+
}).transform(async data => {
134134
const session = await signupWithConnection({
135135
...data,
136136
email,
@@ -174,10 +174,6 @@ export async function action({ request, params }: ActionFunctionArgs) {
174174
)
175175
}
176176

177-
export const meta: MetaFunction = () => {
178-
return [{ title: 'Setup Epic Notes Account' }]
179-
}
180-
181177
export default function OnboardingProviderRoute() {
182178
const data = useLoaderData<typeof loader>()
183179
const actionData = useActionData<typeof action>()
@@ -200,6 +196,7 @@ export default function OnboardingProviderRoute() {
200196
<div className="mx-auto w-full max-w-lg">
201197
<div className="flex flex-col gap-3 text-center">
202198
<h1 className="text-h1">Welcome aboard {data.email}!</h1>
199+
<title>Setup Epic Notes Account</title>
203200
<p className="text-body-md text-muted-foreground">
204201
Please enter your details.
205202
</p>

app/routes/_auth+/reset-password.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ export async function action({ request }: ActionFunctionArgs) {
6767
})
6868
}
6969

70-
export const meta: MetaFunction = () => {
71-
return [{ title: 'Reset Password | Epic Notes' }]
72-
}
73-
7470
export default function ResetPasswordPage() {
7571
const data = useLoaderData<typeof loader>()
7672
const actionData = useActionData<typeof action>()
@@ -90,6 +86,7 @@ export default function ResetPasswordPage() {
9086
<div className="container flex flex-col justify-center pb-32 pt-20">
9187
<div className="text-center">
9288
<h1 className="text-h1">Password Reset</h1>
89+
<title>Reset Password | Epic Notes</title>
9390
<p className="mt-3 text-body-md text-muted-foreground">
9491
Hi, {data.resetPasswordUsername}. No worries. It happens all the time.
9592
</p>

app/routes/_auth+/signup.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ export function SignupEmail({
116116
)
117117
}
118118

119-
export const meta: MetaFunction = () => {
120-
return [{ title: 'Sign Up | Epic Notes' }]
121-
}
122-
123119
export default function SignupRoute() {
124120
const actionData = useActionData<typeof action>()
125121
const isPending = useIsPending()
@@ -141,6 +137,7 @@ export default function SignupRoute() {
141137
<div className="container flex flex-col justify-center pb-32 pt-20">
142138
<div className="text-center">
143139
<h1 className="text-h1">Let's start your journey!</h1>
140+
<title>Sign Up | Epic Notes</title>
144141
<p className="mt-3 text-body-md text-muted-foreground">
145142
Please enter your email.
146143
</p>
@@ -171,7 +168,7 @@ export default function SignupRoute() {
171168
</StatusButton>
172169
</Form>
173170
<ul className="mt-5 flex flex-col gap-5 border-b-2 border-t-2 border-border py-3">
174-
{providerNames.map((providerName) => (
171+
{providerNames.map(providerName => (
175172
<li key={providerName}>
176173
<ProviderConnectionForm
177174
type="Signup"

app/routes/_marketing+/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { type MetaFunction } from '@remix-run/node'
21
import {
32
Tooltip,
43
TooltipContent,
@@ -8,8 +7,6 @@ import {
87
import { cn } from '#app/utils/misc.tsx'
98
import { logos } from './logos/logos.ts'
109

11-
export const meta: MetaFunction = () => [{ title: 'Epic Notes' }]
12-
1310
// Tailwind Grid cell classes lookup
1411
const columnClasses: Record<(typeof logos)[number]['column'], string> = {
1512
1: 'xl:col-start-1',
@@ -30,6 +27,8 @@ const rowClasses: Record<(typeof logos)[number]['row'], string> = {
3027
export default function Index() {
3128
return (
3229
<main className="font-poppins grid h-full place-items-center">
30+
<title>Epic Notes</title>
31+
3332
<div className="grid place-items-center px-4 py-16 xl:grid-cols-2 xl:gap-24">
3433
<div className="flex max-w-md flex-col items-center text-center xl:order-2 xl:items-start xl:text-left">
3534
<a

app/routes/users+/$username.tsx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ export default function ProfileRoute() {
3737

3838
return (
3939
<div className="container mb-48 mt-36 flex flex-col items-center justify-center">
40+
<title>{userDisplayName} | Epic Notes</title>
41+
<meta
42+
name="description"
43+
content={`Profile of ${userDisplayName} on Epic Notes`}
44+
/>
4045
<Spacer size="4xs" />
4146

4247
<div className="container flex flex-col items-center rounded-3xl bg-muted p-12">
@@ -98,17 +103,6 @@ export default function ProfileRoute() {
98103
)
99104
}
100105

101-
export const meta: MetaFunction<typeof loader> = ({ data, params }) => {
102-
const displayName = data?.user.name ?? params.username
103-
return [
104-
{ title: `${displayName} | Epic Notes` },
105-
{
106-
name: 'description',
107-
content: `Profile of ${displayName} on Epic Notes`,
108-
},
109-
]
110-
}
111-
112106
export function ErrorBoundary() {
113107
return (
114108
<GeneralErrorBoundary

0 commit comments

Comments
 (0)