Files
glenloch-media/src/app/(app)/training/page.tsx
T
2026-11-20 04:07:02 +00:00

102 lines
4.4 KiB
TypeScript

import Link from "next/link";
import { auth } from "@/auth/config";
import { hasPermission } from "@/auth/permissions";
import type { SystemRole } from "@/auth/roles";
import { listLessons } from "@/db/training";
import { TrainingPanel } from "@/components/app/training-panel";
import { BookOpenCheck, Download, ShieldCheck, UserRound } from "lucide-react";
export const metadata = { title: "Training" };
/**
* Training content. Volunteers see published lessons and attachments; admins
* can author, publish, upload, and delete. Content is stored in Postgres and
* attachments under the uploads volume, so it is editable with no deploy.
*/
export default async function TrainingPage() {
const session = await auth();
const role = (session?.user as { systemRole?: SystemRole } | undefined)?.systemRole;
const canEdit = hasPermission(role, "training.author");
const lessons = await listLessons({ includeUnpublished: canEdit });
return (
<div className="space-y-4">
<div>
<h1 className="text-lg font-semibold tracking-tight">Training</h1>
<p className="text-sm text-muted-foreground">
How-tos and checklists for serving on the media team.
</p>
</div>
<section aria-labelledby="full-guides" className="space-y-3">
<div>
<h2 id="full-guides" className="text-base font-semibold tracking-tight">
Full guides
</h2>
<p className="text-sm text-muted-foreground">
Complete, illustrated walkthroughs with screenshots. Read them here
or download the PDF for printing and offline use.
</p>
</div>
<div className="grid gap-3 md:grid-cols-2">
<div className="flex flex-col rounded-md border border-border p-4">
<div className="flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground">
<ShieldCheck className="h-4 w-4" aria-hidden="true" />
Admins
</div>
<h3 className="mt-2 text-base font-semibold">
Platform administration guide
</h3>
<p className="mt-1 flex-1 text-sm leading-6 text-muted-foreground">
People and access, skill verification, positions, services and
publishing, coverage, run sheets, email, notifications, backups,
and exports.
</p>
<div className="mt-3 flex flex-wrap items-center gap-4 text-sm font-medium">
<Link href="/training/guides/admin" className="text-primary underline">
<BookOpenCheck className="mr-1 inline h-4 w-4" aria-hidden="true" />
Read the guide
</Link>
<a
href="/training/media-team-admin-guide.pdf"
download
className="inline-flex items-center gap-1 text-primary underline"
>
<Download className="h-4 w-4" aria-hidden="true" />
Download PDF
</a>
</div>
</div>
<div className="flex flex-col rounded-md border border-border p-4">
<div className="flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground">
<UserRound className="h-4 w-4" aria-hidden="true" />
Volunteers &amp; trainees
</div>
<h3 className="mt-2 text-base font-semibold">Volunteer guide</h3>
<p className="mt-1 flex-1 text-sm leading-6 text-muted-foreground">
Signing in, your next serve, the schedule, availability, swaps,
run sheets, events and media, training, profile, and reminders.
</p>
<div className="mt-3 flex flex-wrap items-center gap-4 text-sm font-medium">
<Link href="/training/guides/user" className="text-primary underline">
<BookOpenCheck className="mr-1 inline h-4 w-4" aria-hidden="true" />
Read the guide
</Link>
<a
href="/training/media-team-user-guide.pdf"
download
className="inline-flex items-center gap-1 text-primary underline"
>
<Download className="h-4 w-4" aria-hidden="true" />
Download PDF
</a>
</div>
</div>
</div>
</section>
<TrainingPanel lessons={lessons} canEdit={canEdit} />
</div>
);
}