✨ enhance event and attendance components with improved UI elements and layout adjustments
Browse files at this commitcd4377a89fb3d7285f6797319eaba6672513a297Parent: c3ded6f- feat
- ✨ enhance event and attendance components with improved UI elements and layout adjustments
5 changed files +71 -50
- src/components/events/attendance-table.tsx +5 -5
- src/components/events/event-card.tsx +9 -10
- src/components/layout/side-nav.tsx +1 -1
- src/pages/event-detail-page.tsx +27 -18
- src/pages/events-page.tsx +29 -16
src/components/events/attendance-table.tsxmodified+5 -5
| @@ -34,8 +34,8 @@ export function AttendanceTable(props: { | |||
| 34 | </p> | 34 | </p> |
| 35 | } | 35 | } |
| 36 | > | 36 | > |
| 37 | - <div class="overflow-hidden rounded-lg border border-border/70 bg-background/60"> | 37 | + <div class="data-table-wrap"> |
| 38 | - <Table> | 38 | + <Table class="data-table"> |
| 39 | <TableHeader> | 39 | <TableHeader> |
| 40 | <TableRow> | 40 | <TableRow> |
| 41 | <TableHead>{t("events.userId")}</TableHead> | 41 | <TableHead>{t("events.userId")}</TableHead> |
| @@ -49,10 +49,10 @@ export function AttendanceTable(props: { | |||
| 49 | <TableBody> | 49 | <TableBody> |
| 50 | <For each={props.rows}> | 50 | <For each={props.rows}> |
| 51 | {(row) => ( | 51 | {(row) => ( |
| 52 | - <TableRow class="h-12"> | 52 | + <TableRow> |
| 53 | <TableCell class="font-medium">{personLabel(row.user)}</TableCell> | 53 | <TableCell class="font-medium">{personLabel(row.user)}</TableCell> |
| 54 | <TableCell> | 54 | <TableCell> |
| 55 | - <Badge variant="secondary" class="capitalize"> | 55 | + <Badge variant="secondary" class="rounded-sm capitalize"> |
| 56 | {row.status} | 56 | {row.status} |
| 57 | </Badge> | 57 | </Badge> |
| 58 | </TableCell> | 58 | </TableCell> |
| @@ -63,7 +63,7 @@ export function AttendanceTable(props: { | |||
| 63 | type="button" | 63 | type="button" |
| 64 | variant="ghost" | 64 | variant="ghost" |
| 65 | size="sm" | 65 | size="sm" |
| 66 | - class="text-destructive hover:bg-destructive/10 hover:text-destructive" | 66 | + class="h-7 rounded-sm text-destructive hover:bg-destructive/10 hover:text-destructive" |
| 67 | onClick={() => setTargetUser(personId(row.user))} | 67 | onClick={() => setTargetUser(personId(row.user))} |
| 68 | > | 68 | > |
| 69 | <IconTrash class="h-4 w-4" /> | 69 | <IconTrash class="h-4 w-4" /> |
src/components/events/event-card.tsxmodified+9 -10
| @@ -8,25 +8,24 @@ export function EventCard(props: { event: Event }) { | |||
| 8 | const { locale } = usePreferences(); | 8 | const { locale } = usePreferences(); |
| 9 | return ( | 9 | return ( |
| 10 | <Link to="/events/$id" params={{ id: props.event.id }} class="group block h-full"> | 10 | <Link to="/events/$id" params={{ id: props.event.id }} class="group block h-full"> |
| 11 | - <article class="surface-card relative flex h-full min-h-48 flex-col overflow-hidden transition-all group-hover:-translate-y-0.5 group-hover:border-sky-500/30 group-hover:shadow-sm"> | 11 | + <article class="data-shell flex h-full min-h-40 flex-col overflow-hidden transition-colors group-hover:border-primary/35"> |
| 12 | - <div class="absolute inset-x-0 top-0 h-1 bg-gradient-to-r from-sky-500/70 via-cyan-400/50 to-transparent" /> | 12 | + <div class="flex flex-1 flex-col p-3"> |
| 13 | - <div class="flex flex-1 flex-col p-4"> | 13 | + <h3 class="line-clamp-2 font-display text-base font-semibold leading-snug group-hover:text-primary"> |
| 14 | - <h3 class="line-clamp-2 font-display text-lg font-semibold leading-snug group-hover:text-primary"> | ||
| 15 | {props.event.title} | 14 | {props.event.title} |
| 16 | </h3> | 15 | </h3> |
| 17 | - <p class="mt-2 line-clamp-3 flex-1 text-sm leading-relaxed text-muted-foreground"> | 16 | + <p class="mt-2 line-clamp-3 flex-1 text-[13px] leading-relaxed text-muted-foreground"> |
| 18 | {props.event.description || "—"} | 17 | {props.event.description || "—"} |
| 19 | </p> | 18 | </p> |
| 20 | </div> | 19 | </div> |
| 21 | - <div class="border-t border-border/60 bg-muted/20 px-4 py-3"> | 20 | + <div class="border-t border-border bg-muted/25 px-3 py-3"> |
| 22 | <dl class="grid gap-2 text-xs text-muted-foreground sm:grid-cols-2"> | 21 | <dl class="grid gap-2 text-xs text-muted-foreground sm:grid-cols-2"> |
| 23 | <div> | 22 | <div> |
| 24 | - <dt class="font-medium text-foreground">{t("events.starts")}</dt> | 23 | + <dt class="font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("events.starts")}</dt> |
| 25 | - <dd>{formatDateTime(props.event.starts_at, locale())}</dd> | 24 | + <dd class="mono mt-1 text-foreground">{formatDateTime(props.event.starts_at, locale())}</dd> |
| 26 | </div> | 25 | </div> |
| 27 | <div> | 26 | <div> |
| 28 | - <dt class="font-medium text-foreground">{t("events.ends")}</dt> | 27 | + <dt class="font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("events.ends")}</dt> |
| 29 | - <dd>{formatDateTime(props.event.ends_at, locale())}</dd> | 28 | + <dd class="mono mt-1 text-foreground">{formatDateTime(props.event.ends_at, locale())}</dd> |
| 30 | </div> | 29 | </div> |
| 31 | </dl> | 30 | </dl> |
| 32 | </div> | 31 | </div> |
src/components/layout/side-nav.tsxmodified+1 -1
| @@ -65,7 +65,6 @@ const NAV_GROUPS: NavGroup[] = [ | |||
| 65 | Icon: IconChart, | 65 | Icon: IconChart, |
| 66 | items: [ | 66 | items: [ |
| 67 | { to: "/marks", labelKey: "nav.marks", Icon: IconChart }, | 67 | { to: "/marks", labelKey: "nav.marks", Icon: IconChart }, |
| 68 | - { to: "/management/student-marks", labelKey: "nav.studentMarks", Icon: IconChart, minRole: "teacher" }, | ||
| 69 | ], | 68 | ], |
| 70 | }, | 69 | }, |
| 71 | { | 70 | { |
| @@ -74,6 +73,7 @@ const NAV_GROUPS: NavGroup[] = [ | |||
| 74 | Icon: IconNote, | 73 | Icon: IconNote, |
| 75 | minRole: "teacher", | 74 | minRole: "teacher", |
| 76 | items: [ | 75 | items: [ |
| 76 | + { to: "/management/student-marks", labelKey: "nav.studentMarks", Icon: IconChart, minRole: "teacher" }, | ||
| 77 | { to: "/management/student-attendance", labelKey: "nav.studentAttendance", Icon: IconCalendar, minRole: "teacher" }, | 77 | { to: "/management/student-attendance", labelKey: "nav.studentAttendance", Icon: IconCalendar, minRole: "teacher" }, |
| 78 | { to: "/work", labelKey: "nav.work", Icon: IconChart, minRole: "teacher" }, | 78 | { to: "/work", labelKey: "nav.work", Icon: IconChart, minRole: "teacher" }, |
| 79 | ], | 79 | ], |
src/pages/event-detail-page.tsxmodified+27 -18
| @@ -85,15 +85,23 @@ function EventDetailContent() { | |||
| 85 | > | 85 | > |
| 86 | {(ev) => ( | 86 | {(ev) => ( |
| 87 | <div class="space-y-6"> | 87 | <div class="space-y-6"> |
| 88 | - <PageHeader | 88 | + <div class="space-y-2"> |
| 89 | - accent="sky" | 89 | + <div class="flex flex-wrap items-center gap-1 text-xs text-muted-foreground"> |
| 90 | - eyebrow={t("events.title")} | 90 | + <span>{t("nav.group.classes")}</span> |
| 91 | - title={ev().title} | 91 | + <span>/</span> |
| 92 | - description={`${formatDateTime(ev().starts_at, locale())} → ${formatDateTime(ev().ends_at, locale())}`} | 92 | + <Link to="/events" class="hover:text-foreground">{t("events.title")}</Link> |
| 93 | - actions={ | 93 | + <span>/</span> |
| 94 | - <div class="flex w-full flex-wrap items-center gap-1 rounded-lg border bg-background/80 p-1 shadow-sm sm:w-auto"> | 94 | + <span class="truncate">{ev().title}</span> |
| 95 | + </div> | ||
| 96 | + <PageHeader | ||
| 97 | + accent="sky" | ||
| 98 | + eyebrow={t("events.title")} | ||
| 99 | + title={ev().title} | ||
| 100 | + description={`${formatDateTime(ev().starts_at, locale())} → ${formatDateTime(ev().ends_at, locale())}`} | ||
| 101 | + actions={ | ||
| 102 | + <div class="flex w-full flex-wrap items-center gap-1 rounded-lg border bg-card p-1 shadow-sm sm:w-auto"> | ||
| 95 | <Link to="/events"> | 103 | <Link to="/events"> |
| 96 | - <Button variant="ghost" size="sm" class="w-full rounded-md sm:w-auto"> | 104 | + <Button variant="ghost" size="sm" class="w-full rounded-sm sm:w-auto"> |
| 97 | <IconChevronLeft class="h-4 w-4" /> | 105 | <IconChevronLeft class="h-4 w-4" /> |
| 98 | {t("common.back")} | 106 | {t("common.back")} |
| 99 | </Button> | 107 | </Button> |
| @@ -104,7 +112,7 @@ function EventDetailContent() { | |||
| 104 | type="button" | 112 | type="button" |
| 105 | variant="outline" | 113 | variant="outline" |
| 106 | size="sm" | 114 | size="sm" |
| 107 | - class="flex-1 rounded-md sm:flex-none" | 115 | + class="flex-1 rounded-sm sm:flex-none" |
| 108 | onClick={() => setEditing(true)} | 116 | onClick={() => setEditing(true)} |
| 109 | > | 117 | > |
| 110 | <IconEdit class="h-4 w-4" /> | 118 | <IconEdit class="h-4 w-4" /> |
| @@ -114,7 +122,7 @@ function EventDetailContent() { | |||
| 114 | type="button" | 122 | type="button" |
| 115 | variant="destructive" | 123 | variant="destructive" |
| 116 | size="sm" | 124 | size="sm" |
| 117 | - class="flex-1 rounded-md sm:flex-none" | 125 | + class="flex-1 rounded-sm sm:flex-none" |
| 118 | disabled={pending()} | 126 | disabled={pending()} |
| 119 | onClick={() => setDeleteOpen(true)} | 127 | onClick={() => setDeleteOpen(true)} |
| 120 | > | 128 | > |
| @@ -124,12 +132,13 @@ function EventDetailContent() { | |||
| 124 | </div> | 132 | </div> |
| 125 | </Show> | 133 | </Show> |
| 126 | </div> | 134 | </div> |
| 127 | - } | 135 | + } |
| 128 | - > | 136 | + > |
| 129 | <p class="mt-3 max-w-2xl whitespace-pre-wrap text-sm text-muted-foreground"> | 137 | <p class="mt-3 max-w-2xl whitespace-pre-wrap text-sm text-muted-foreground"> |
| 130 | {ev().description || "—"} | 138 | {ev().description || "—"} |
| 131 | </p> | 139 | </p> |
| 132 | - </PageHeader> | 140 | + </PageHeader> |
| 141 | + </div> | ||
| 133 | 142 | ||
| 134 | <ConfirmDialog | 143 | <ConfirmDialog |
| 135 | open={deleteOpen()} | 144 | open={deleteOpen()} |
| @@ -170,7 +179,7 @@ function EventDetailContent() { | |||
| 170 | </FormDialog> | 179 | </FormDialog> |
| 171 | 180 | ||
| 172 | <div class="grid gap-4 lg:grid-cols-2"> | 181 | <div class="grid gap-4 lg:grid-cols-2"> |
| 173 | - <section class="surface-card p-5"> | 182 | + <section class="data-shell p-4"> |
| 174 | <div> | 183 | <div> |
| 175 | <h2 class="font-display text-lg font-semibold">{t("events.markSelf")}</h2> | 184 | <h2 class="font-display text-lg font-semibold">{t("events.markSelf")}</h2> |
| 176 | <p class="mt-1 text-sm text-muted-foreground">{t("events.status")}</p> | 185 | <p class="mt-1 text-sm text-muted-foreground">{t("events.status")}</p> |
| @@ -179,7 +188,7 @@ function EventDetailContent() { | |||
| 179 | <AttendanceStatusPicker value={status()} onChange={setStatus} label={t("events.status")} /> | 188 | <AttendanceStatusPicker value={status()} onChange={setStatus} label={t("events.status")} /> |
| 180 | <Button | 189 | <Button |
| 181 | type="button" | 190 | type="button" |
| 182 | - class="w-full rounded-md sm:w-auto" | 191 | + class="w-full rounded-sm sm:w-auto" |
| 183 | disabled={pending()} | 192 | disabled={pending()} |
| 184 | onClick={() => | 193 | onClick={() => |
| 185 | void wrap(async () => { | 194 | void wrap(async () => { |
| @@ -194,7 +203,7 @@ function EventDetailContent() { | |||
| 194 | </section> | 203 | </section> |
| 195 | 204 | ||
| 196 | <Show when={isTeacherPlus()}> | 205 | <Show when={isTeacherPlus()}> |
| 197 | - <section class="surface-card p-5"> | 206 | + <section class="data-shell p-4"> |
| 198 | <div> | 207 | <div> |
| 199 | <h2 class="font-display text-lg font-semibold">{t("events.markOther")}</h2> | 208 | <h2 class="font-display text-lg font-semibold">{t("events.markOther")}</h2> |
| 200 | <p class="mt-1 text-sm text-muted-foreground">{t("events.userId")}</p> | 209 | <p class="mt-1 text-sm text-muted-foreground">{t("events.userId")}</p> |
| @@ -215,7 +224,7 @@ function EventDetailContent() { | |||
| 215 | /> | 224 | /> |
| 216 | <Button | 225 | <Button |
| 217 | type="button" | 226 | type="button" |
| 218 | - class="w-full rounded-md sm:w-auto" | 227 | + class="w-full rounded-sm sm:w-auto" |
| 219 | disabled={pending()} | 228 | disabled={pending()} |
| 220 | onClick={() => | 229 | onClick={() => |
| 221 | void wrap(async () => { | 230 | void wrap(async () => { |
| @@ -244,7 +253,7 @@ function EventDetailContent() { | |||
| 244 | <p class="rounded-sm bg-destructive/10 px-3 py-2 text-sm text-destructive">{error()}</p> | 253 | <p class="rounded-sm bg-destructive/10 px-3 py-2 text-sm text-destructive">{error()}</p> |
| 245 | )} | 254 | )} |
| 246 | 255 | ||
| 247 | - <section class="surface-card space-y-4 p-5"> | 256 | + <section class="data-shell space-y-4 p-4"> |
| 248 | <div> | 257 | <div> |
| 249 | <h2 class="font-display text-lg font-semibold">{t("events.attendance")}</h2> | 258 | <h2 class="font-display text-lg font-semibold">{t("events.attendance")}</h2> |
| 250 | <p class="mt-1 text-sm text-muted-foreground">{t("events.markedBy")}</p> | 259 | <p class="mt-1 text-sm text-muted-foreground">{t("events.markedBy")}</p> |
src/pages/events-page.tsxmodified+29 -16
| @@ -42,22 +42,29 @@ function EventsContent() { | |||
| 42 | 42 | ||
| 43 | return ( | 43 | return ( |
| 44 | <div class="space-y-6"> | 44 | <div class="space-y-6"> |
| 45 | - <PageHeader | 45 | + <div class="space-y-2"> |
| 46 | - accent="sky" | 46 | + <div class="flex flex-wrap items-center gap-1 text-xs text-muted-foreground"> |
| 47 | - eyebrow={t("nav.events")} | 47 | + <span>{t("nav.group.classes")}</span> |
| 48 | - title={t("events.title")} | 48 | + <span>/</span> |
| 49 | - description={t("events.subtitle")} | 49 | + <span>{t("nav.events")}</span> |
| 50 | - actions={ | 50 | + </div> |
| 51 | - canCreate() ? ( | 51 | + <PageHeader |
| 52 | - <Button type="button" variant="outline" size="sm" onClick={() => setShowForm((v) => !v)}> | 52 | + accent="sky" |
| 53 | - {showForm() ? t("common.cancel") : t("events.create")} | 53 | + eyebrow={t("nav.events")} |
| 54 | - </Button> | 54 | + title={t("events.title")} |
| 55 | - ) : undefined | 55 | + description={t("events.subtitle")} |
| 56 | - } | 56 | + actions={ |
| 57 | - /> | 57 | + canCreate() ? ( |
| 58 | + <Button type="button" variant="outline" size="sm" class="rounded-sm" onClick={() => setShowForm((v) => !v)}> | ||
| 59 | + {showForm() ? t("common.cancel") : t("events.create")} | ||
| 60 | + </Button> | ||
| 61 | + ) : undefined | ||
| 62 | + } | ||
| 63 | + /> | ||
| 64 | + </div> | ||
| 58 | 65 | ||
| 59 | <Show when={canCreate() && showForm()}> | 66 | <Show when={canCreate() && showForm()}> |
| 60 | - <section class="surface-card max-w-2xl p-5 animate-fade-up"> | 67 | + <section class="data-shell max-w-2xl p-4 animate-fade-up"> |
| 61 | <h2 class="mb-4 font-display text-lg font-semibold">{t("events.create")}</h2> | 68 | <h2 class="mb-4 font-display text-lg font-semibold">{t("events.create")}</h2> |
| 62 | <EventForm | 69 | <EventForm |
| 63 | submitLabel={t("common.create")} | 70 | submitLabel={t("common.create")} |
| @@ -101,8 +108,14 @@ function EventsContent() { | |||
| 101 | </div> | 108 | </div> |
| 102 | } | 109 | } |
| 103 | > | 110 | > |
| 104 | - <div class="space-y-4"> | 111 | + <div class="space-y-4"> |
| 105 | - <ul class="grid gap-4 sm:grid-cols-2 xl:grid-cols-3"> | 112 | + <div class="flex flex-wrap items-center justify-between gap-3"> |
| 113 | + <div> | ||
| 114 | + <h2 class="font-display text-lg font-semibold">{t("events.title")}</h2> | ||
| 115 | + <p class="mt-1 text-sm text-muted-foreground">{eventList().length} {t("nav.events")}</p> | ||
| 116 | + </div> | ||
| 117 | + </div> | ||
| 118 | + <ul class="grid gap-3 sm:grid-cols-2 xl:grid-cols-3"> | ||
| 106 | <For each={pageItems()}> | 119 | <For each={pageItems()}> |
| 107 | {(event) => ( | 120 | {(event) => ( |
| 108 | <li class="animate-fade-up"> | 121 | <li class="animate-fade-up"> |