File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import type { Metadata } from 'next' ;
12import { notFound } from 'next/navigation' ;
23
34import { getApplicationForReview } from '@/prisma/data/applications' ;
@@ -21,6 +22,16 @@ interface ApplicationDetailPageProps {
2122 params : Promise < { id : string } > ;
2223}
2324
25+ export async function generateMetadata ( {
26+ params,
27+ } : ApplicationDetailPageProps ) : Promise < Metadata > {
28+ const { id } = await params ;
29+ const user = await getCurrentUser ( ) ;
30+ const application = await getApplicationForReview ( id , user ) ;
31+ if ( ! application ) return { } ;
32+ return { title : application . user . name ?? application . user . email } ;
33+ }
34+
2435export default async function ApplicationDetailPage ( {
2536 params,
2637} : ApplicationDetailPageProps ) {
Original file line number Diff line number Diff line change 1+ import type { Metadata } from 'next' ;
12import { redirect } from 'next/navigation' ;
23
34import {
@@ -20,6 +21,8 @@ import type {
2021import { ApplicationsTable } from '@/components/features/applications-table' ;
2122import { ApplicationsToolbar } from '@/components/features/applications-toolbar' ;
2223
24+ export const metadata : Metadata = { title : 'Applications' } ;
25+
2326interface ApplicationsPageProps {
2427 searchParams : Promise < Record < string , string | string [ ] | undefined > > ;
2528}
Original file line number Diff line number Diff line change 1+ import type { Metadata } from 'next' ;
12import { redirect } from 'next/navigation' ;
23
34import { getGlobalQuestions } from '@/prisma/data/global-questions' ;
@@ -9,6 +10,8 @@ import { GlobalQuestionsTable } from '@/components/features/global-questions-tab
910import { PageHeader } from '@/components/layouts/page-header' ;
1011import { Button } from '@/components/ui/button' ;
1112
13+ export const metadata : Metadata = { title : 'Global Questions' } ;
14+
1215export default async function GlobalQuestionsPage ( ) {
1316 const user = await getCurrentUser ( ) ;
1417 if ( ! user . isAdmin ) redirect ( '/' ) ;
Original file line number Diff line number Diff line change 1+ import type { Metadata } from 'next' ;
2+
13import { getMyApplications } from '@/prisma/data/applications' ;
24
35import { getCurrentUser } from '@/lib/auth/server' ;
46
57import { MyApplicationsTable } from '@/components/features/my-applications-table' ;
68import { PageHeader } from '@/components/layouts/page-header' ;
79
10+ export const metadata : Metadata = { title : 'My Applications' } ;
11+
812export default async function MyApplicationsPage ( ) {
913 const user = await getCurrentUser ( ) ;
1014 const applications = await getMyApplications ( user . id ) ;
Original file line number Diff line number Diff line change 1+ import type { Metadata } from 'next' ;
12import Link from 'next/link' ;
23import { redirect } from 'next/navigation' ;
34
@@ -13,11 +14,20 @@ import { PageHeader } from '@/components/layouts/page-header';
1314import { Button } from '@/components/ui/button' ;
1415import { Card , CardContent } from '@/components/ui/card' ;
1516
16- export default async function ApplyPage ( {
17- params,
18- } : {
17+ interface ApplyPageProps {
1918 params : Promise < { id : string } > ;
20- } ) {
19+ }
20+
21+ export async function generateMetadata ( {
22+ params,
23+ } : ApplyPageProps ) : Promise < Metadata > {
24+ const { id } = await params ;
25+ const position = await getPositionForApply ( id ) ;
26+ if ( ! position ) return { } ;
27+ return { title : `Apply: ${ position . title } ` } ;
28+ }
29+
30+ export default async function ApplyPage ( { params } : ApplyPageProps ) {
2131 const { id } = await params ;
2232 const user = await getCurrentUser ( ) ;
2333 if ( ! user ) redirect ( '/sign-in' ) ;
Original file line number Diff line number Diff line change 1+ import type { Metadata } from 'next' ;
12import { redirect } from 'next/navigation' ;
23
34import { getPositionForEdit } from '@/prisma/data/positions' ;
@@ -14,6 +15,15 @@ interface EditPositionPageProps {
1415 params : Promise < { id : string } > ;
1516}
1617
18+ export async function generateMetadata ( {
19+ params,
20+ } : EditPositionPageProps ) : Promise < Metadata > {
21+ const { id } = await params ;
22+ const position = await getPositionForEdit ( id ) ;
23+ if ( ! position ) return { } ;
24+ return { title : `Edit: ${ position . title } ` } ;
25+ }
26+
1727export default async function EditPositionPage ( {
1828 params,
1929} : EditPositionPageProps ) {
Original file line number Diff line number Diff line change 1+ import type { Metadata } from 'next' ;
12import { redirect } from 'next/navigation' ;
23
34import { getUsersForAdmin } from '@/prisma/data/users' ;
@@ -7,6 +8,8 @@ import { getCurrentUser } from '@/lib/auth/server';
78import { UsersTable } from '@/components/features/users-table' ;
89import { PageHeader } from '@/components/layouts/page-header' ;
910
11+ export const metadata : Metadata = { title : 'Users' } ;
12+
1013export default async function UsersPage ( ) {
1114 const user = await getCurrentUser ( ) ;
1215 if ( ! user . isAdmin ) redirect ( '/' ) ;
Original file line number Diff line number Diff line change 1+ import type { Metadata } from 'next' ;
2+
13import { Briefcase } from 'lucide-react' ;
24
35import { getPositionApplicationStats } from '@/prisma/data/applications' ;
@@ -15,6 +17,8 @@ import { PositionCard } from '@/components/features/position-card';
1517import { PositionCreateDialog } from '@/components/features/position-create-dialog' ;
1618import { EmptyState } from '@/components/ui/empty-state' ;
1719
20+ export const metadata : Metadata = { title : 'Positions' } ;
21+
1822export default async function PositionsPage ( ) {
1923 const user = await getOptionalUser ( ) ;
2024 const isAdmin = user ?. isAdmin ?? false ;
Original file line number Diff line number Diff line change 1+ import type { Metadata } from 'next' ;
2+
13import { getProfileData } from '@/prisma/data/profile' ;
24
35import { getCurrentUser } from '@/lib/auth/server' ;
46
57import { ProfileForm } from '@/components/features/profile-form' ;
68import { PageHeader } from '@/components/layouts/page-header' ;
79
10+ export const metadata : Metadata = { title : 'Profile' } ;
11+
812export default async function ProfilePage ( ) {
913 const user = await getCurrentUser ( ) ;
1014 const profileData = await getProfileData ( user . id ) ;
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import './globals.css';
1111const inter = Inter ( { variable : '--font-sans' , subsets : [ 'latin' ] } ) ;
1212
1313export const metadata : Metadata = {
14- title : { default : 'Aplio' , template : 'Aplio - %s' } ,
14+ title : { default : 'Aplio' , template : 'Aplio • %s' } ,
1515 description : 'A student government application management system.' ,
1616 icons : [
1717 // Light-mode favicon: white/light background logo
You can’t perform that action at this time.
0 commit comments