add datastar SSE rendering

This commit is contained in:
Abel Luck 2026-03-30 12:34:38 +02:00
parent 2accb26546
commit 33dbb143fd
5 changed files with 329 additions and 19 deletions

View file

@ -91,7 +91,7 @@ def page_header() -> Renderable:
]
def overview_section() -> Renderable:
def overview_section(*, active_jobs: str) -> Renderable:
return h.section[
h.div(class_="mb-4 flex items-end justify-between")[
h.div[
@ -105,7 +105,11 @@ def overview_section() -> Renderable:
h.p(class_="text-sm text-slate-500")["Updated from static fixture data"],
],
h.dl(class_="grid gap-4 md:grid-cols-2 xl:grid-cols-4")[
stat_card(label="Active jobs", value="12", detail="9 scheduled, 3 paused"),
stat_card(
label="Active jobs",
value=active_jobs,
detail="Temporary live demo counter for Datastar refresh testing",
),
stat_card(label="Running now", value="2", detail="RSS and Pangea workers"),
stat_card(
label="Completed today", value="34", detail="31 succeeded, 3 failed"
@ -450,7 +454,7 @@ def settings_panel() -> Renderable:
]
def admin_component() -> Renderable:
def admin_component(*, active_jobs: str = "12") -> Renderable:
running_rows = (
(
h.div(class_="font-semibold text-slate-950")["Pangea mobile articles"],
@ -566,7 +570,7 @@ def admin_component() -> Renderable:
h.div(class_="px-4 py-5 sm:px-6 lg:px-8 lg:py-8")[
h.div(class_="mx-auto max-w-7xl space-y-6")[
page_header(),
overview_section(),
overview_section(active_jobs=active_jobs),
h.div(
class_="grid gap-6 xl:grid-cols-[minmax(0,1.35fr)_minmax(22rem,0.95fr)]"
)[