spb/autoscholar
Public
1import { listProjects } from "@autoscholar/core";2import Link from "next/link";3import { disciplineLabel, fmtDateTime } from "@/lib/format";4import { db } from "@/lib/server/db";56export const dynamic = "force-dynamic";78export default async function ProjectsPage() {9 const rows = await listProjects(db());10 return (11 <div className="space-y-6">12 <header className="flex items-end justify-between">13 <div>14 <p className="eyebrow">Research</p>15 <h1 className="title-2 mt-1">Projects</h1>16 </div>17 <Link href="/admin/new" className="btn btn-primary">18 New research19 </Link>20 </header>21 <table className="table">22 <thead>23 <tr>24 <th>Title</th>25 <th>Discipline</th>26 <th>Instruction versions</th>27 <th>Runs</th>28 <th>Updated</th>29 </tr>30 </thead>31 <tbody>32 {rows.length === 0 && (33 <tr>34 <td colSpan={5} className="muted py-8 text-center">35 No projects yet.36 </td>37 </tr>38 )}39 {rows.map((r) => (40 <tr key={r.project.id}>41 <td>42 <Link href={`/admin/projects/${r.project.id}`}>{r.project.title}</Link>43 </td>44 <td>{disciplineLabel(r.project.discipline)}</td>45 <td>{r.versions}</td>46 <td>{r.runs}</td>47 <td className="subtle text-xs">{fmtDateTime(r.project.updatedAt)}</td>48 </tr>49 ))}50 </tbody>51 </table>52 </div>53 );54}55