feat(ui): implement full UI layer for all modules
Add interactive island components and server partials for notes, students, and admin modules, following the Figma prototype design. - static/styles/ui.css: shared component library (buttons, tables, chips, cards, filters, tabs, form inputs) - notes: NotesView (student grade view with UE cards, promo tabs, weighted averages), AdminConsultNotes, AdminUEs islands + partials - students: ConsultStudents (list/filter/delete), AdminPromotions (CRUD) islands + partials - admin: AdminModules, AdminUsers, AdminRoles islands + partials - All partials use State type with unknown cast for session access Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,13 +1,36 @@
|
||||
import { FreshContext } from "$fresh/server.ts";
|
||||
import { db } from "$root/databases/db.ts";
|
||||
import { students } from "$root/databases/schema.ts";
|
||||
import { and, eq } from "npm:drizzle-orm@0.45.2";
|
||||
import {
|
||||
getPartialsConfig,
|
||||
makePartials,
|
||||
} from "$root/defaults/makePartials.tsx";
|
||||
import { FreshContext } from "$fresh/server.ts";
|
||||
import { State } from "$root/routes/_middleware.ts";
|
||||
import { State } from "$root/defaults/interfaces.ts";
|
||||
import NotesView from "../(_islands)/NotesView.tsx";
|
||||
|
||||
// deno-lint-ignore require-await
|
||||
async function Notes(_request: Request, context: FreshContext<State>) {
|
||||
return <h2>Welcome to {context.state.session?.displayName}.</h2>;
|
||||
async function Notes(
|
||||
_request: Request,
|
||||
context: FreshContext<State>,
|
||||
) {
|
||||
const session =
|
||||
(context.state as unknown as { session: { sn: string; givenName: string } })
|
||||
.session;
|
||||
const { sn, givenName } = session;
|
||||
|
||||
let numEtud: number | null = null;
|
||||
try {
|
||||
const student = await db
|
||||
.select()
|
||||
.from(students)
|
||||
.where(and(eq(students.nom, sn), eq(students.prenom, givenName)))
|
||||
.then((rows) => rows[0] ?? null);
|
||||
numEtud = student?.numEtud ?? null;
|
||||
} catch {
|
||||
// DB lookup failed — island will show fallback message
|
||||
}
|
||||
|
||||
return <NotesView numEtud={numEtud} prenom={session.givenName} />;
|
||||
}
|
||||
|
||||
export const config = getPartialsConfig();
|
||||
|
||||
Reference in New Issue
Block a user