Skip to content

Commit 03ef292

Browse files
committed
feat: upgrade to next 13.2
1 parent 0bace50 commit 03ef292

File tree

133 files changed

+6606
-6060
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+6606
-6060
lines changed

.eslintrc.json

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
{
2-
"extends": "next/core-web-vitals",
2+
"$schema": "https://json.schemastore.org/eslintrc",
3+
"root": true,
4+
"extends": [
5+
"next/core-web-vitals",
6+
"prettier",
7+
"plugin:tailwindcss/recommended"
8+
],
9+
"plugins": ["tailwindcss"],
310
"rules": {
4-
"@next/next/no-head-element": "off"
11+
"@next/next/no-html-link-for-pages": "off",
12+
"react/jsx-key": "off",
13+
"tailwindcss/no-custom-classname": "off",
14+
"tailwindcss/classnames-order": "error"
15+
},
16+
"settings": {
17+
"tailwindcss": {
18+
"callees": ["cn"]
19+
},
20+
"next": {
21+
"rootDir": true
22+
}
523
}
624
}

.prettierignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
dist
2+
node_modules
3+
.next
4+
build
5+
.contentlayer

.prettierrc.json

-7
This file was deleted.

app/(auth)/login/page.tsx

+22-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
1+
import { Metadata } from "next"
12
import Link from "next/link"
23

4+
import { cn } from "@/lib/utils"
35
import { Icons } from "@/components/icons"
4-
import { UserAuthForm } from "@/components/dashboard/user-auth-form"
6+
import { buttonVariants } from "@/components/ui/button"
7+
import { UserAuthForm } from "@/components/user-auth-form"
8+
9+
export const metadata: Metadata = {
10+
title: "Login",
11+
description: "Login to your account",
12+
}
513

614
export default function LoginPage() {
715
return (
816
<div className="container flex h-screen w-screen flex-col items-center justify-center">
917
<Link
1018
href="/"
11-
className="absolute top-4 left-4 inline-flex items-center justify-center rounded-lg border border-transparent bg-transparent py-2 px-3 text-center text-sm font-medium text-slate-900 hover:border-slate-200 hover:bg-slate-100 focus:z-10 focus:outline-none focus:ring-4 focus:ring-slate-200 md:top-8 md:left-8"
19+
className={cn(
20+
buttonVariants({ variant: "ghost" }),
21+
"absolute top-4 left-4 md:top-8 md:left-8"
22+
)}
1223
>
1324
<>
1425
<Icons.chevronLeft className="mr-2 h-4 w-4" />
@@ -18,14 +29,19 @@ export default function LoginPage() {
1829
<div className="mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[350px]">
1930
<div className="flex flex-col space-y-2 text-center">
2031
<Icons.logo className="mx-auto h-6 w-6" />
21-
<h1 className="text-2xl font-bold">Welcome back</h1>
22-
<p className="text-sm text-slate-600">
32+
<h1 className="text-2xl font-semibold tracking-tight">
33+
Welcome back
34+
</h1>
35+
<p className="text-sm text-slate-500 dark:text-slate-400">
2336
Enter your email to sign in to your account
2437
</p>
2538
</div>
2639
<UserAuthForm />
27-
<p className="px-8 text-center text-sm text-slate-600">
28-
<Link href="/register" className="underline hover:text-brand">
40+
<p className="px-8 text-center text-sm text-slate-500 dark:text-slate-400">
41+
<Link
42+
href="/register"
43+
className="hover:text-brand underline underline-offset-4"
44+
>
2945
Don&apos;t have an account? Sign Up
3046
</Link>
3147
</p>

app/(auth)/register/page.tsx

+25-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
import Link from "next/link"
22

3+
import { cn } from "@/lib/utils"
34
import { Icons } from "@/components/icons"
4-
import { UserAuthForm } from "@/components/dashboard/user-auth-form"
5+
import { buttonVariants } from "@/components/ui/button"
6+
import { UserAuthForm } from "@/components/user-auth-form"
7+
8+
export const metadata = {
9+
title: "Create an account",
10+
description: "Create an account to get started.",
11+
}
512

613
export default function RegisterPage() {
714
return (
815
<div className="container grid h-screen w-screen flex-col items-center justify-center lg:max-w-none lg:grid-cols-2 lg:px-0">
916
<Link
1017
href="/login"
11-
className="absolute top-4 right-4 inline-flex items-center justify-center rounded-lg border border-transparent bg-transparent py-2 px-3 text-center text-sm font-medium text-slate-900 hover:border-slate-200 hover:bg-slate-100 focus:z-10 focus:outline-none focus:ring-4 focus:ring-slate-200 md:top-8 md:right-8"
18+
className={cn(
19+
buttonVariants({ variant: "ghost" }),
20+
"absolute top-4 right-4 md:top-8 md:right-8"
21+
)}
1222
>
1323
Login
1424
</Link>
@@ -17,19 +27,27 @@ export default function RegisterPage() {
1727
<div className="mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[350px]">
1828
<div className="flex flex-col space-y-2 text-center">
1929
<Icons.logo className="mx-auto h-6 w-6" />
20-
<h1 className="text-2xl font-bold">Create an account</h1>
21-
<p className="text-sm text-slate-600">
30+
<h1 className="text-2xl font-semibold tracking-tight">
31+
Create an account
32+
</h1>
33+
<p className="text-sm text-slate-500 dark:text-slate-400">
2234
Enter your email below to create your account
2335
</p>
2436
</div>
2537
<UserAuthForm />
26-
<p className="px-8 text-center text-sm text-slate-600">
38+
<p className="px-8 text-center text-sm text-slate-500 dark:text-slate-400">
2739
By clicking continue, you agree to our{" "}
28-
<Link href="/terms" className="underline hover:text-brand">
40+
<Link
41+
href="/terms"
42+
className="hover:text-brand underline underline-offset-4"
43+
>
2944
Terms of Service
3045
</Link>{" "}
3146
and{" "}
32-
<Link href="/privacy" className="underline hover:text-brand">
47+
<Link
48+
href="/privacy"
49+
className="hover:text-brand underline underline-offset-4"
50+
>
3351
Privacy Policy
3452
</Link>
3553
.

app/(dashboard)/dashboard/billing/loading.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { DashboardHeader } from "@/components/dashboard/header"
2-
import { DashboardShell } from "@/components/dashboard/shell"
3-
import { Card } from "@/ui/card"
1+
import { DashboardHeader } from "@/components/header"
2+
import { DashboardShell } from "@/components/shell"
3+
import { Card } from "@/components/ui/card"
44

55
export default function DashboardBillingLoading() {
66
return (

app/(dashboard)/dashboard/billing/page.tsx

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
11
import { redirect } from "next/navigation"
22

3-
import { getCurrentUser } from "@/lib/session"
43
import { authOptions } from "@/lib/auth"
4+
import { getCurrentUser } from "@/lib/session"
55
import { stripe } from "@/lib/stripe"
6-
import { getUserSubscriptionPlan as getUserSubscriptionPlan } from "@/lib/subscription"
7-
import { Card } from "@/ui/card"
8-
import { DashboardHeader } from "@/components/dashboard/header"
9-
import { DashboardShell } from "@/components/dashboard/shell"
10-
import { BillingForm } from "@/components/dashboard/billing-form"
6+
import { getUserSubscriptionPlan } from "@/lib/subscription"
7+
import { BillingForm } from "@/components/billing-form"
8+
import { DashboardHeader } from "@/components/header"
9+
import { DashboardShell } from "@/components/shell"
10+
import { Card } from "@/components/ui/card"
11+
12+
export const metadata = {
13+
title: "Billing",
14+
description: "Manage billing and your subscription plan.",
15+
}
1116

1217
export default async function BillingPage() {
1318
const user = await getCurrentUser()
1419

1520
if (!user) {
16-
redirect(authOptions.pages.signIn)
21+
redirect(authOptions?.pages?.signIn || "/login")
1722
}
1823

1924
const subscriptionPlan = await getUserSubscriptionPlan(user.id)
2025

2126
// If user has a pro plan, check cancel status on Stripe.
2227
let isCanceled = false
23-
if (subscriptionPlan.isPro) {
28+
if (subscriptionPlan.isPro && subscriptionPlan.stripeSubscriptionId) {
2429
const stripePlan = await stripe.subscriptions.retrieve(
2530
subscriptionPlan.stripeSubscriptionId
2631
)

app/(dashboard)/dashboard/layout.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { notFound } from "next/navigation"
22

33
import { dashboardConfig } from "@/config/dashboard"
44
import { getCurrentUser } from "@/lib/session"
5-
import { DashboardNav } from "@/components/dashboard/nav"
6-
import { UserAccountNav } from "@/components/dashboard/user-account-nav"
75
import { MainNav } from "@/components/main-nav"
6+
import { DashboardNav } from "@/components/nav"
7+
import { UserAccountNav } from "@/components/user-account-nav"
88

99
interface DashboardLayoutProps {
1010
children?: React.ReactNode

app/(dashboard)/dashboard/loading.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { DashboardHeader } from "@/components/dashboard/header"
2-
import { DashboardShell } from "@/components/dashboard/shell"
3-
import { PostCreateButton } from "@/components/dashboard/post-create-button"
4-
import { PostItem } from "@/components/dashboard/post-item"
1+
import { DashboardHeader } from "@/components/header"
2+
import { PostCreateButton } from "@/components/post-create-button"
3+
import { PostItem } from "@/components/post-item"
4+
import { DashboardShell } from "@/components/shell"
55

66
export default function DashboardLoading() {
77
return (

app/(dashboard)/dashboard/page.tsx

+21-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
import { redirect } from "next/navigation"
21
import { cache } from "react"
2+
import { redirect } from "next/navigation"
3+
import { User } from "@prisma/client"
34

5+
import { authOptions } from "@/lib/auth"
46
import { db } from "@/lib/db"
57
import { getCurrentUser } from "@/lib/session"
6-
import { User } from "@prisma/client"
7-
import { authOptions } from "@/lib/auth"
8-
import { DashboardHeader } from "@/components/dashboard/header"
9-
import { PostCreateButton } from "@/components/dashboard/post-create-button"
10-
import { DashboardShell } from "@/components/dashboard/shell"
11-
import { PostItem } from "@/components/dashboard/post-item"
12-
import { EmptyPlaceholder } from "@/components/dashboard/empty-placeholder"
8+
import { cn } from "@/lib/utils"
9+
import { EmptyPlaceholder } from "@/components/empty-placeholder"
10+
import { DashboardHeader } from "@/components/header"
11+
import { PostCreateButton } from "@/components/post-create-button"
12+
import { PostItem } from "@/components/post-item"
13+
import { DashboardShell } from "@/components/shell"
14+
import { buttonVariants } from "@/components/ui/button"
15+
16+
export const metadata = {
17+
title: "Dashboard",
18+
}
1319

1420
const getPostsForUser = cache(async (userId: User["id"]) => {
1521
return await db.post.findMany({
@@ -32,7 +38,7 @@ export default async function DashboardPage() {
3238
const user = await getCurrentUser()
3339

3440
if (!user) {
35-
redirect(authOptions.pages.signIn)
41+
redirect(authOptions?.pages?.signIn || "/login")
3642
}
3743

3844
const posts = await getPostsForUser(user.id)
@@ -56,7 +62,12 @@ export default async function DashboardPage() {
5662
<EmptyPlaceholder.Description>
5763
You don&apos;t have any posts yet. Start creating content.
5864
</EmptyPlaceholder.Description>
59-
<PostCreateButton className="border-slate-200 bg-white text-brand-900 hover:bg-slate-100 focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2" />
65+
<PostCreateButton
66+
className={cn(
67+
buttonVariants({ variant: "outline" }),
68+
"text-slate-900"
69+
)}
70+
/>
6071
</EmptyPlaceholder>
6172
)}
6273
</div>

app/(dashboard)/dashboard/settings/loading.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { DashboardHeader } from "@/components/dashboard/header"
2-
import { DashboardShell } from "@/components/dashboard/shell"
3-
import { Card } from "@/ui/card"
1+
import { DashboardHeader } from "@/components/header"
2+
import { DashboardShell } from "@/components/shell"
3+
import { Card } from "@/components/ui/card"
44

55
export default function DashboardSettingsLoading() {
66
return (

app/(dashboard)/dashboard/settings/page.tsx

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
import { redirect } from "next/navigation"
22

3-
import { getCurrentUser } from "@/lib/session"
43
import { authOptions } from "@/lib/auth"
5-
import { DashboardHeader } from "@/components/dashboard/header"
6-
import { DashboardShell } from "@/components/dashboard/shell"
7-
import { UserNameForm } from "@/components/dashboard/user-name-form"
4+
import { getCurrentUser } from "@/lib/session"
5+
import { DashboardHeader } from "@/components/header"
6+
import { DashboardShell } from "@/components/shell"
7+
import { UserNameForm } from "@/components/user-name-form"
8+
9+
export const metadata = {
10+
title: "Settings",
11+
description: "Manage account and website settings.",
12+
}
813

914
export default async function SettingsPage() {
1015
const user = await getCurrentUser()
1116

1217
if (!user) {
13-
redirect(authOptions.pages.signIn)
18+
redirect(authOptions?.pages?.signIn || "/login")
1419
}
1520

1621
return (
@@ -20,7 +25,9 @@ export default async function SettingsPage() {
2025
text="Manage account and website settings."
2126
/>
2227
<div className="grid gap-10">
23-
<UserNameForm user={{ id: user.id, name: user.name }} />
28+
{user?.name ? (
29+
<UserNameForm user={{ id: user.id, name: user.name }} />
30+
) : null}
2431
</div>
2532
</DashboardShell>
2633
)

app/(docs)/docs/[[...slug]]/head.tsx

-14
This file was deleted.

0 commit comments

Comments
 (0)