All checks were successful
Deploy eCourt Note Web to Server / Validate Database Schema (Drizzle) (push) Successful in 3s
Deploy eCourt Note Web to Server / Build Web Docker Image (push) Successful in 47s
Deploy eCourt Note Web to Server / Deploy eCourt Note Web to Server (push) Successful in 3s
Deploy eCourt Note Web to Server / Notify Deployment Status (push) Successful in 1s
- utils/user.ts: MOCK_USERS (userId คงที่) + setLocalUser/getStoredLocalUser เขียนลง localStorage key เดิม — PDFViewer อ่าน getLocalUser() เหมือนเดิม - components/UserPicker.tsx: dropdown เลือกผู้ใช้ก่อนเข้า annotate (ยังไม่มี identity = default คนแรก, identity สุ่มเดิมแสดงเป็น option ชั่วคราว) - components/Select.tsx: select ถอดลูกศร native (ชิดขอบ) ใส่ ChevronDown เอง ใช้ที่ UserPicker + ตัวกรองรายคน + เลือกหัวข้อ bookmark 2 จุด - app/page.tsx: header monogram, การ์ดไฟล์ hover, empty state ใหม่ Co-Authored-By: Claude Code <noreply@anthropic.com>
79 lines
2.9 KiB
TypeScript
79 lines
2.9 KiB
TypeScript
import Link from "next/link";
|
|
import { asc } from "drizzle-orm";
|
|
import { FileText } from "lucide-react";
|
|
|
|
import { db } from "@/db";
|
|
import { files } from "@/db/schema";
|
|
import UserPicker from "@/components/UserPicker";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export default async function HomePage() {
|
|
const rows = await db.select().from(files).orderBy(asc(files.createdAt));
|
|
|
|
return (
|
|
<main className="mx-auto max-w-2xl px-4 py-10 sm:px-8">
|
|
<header className="flex items-center gap-3">
|
|
<div className="flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-primary text-base font-bold text-white shadow-sm">
|
|
JN
|
|
</div>
|
|
<div>
|
|
<h1 className="text-2xl font-bold leading-tight text-primary">
|
|
Jude's Note
|
|
</h1>
|
|
<p className="text-sm text-slate-500">
|
|
ระบบ PDF Annotation สำหรับ e-Court
|
|
</p>
|
|
</div>
|
|
</header>
|
|
|
|
<UserPicker />
|
|
|
|
<div className="mt-8 flex items-baseline justify-between">
|
|
<h2 className="text-sm font-semibold text-slate-700">เอกสาร</h2>
|
|
{rows.length > 0 && (
|
|
<span className="text-xs text-slate-400">{rows.length} ไฟล์</span>
|
|
)}
|
|
</div>
|
|
|
|
{rows.length === 0 ? (
|
|
<div className="mt-3 rounded-xl border border-dashed border-slate-300 bg-white/60 p-10 text-center">
|
|
<FileText className="mx-auto h-8 w-8 text-slate-300" />
|
|
<p className="mt-3 text-sm font-medium text-slate-500">
|
|
ยังไม่มีไฟล์ในระบบ
|
|
</p>
|
|
<p className="mt-1 text-xs text-slate-400">
|
|
รัน /sync-db เพื่อ seed ไฟล์ตัวอย่าง
|
|
</p>
|
|
</div>
|
|
) : (
|
|
<ul className="mt-3 space-y-3">
|
|
{rows.map((f) => (
|
|
<li
|
|
key={f.id}
|
|
className="group flex items-center gap-3 rounded-xl border border-slate-200 bg-white p-4 shadow-sm transition hover:border-primary/30 hover:shadow-md"
|
|
>
|
|
<div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10">
|
|
<FileText className="h-5 w-5 text-primary" />
|
|
</div>
|
|
<span className="min-w-0 flex-1">
|
|
<span className="block break-all line-clamp-2 text-sm font-medium text-slate-900">
|
|
{f.title}
|
|
</span>
|
|
<span className="mt-0.5 block text-xs text-slate-400">
|
|
{new Date(f.createdAt).toLocaleString("th-TH")}
|
|
</span>
|
|
</span>
|
|
<Link
|
|
href={`/annotate/${f.id}`}
|
|
className="shrink-0 rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-white transition hover:opacity-90"
|
|
>
|
|
Annotate
|
|
</Link>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
)}
|
|
</main>
|
|
);
|
|
}
|