Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/(main)/(auth)/applications/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Metadata } from 'next';
import { notFound } from 'next/navigation';

import { getApplicationForReview } from '@/prisma/data/applications';
Expand All @@ -21,6 +22,16 @@ interface ApplicationDetailPageProps {
params: Promise<{ id: string }>;
}

export async function generateMetadata({
params,
}: ApplicationDetailPageProps): Promise<Metadata> {
const { id } = await params;
const user = await getCurrentUser();
const application = await getApplicationForReview(id, user);
if (!application) return {};
return { title: application.user.name ?? application.user.email };
}

export default async function ApplicationDetailPage({
params,
}: ApplicationDetailPageProps) {
Expand Down
3 changes: 3 additions & 0 deletions app/(main)/(auth)/applications/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Metadata } from 'next';
import { redirect } from 'next/navigation';

import {
Expand All @@ -20,6 +21,8 @@ import type {
import { ApplicationsTable } from '@/components/features/applications-table';
import { ApplicationsToolbar } from '@/components/features/applications-toolbar';

export const metadata: Metadata = { title: 'Applications' };

interface ApplicationsPageProps {
searchParams: Promise<Record<string, string | string[] | undefined>>;
}
Expand Down
3 changes: 3 additions & 0 deletions app/(main)/(auth)/global-questions/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Metadata } from 'next';
import { redirect } from 'next/navigation';

import { getGlobalQuestions } from '@/prisma/data/global-questions';
Expand All @@ -9,6 +10,8 @@ import { GlobalQuestionsTable } from '@/components/features/global-questions-tab
import { PageHeader } from '@/components/layouts/page-header';
import { Button } from '@/components/ui/button';

export const metadata: Metadata = { title: 'Global Questions' };

export default async function GlobalQuestionsPage() {
const user = await getCurrentUser();
if (!user.isAdmin) redirect('/');
Expand Down
4 changes: 4 additions & 0 deletions app/(main)/(auth)/my-applications/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import type { Metadata } from 'next';

import { getMyApplications } from '@/prisma/data/applications';

import { getCurrentUser } from '@/lib/auth/server';

import { MyApplicationsTable } from '@/components/features/my-applications-table';
import { PageHeader } from '@/components/layouts/page-header';

export const metadata: Metadata = { title: 'My Applications' };

export default async function MyApplicationsPage() {
const user = await getCurrentUser();
const applications = await getMyApplications(user.id);
Expand Down
18 changes: 14 additions & 4 deletions app/(main)/(auth)/positions/[id]/apply/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Metadata } from 'next';
import Link from 'next/link';
import { redirect } from 'next/navigation';

Expand All @@ -13,11 +14,20 @@ import { PageHeader } from '@/components/layouts/page-header';
import { Button } from '@/components/ui/button';
import { Card, CardContent } from '@/components/ui/card';

export default async function ApplyPage({
params,
}: {
interface ApplyPageProps {
params: Promise<{ id: string }>;
}) {
}

export async function generateMetadata({
params,
}: ApplyPageProps): Promise<Metadata> {
const { id } = await params;
const position = await getPositionForApply(id);
if (!position) return {};
return { title: `Apply: ${position.title}` };
}

export default async function ApplyPage({ params }: ApplyPageProps) {
const { id } = await params;
const user = await getCurrentUser();
if (!user) redirect('/sign-in');
Expand Down
10 changes: 10 additions & 0 deletions app/(main)/(auth)/positions/[id]/edit/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Metadata } from 'next';
import { redirect } from 'next/navigation';

import { getPositionForEdit } from '@/prisma/data/positions';
Expand All @@ -14,6 +15,15 @@ interface EditPositionPageProps {
params: Promise<{ id: string }>;
}

export async function generateMetadata({
params,
}: EditPositionPageProps): Promise<Metadata> {
const { id } = await params;
const position = await getPositionForEdit(id);
if (!position) return {};
return { title: `Edit: ${position.title}` };
}

export default async function EditPositionPage({
params,
}: EditPositionPageProps) {
Expand Down
3 changes: 3 additions & 0 deletions app/(main)/(auth)/users/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Metadata } from 'next';
import { redirect } from 'next/navigation';

import { getUsersForAdmin } from '@/prisma/data/users';
Expand All @@ -7,6 +8,8 @@ import { getCurrentUser } from '@/lib/auth/server';
import { UsersTable } from '@/components/features/users-table';
import { PageHeader } from '@/components/layouts/page-header';

export const metadata: Metadata = { title: 'Users' };

export default async function UsersPage() {
const user = await getCurrentUser();
if (!user.isAdmin) redirect('/');
Expand Down
4 changes: 4 additions & 0 deletions app/(main)/positions/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { Metadata } from 'next';

import { Briefcase } from 'lucide-react';

import { getPositionApplicationStats } from '@/prisma/data/applications';
Expand All @@ -15,6 +17,8 @@ import { PositionCard } from '@/components/features/position-card';
import { PositionCreateDialog } from '@/components/features/position-create-dialog';
import { EmptyState } from '@/components/ui/empty-state';

export const metadata: Metadata = { title: 'Positions' };

export default async function PositionsPage() {
const user = await getOptionalUser();
const isAdmin = user?.isAdmin ?? false;
Expand Down
4 changes: 4 additions & 0 deletions app/(main)/profile/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import type { Metadata } from 'next';

import { getProfileData } from '@/prisma/data/profile';

import { getCurrentUser } from '@/lib/auth/server';

import { ProfileForm } from '@/components/features/profile-form';
import { PageHeader } from '@/components/layouts/page-header';

export const metadata: Metadata = { title: 'Profile' };

export default async function ProfilePage() {
const user = await getCurrentUser();
const profileData = await getProfileData(user.id);
Expand Down
2 changes: 1 addition & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import './globals.css';
const inter = Inter({ variable: '--font-sans', subsets: ['latin'] });

export const metadata: Metadata = {
title: { default: 'Aplio', template: 'Aplio - %s' },
title: { default: 'Aplio', template: 'Aplio %s' },
description: 'A student government application management system.',
icons: [
// Light-mode favicon: white/light background logo
Expand Down
3 changes: 3 additions & 0 deletions app/login/bypass/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import type { Metadata } from 'next';
import Link from 'next/link';

import { loginAsBypassUser } from '@/prisma/services/dev-bypass';

import { Button } from '@/components/ui/button';

export const metadata: Metadata = { title: 'Dev Login' };

export default function BypassLoginPage() {
return (
<div className="flex min-h-screen items-center justify-center">
Expand Down
3 changes: 3 additions & 0 deletions app/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Metadata } from 'next';
import Link from 'next/link';
import { redirect } from 'next/navigation';

Expand All @@ -6,6 +7,8 @@ import { AuthView } from '@neondatabase/auth/react/ui';
import { getOptionalUser } from '@/lib/auth/server';
import { PRIVACY_HREF, TERMS_HREF } from '@/lib/constants';

export const metadata: Metadata = { title: 'Sign In' };

// Constrain redirectTo to a same-origin relative path — accept only values
// starting with a single "/" and not "//" to prevent open-redirect attacks.
function safeRedirectTo(value: string | undefined): string {
Expand Down
Loading