🎨 polish dashboard cards
Browse files at this commit88729f8272a92d2ffe8dde50585168db3aaaaa03Parent: 42fe896- style
- 🎨 polish dashboard cards
1 changed file +22 -20
- src/pages/dashboard-page.tsx +22 -20
src/pages/dashboard-page.tsxmodified+22 -20
| @@ -304,17 +304,17 @@ function DashboardContent() { | |||
| 304 | }); | 304 | }); |
| 305 | 305 | ||
| 306 | return ( | 306 | return ( |
| 307 | - <div class="space-y-5"> | 307 | + <div class="overflow-hidden rounded-2xl border border-border bg-card shadow-sm"> |
| 308 | - <header class="flex flex-wrap items-end justify-between gap-3 border-b border-border/80 pb-4"> | 308 | + <header class="flex flex-wrap items-end justify-between gap-3 border-b border-border/80 bg-muted/20 px-4 py-4 sm:px-5"> |
| 309 | <div class="min-w-0 space-y-1"> | 309 | <div class="min-w-0 space-y-1"> |
| 310 | - <p class="text-[11px] font-semibold uppercase tracking-[0.12em] text-muted-foreground">{t("dashboard.today")}</p> | 310 | + <p class="text-[11px] font-semibold uppercase tracking-[0.16em] text-muted-foreground">{t("dashboard.today")}</p> |
| 311 | - <h1 class="truncate font-display text-xl font-semibold tracking-tight sm:text-2xl"> | 311 | + <h1 class="truncate font-display text-xl font-semibold tracking-tight text-foreground sm:text-2xl"> |
| 312 | {t("dashboard.greeting", { name: fullName() })} | 312 | {t("dashboard.greeting", { name: fullName() })} |
| 313 | </h1> | 313 | </h1> |
| 314 | <p class="text-sm text-muted-foreground">{t("dashboard.observationOnly")}</p> | 314 | <p class="text-sm text-muted-foreground">{t("dashboard.observationOnly")}</p> |
| 315 | </div> | 315 | </div> |
| 316 | <div class="flex flex-wrap items-center gap-2 text-xs text-muted-foreground"> | 316 | <div class="flex flex-wrap items-center gap-2 text-xs text-muted-foreground"> |
| 317 | - <span class="rounded-md border border-border bg-card px-2 py-1 font-medium text-foreground"> | 317 | + <span class="rounded-md border border-border bg-background px-2 py-1 font-medium text-foreground shadow-sm"> |
| 318 | {t(ROLE_KEY[role()])} | 318 | {t(ROLE_KEY[role()])} |
| 319 | </span> | 319 | </span> |
| 320 | <span class="mono tabular-nums">{formatDateTime(Date.now(), locale()).split(",")[0]}</span> | 320 | <span class="mono tabular-nums">{formatDateTime(Date.now(), locale()).split(",")[0]}</span> |
| @@ -322,15 +322,16 @@ function DashboardContent() { | |||
| 322 | </header> | 322 | </header> |
| 323 | 323 | ||
| 324 | <Show when={resourceError()}> | 324 | <Show when={resourceError()}> |
| 325 | - {(msg) => <Alert variant="destructive">{msg()}</Alert>} | 325 | + {(msg) => <div class="px-4 pt-4 sm:px-5"><Alert variant="destructive">{msg()}</Alert></div>} |
| 326 | </Show> | 326 | </Show> |
| 327 | 327 | ||
| 328 | - <Show when={!loading()} fallback={<PageSpinner />}> | 328 | + <Show when={!loading()} fallback={<div class="px-4 py-8"><PageSpinner /></div>}> |
| 329 | + <div class="space-y-5 bg-background/40 px-4 py-4 sm:px-5 sm:py-5"> | ||
| 329 | <section class="space-y-2.5" aria-labelledby="dash-sections"> | 330 | <section class="space-y-2.5" aria-labelledby="dash-sections"> |
| 330 | <h2 id="dash-sections" class="text-sm font-semibold tracking-tight text-foreground"> | 331 | <h2 id="dash-sections" class="text-sm font-semibold tracking-tight text-foreground"> |
| 331 | {t("dashboard.roleLinks")} | 332 | {t("dashboard.roleLinks")} |
| 332 | </h2> | 333 | </h2> |
| 333 | - <div class="grid grid-cols-1 gap-2 sm:grid-cols-2 sm:gap-2.5 lg:grid-cols-3 xl:grid-cols-4"> | 334 | + <div class="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3"> |
| 334 | <For each={portalCards()}>{(card) => <PortalCard card={card} />}</For> | 335 | <For each={portalCards()}>{(card) => <PortalCard card={card} />}</For> |
| 335 | </div> | 336 | </div> |
| 336 | </section> | 337 | </section> |
| @@ -338,7 +339,7 @@ function DashboardContent() { | |||
| 338 | <div class="grid gap-5 lg:grid-cols-2"> | 339 | <div class="grid gap-5 lg:grid-cols-2"> |
| 339 | <section class="space-y-2.5" aria-labelledby="dash-attention"> | 340 | <section class="space-y-2.5" aria-labelledby="dash-attention"> |
| 340 | <div class="flex items-baseline justify-between gap-2"> | 341 | <div class="flex items-baseline justify-between gap-2"> |
| 341 | - <h2 id="dash-attention" class="text-sm font-semibold tracking-tight"> | 342 | + <h2 id="dash-attention" class="text-sm font-semibold tracking-tight text-foreground"> |
| 342 | {t("dashboard.attention")} | 343 | {t("dashboard.attention")} |
| 343 | </h2> | 344 | </h2> |
| 344 | <Show when={attention().length === 0}> | 345 | <Show when={attention().length === 0}> |
| @@ -350,14 +351,14 @@ function DashboardContent() { | |||
| 350 | when={attention().length > 0} | 351 | when={attention().length > 0} |
| 351 | fallback={<DashEmpty>{t("dashboard.noAttention")}</DashEmpty>} | 352 | fallback={<DashEmpty>{t("dashboard.noAttention")}</DashEmpty>} |
| 352 | > | 353 | > |
| 353 | - <ul class="divide-y divide-border overflow-hidden rounded-lg border border-border bg-card"> | 354 | + <ul class="divide-y divide-border overflow-hidden rounded-xl border border-border bg-card shadow-[0_10px_30px_rgba(15,23,42,0.06)]"> |
| 354 | <For each={attention()}> | 355 | <For each={attention()}> |
| 355 | {(item) => ( | 356 | {(item) => ( |
| 356 | <li> | 357 | <li> |
| 357 | <Link | 358 | <Link |
| 358 | to={item.to} | 359 | to={item.to} |
| 359 | params={{ id: item.id }} | 360 | params={{ id: item.id }} |
| 360 | - class="flex items-center gap-3 px-3 py-2.5 text-sm transition-colors hover:bg-muted/50 sm:px-4 sm:py-3" | 361 | + class="flex items-center gap-3 px-3 py-2.5 text-sm transition-[background-color,box-shadow] hover:bg-muted/40 hover:shadow-[inset_2px_0_0_hsl(var(--primary)/0.7)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 sm:px-4 sm:py-3" |
| 361 | > | 362 | > |
| 362 | <StatusDot status={item.status} /> | 363 | <StatusDot status={item.status} /> |
| 363 | <div class="min-w-0 flex-1"> | 364 | <div class="min-w-0 flex-1"> |
| @@ -387,21 +388,21 @@ function DashboardContent() { | |||
| 387 | </section> | 388 | </section> |
| 388 | 389 | ||
| 389 | <section class="space-y-2.5" aria-labelledby="dash-upcoming"> | 390 | <section class="space-y-2.5" aria-labelledby="dash-upcoming"> |
| 390 | - <h2 id="dash-upcoming" class="text-sm font-semibold tracking-tight"> | 391 | + <h2 id="dash-upcoming" class="text-sm font-semibold tracking-tight text-foreground"> |
| 391 | {t("dashboard.upcoming")} | 392 | {t("dashboard.upcoming")} |
| 392 | </h2> | 393 | </h2> |
| 393 | <Show | 394 | <Show |
| 394 | when={upcoming().length > 0} | 395 | when={upcoming().length > 0} |
| 395 | fallback={<DashEmpty>{t("dashboard.upcomingEmpty")}</DashEmpty>} | 396 | fallback={<DashEmpty>{t("dashboard.upcomingEmpty")}</DashEmpty>} |
| 396 | > | 397 | > |
| 397 | - <ul class="divide-y divide-border overflow-hidden rounded-lg border border-border bg-card"> | 398 | + <ul class="divide-y divide-border overflow-hidden rounded-xl border border-border bg-card shadow-[0_10px_30px_rgba(15,23,42,0.06)]"> |
| 398 | <For each={upcoming()}> | 399 | <For each={upcoming()}> |
| 399 | {(item) => ( | 400 | {(item) => ( |
| 400 | <li> | 401 | <li> |
| 401 | <Link | 402 | <Link |
| 402 | to={item.kind === "exam" ? "/exams/$id" : "/events/$id"} | 403 | to={item.kind === "exam" ? "/exams/$id" : "/events/$id"} |
| 403 | params={{ id: item.id }} | 404 | params={{ id: item.id }} |
| 404 | - class="flex items-center gap-3 px-3 py-2.5 text-sm transition-colors hover:bg-muted/50 sm:px-4 sm:py-3" | 405 | + class="flex items-center gap-3 px-3 py-2.5 text-sm transition-[background-color,box-shadow] hover:bg-muted/40 hover:shadow-[inset_2px_0_0_hsl(var(--primary)/0.7)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 sm:px-4 sm:py-3" |
| 405 | > | 406 | > |
| 406 | <span class="mono w-24 shrink-0 text-[11px] tabular-nums text-muted-foreground sm:w-28 sm:text-xs"> | 407 | <span class="mono w-24 shrink-0 text-[11px] tabular-nums text-muted-foreground sm:w-28 sm:text-xs"> |
| 407 | {formatDateTime(item.at, locale())} | 408 | {formatDateTime(item.at, locale())} |
| @@ -424,6 +425,7 @@ function DashboardContent() { | |||
| 424 | </Show> | 425 | </Show> |
| 425 | </section> | 426 | </section> |
| 426 | </div> | 427 | </div> |
| 428 | + </div> | ||
| 427 | </Show> | 429 | </Show> |
| 428 | </div> | 430 | </div> |
| 429 | ); | 431 | ); |
| @@ -431,7 +433,7 @@ function DashboardContent() { | |||
| 431 | 433 | ||
| 432 | function DashEmpty(props: { children: string }) { | 434 | function DashEmpty(props: { children: string }) { |
| 433 | return ( | 435 | return ( |
| 434 | - <div class="rounded-lg border border-dashed border-border bg-card px-4 py-8 text-center text-sm text-muted-foreground"> | 436 | + <div class="rounded-xl border border-dashed border-border bg-card px-4 py-8 text-center text-sm text-muted-foreground shadow-sm"> |
| 435 | {props.children} | 437 | {props.children} |
| 436 | </div> | 438 | </div> |
| 437 | ); | 439 | ); |
| @@ -445,13 +447,13 @@ function PortalCard(props: { card: PortalCardDef }) { | |||
| 445 | return ( | 447 | return ( |
| 446 | <Link | 448 | <Link |
| 447 | to={props.card.to} | 449 | to={props.card.to} |
| 448 | - class="flex min-h-[4.5rem] items-center gap-3 rounded-lg border border-border bg-card px-3 py-3 transition-colors hover:bg-muted/40 sm:min-h-[5rem] sm:gap-3.5 sm:px-4" | 450 | + class="group relative flex min-h-[6rem] items-start gap-3 overflow-hidden rounded-xl border border-border bg-card px-3 py-3 shadow-[0_10px_30px_rgba(15,23,42,0.08)] transition-all before:absolute before:inset-x-0 before:top-0 before:h-0.5 before:bg-primary before:opacity-0 before:transition-opacity hover:-translate-y-0.5 hover:border-primary/50 hover:bg-muted/30 hover:shadow-[0_18px_45px_rgba(15,23,42,0.14)] hover:before:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 sm:min-h-[6.5rem] sm:gap-3.5 sm:px-4 sm:py-3.5" |
| 449 | > | 451 | > |
| 450 | - <span class="flex h-9 w-9 shrink-0 items-center justify-center rounded-md border border-border text-muted-foreground"> | 452 | + <span class="mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-md border border-border bg-background text-muted-foreground transition-colors group-hover:border-primary/40 group-hover:text-primary"> |
| 451 | <Icon class="h-4 w-4" /> | 453 | <Icon class="h-4 w-4" /> |
| 452 | </span> | 454 | </span> |
| 453 | - <div class="min-w-0 flex-1"> | 455 | + <div class="min-w-0 flex-1 space-y-1"> |
| 454 | - <div class="flex min-w-0 items-center gap-2"> | 456 | + <div class="flex min-w-0 items-start gap-2"> |
| 455 | <h3 class="truncate text-sm font-semibold tracking-tight text-foreground">{t(props.card.titleKey)}</h3> | 457 | <h3 class="truncate text-sm font-semibold tracking-tight text-foreground">{t(props.card.titleKey)}</h3> |
| 456 | <Show when={hasStat()}> | 458 | <Show when={hasStat()}> |
| 457 | <span class="hidden text-muted-foreground/50 sm:inline" aria-hidden="true"> | 459 | <span class="hidden text-muted-foreground/50 sm:inline" aria-hidden="true"> |
| @@ -467,7 +469,7 @@ function PortalCard(props: { card: PortalCardDef }) { | |||
| 467 | </span> | 469 | </span> |
| 468 | </Show> | 470 | </Show> |
| 469 | </div> | 471 | </div> |
| 470 | - <p class="mt-0.5 line-clamp-1 text-xs text-muted-foreground">{t(props.card.descKey)}</p> | 472 | + <p class="line-clamp-2 text-xs leading-5 text-muted-foreground">{t(props.card.descKey)}</p> |
| 471 | </div> | 473 | </div> |
| 472 | </Link> | 474 | </Link> |
| 473 | ); | 475 | ); |