Skip to content

Commit 8a6bd7b

Browse files
committed
feat: about page
1 parent 9e51913 commit 8a6bd7b

5 files changed

Lines changed: 664 additions & 550 deletions

File tree

app/(protected)/admin/dashboard/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ export const metadata: Metadata = {
4040
title: `Dashboard · ${SITE_NAME}`,
4141
}
4242

43+
export const dynamic = 'force-dynamic'
44+
4345
export default async function DashboardPage({
4446
searchParams,
4547
}: {

app/(protected)/admin/page.tsx

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,19 @@ import { IsLoggedIn } from '@/lib/firebase/firebase'
1818
import { logoutAction } from '@/lib/actions/logout'
1919
import { ModeToggle } from '@/components/button-toggle-theme'
2020
import { redirect, RedirectType } from 'next/navigation'
21+
import type { Route } from 'next'
2122
import { addDays, format, subMonths } from 'date-fns'
23+
type MenuItem = {
24+
title: string
25+
icon: typeof Library
26+
href: Route
27+
}
2228

23-
const now = new Date()
24-
const to = format(addDays(now, 1), 'dd-MM-yyyy')
25-
const from = format(subMonths(now, 1), 'dd-MM-yyyy')
26-
27-
const menuItems = [
29+
const baseMenuItems: MenuItem[] = [
2830
{
2931
title: 'Dashboard',
3032
icon: ChartSpline,
31-
href: `/admin/dashboard?from=${from}&to=${to}`,
33+
href: '/admin/dashboard',
3234
},
3335
{ title: 'Libraries', icon: Library, href: '/admin/libraries' },
3436
{ title: 'Notifications', icon: BellIcon, href: '/notifications' },
@@ -49,7 +51,9 @@ const menuItems = [
4951
{ title: 'Collections', icon: BookCopy, href: '/admin/collections' },
5052
{ title: 'Reviews', icon: MessageSquare, href: '/admin/reviews' },
5153
{ title: 'Jobs', icon: Workflow, href: '/admin/jobs' },
52-
] as const
54+
]
55+
56+
export const dynamic = 'force-dynamic'
5357

5458
export default async function LibraryDashboard() {
5559
const claim = await IsLoggedIn()
@@ -68,6 +72,18 @@ export default async function LibraryDashboard() {
6872
redirect(`/`, RedirectType.replace)
6973
}
7074

75+
const now = new Date()
76+
const to = format(addDays(now, 1), 'dd-MM-yyyy')
77+
const from = format(subMonths(now, 1), 'dd-MM-yyyy')
78+
const menuItems = baseMenuItems.map((item) =>
79+
item.title === 'Dashboard'
80+
? {
81+
...item,
82+
href: `/admin/dashboard?from=${from}&to=${to}` as Route,
83+
}
84+
: item
85+
)
86+
7187
return (
7288
<main className="min-h-[calc(100vh-4rem)] p-8">
7389
<div className="max-w-2xl mx-auto space-y-4">

app/about/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { ArrowLeft } from 'lucide-react'
22
import { Button } from '@/components/ui/button'
33
import Link from 'next/link'
4+
import type { Metadata } from 'next'
5+
6+
export const metadata: Metadata = {
7+
title: 'About',
8+
}
49

510
export default function AboutPage() {
611
return (

components/landing.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ export default function LandingPage() {
102102
>
103103
Explore Books
104104
</Link>
105+
<Link
106+
href="/about"
107+
className="hover:text-foreground transition-colors"
108+
>
109+
About
110+
</Link>
105111
<Link
106112
href="/login"
107113
className="hover:text-foreground transition-colors"
@@ -295,6 +301,12 @@ export default function LandingPage() {
295301
>
296302
Explore Books
297303
</Link>
304+
<Link
305+
href="/about"
306+
className="hover:text-foreground transition-colors"
307+
>
308+
About
309+
</Link>
298310
<Link
299311
href="/terms"
300312
className="hover:text-foreground transition-colors"

0 commit comments

Comments
 (0)