From 079bf8537a5a78d082f8e0b788f121d2e09244fb Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 18 Jun 2026 04:35:19 +0800 Subject: [PATCH] style(webui): refine typography and spacing --- gui/web_gui_pkg/routes.py | 13 + webui/css/strict_ui_spacing.css | 404 +++++++++++++++++++++++++++++ webui/css/strict_ui_typography.css | 338 ++++++++++++++++++++++++ webui/index.html | 2 + 4 files changed, 757 insertions(+) create mode 100644 webui/css/strict_ui_spacing.css create mode 100644 webui/css/strict_ui_typography.css diff --git a/gui/web_gui_pkg/routes.py b/gui/web_gui_pkg/routes.py index 51b2f66..3df5afe 100644 --- a/gui/web_gui_pkg/routes.py +++ b/gui/web_gui_pkg/routes.py @@ -27,6 +27,11 @@ BASE_DIR = ( _TRUE_LITERALS = {"1", "true", "yes", "y", "on"} _FALSE_LITERALS = {"0", "false", "no", "n", "off", ""} +_EMPTY_PNG_BYTES = bytes.fromhex( + "89504e470d0a1a0a0000000d4948445200000001000000010806000000" + "1f15c4890000000a49444154789c636000000200015dc1b2ea00000000" + "49454e44ae426082" +) def _is_local_request(handler) -> bool: @@ -270,6 +275,14 @@ def handle_get(handler, u, runner, csrf_token: str) -> None: return full = os.path.join(str(path_config.PROJECT_ROOT), safe) if not os.path.isfile(full): + if safe == "pic/screenshot.png": + handler.send_response(HTTPStatus.OK) + handler.send_header("Content-Type", "image/png") + handler.send_header("Content-Length", str(len(_EMPTY_PNG_BYTES))) + handler.send_header("Cache-Control", "no-store") + handler.end_headers() + handler.wfile.write(_EMPTY_PNG_BYTES) + return handler.send_error(HTTPStatus.NOT_FOUND) return ext = os.path.splitext(full)[1].lower() diff --git a/webui/css/strict_ui_spacing.css b/webui/css/strict_ui_spacing.css new file mode 100644 index 0000000..8569258 --- /dev/null +++ b/webui/css/strict_ui_spacing.css @@ -0,0 +1,404 @@ +/* Strict UI spacing and density pass. Visual-only; no feature changes. */ +:root { + --strict-top: 72px; + --strict-status: 132px; + --strict-panel-pad-x: 26px; + --strict-panel-pad-y: 22px; + --strict-row-gap-x: 22px; + --strict-row-gap-y: 10px; +} + +:root .brandBlock { + padding: 0 24px !important; +} + +:root .header-actions { + gap: 10px !important; + padding: 0 22px !important; +} + +:root .actionGroup { + gap: 8px !important; +} + +:root .header .btn { + min-height: 38px !important; + padding: 0 14px !important; +} + +:root .header .btnIconOnly, +:root .header #btnTheme { + width: 38px !important; + min-width: 38px !important; +} + +:root .overview, +:root:not([data-premium-panel="device"]) .overview { + gap: 14px !important; + height: var(--strict-status) !important; + padding: 14px 22px 12px !important; +} + +:root .overviewCard { + grid-template-columns: 58px minmax(0, 1fr) !important; + min-height: 104px !important; + padding: 14px 18px !important; +} + +:root .premiumMetricIcon { + width: 50px !important; + height: 50px !important; +} + +:root .configWorkspace, +:root:not([data-premium-panel="device"]) .configWorkspace { + height: calc(100vh - var(--strict-top) - var(--strict-status) - 38px) !important; + padding: 8px 26px 22px !important; +} + +:root .workspaceShell .configRail, +:root .configRail { + height: calc(100vh - var(--strict-top)) !important; + top: var(--strict-top) !important; + padding: 18px 12px !important; +} + +:root .sideNav { + gap: 5px !important; +} + +:root .sideNav .tabBtn, +:root .tabBtn { + height: 44px !important; + min-height: 44px !important; +} + +:root .panel, +:root .card[data-panel], +:root .cardReservations, +:root .cardLog, +:root .cardShot { + padding: var(--strict-panel-pad-y) var(--strict-panel-pad-x) !important; +} + +:root .panel > .sectionTitle, +:root .cardTitle, +:root .logTitle { + margin-bottom: 18px !important; +} + +:root .panel > .sectionTitle:not(:first-child) { + margin-top: 22px !important; + padding-top: 18px !important; +} + +:root .panel > .row { + grid-template-columns: minmax(140px, 0.2fr) minmax(0, 1fr) !important; + gap: var(--strict-row-gap-y) var(--strict-row-gap-x) !important; + padding: 8px 0 !important; +} + +:root .row.grid2 { + gap: 14px 22px !important; +} + +:root .row.grid3 { + gap: 14px 18px !important; +} + +:root .row.grid4 { + gap: 12px 16px !important; +} + +:root .row.grid2 .label, +:root .row.grid3 .label, +:root .row.grid4 .label { + margin-bottom: 6px !important; +} + +:root .rowActions { + margin-top: 12px !important; +} + +:root .btnGroup { + gap: 10px !important; +} + +:root .input, +:root .small, +:root .logSearchBox, +:root input[type="text"], +:root input[type="number"], +:root input[type="search"], +:root select { + min-height: 38px !important; +} + +:root textarea, +:root .textarea { + min-height: 104px !important; +} + +:root #wifiStatus { + margin-top: 8px !important; +} + +:root #wifiScanResults { + min-height: 82px !important; + margin-top: 12px !important; + padding: 24px 14px !important; +} + +:root .statsGrid, +:root .chartsGrid { + gap: 14px 18px !important; +} + +:root .stat { + min-height: 78px !important; + padding: 14px !important; +} + +:root .statValue { + margin-top: 6px !important; +} + +:root .chartBlock { + padding: 16px !important; +} + +:root .chart { + min-height: 190px !important; +} + +:root .cardShot .cardTitle, +:root .cardReservations > .cardTitle, +:root .cardLog > .cardTitle { + margin-bottom: 18px !important; +} + +:root .preview { + min-height: 560px !important; +} + +:root .previewFullscreen { + margin-top: 12px !important; +} + +:root #liveShotStatus { + margin-top: 14px !important; + padding-top: 12px !important; +} + +:root .reservationsContent { + min-height: 170px !important; +} + +:root .reservationsContent > .hint:only-child { + min-height: 150px !important; +} + +:root .divider { + height: 16px !important; +} + +:root .logHeader { + min-height: 58px !important; + gap: 14px !important; + padding: 14px 16px !important; +} + +:root .logHeaderActions { + gap: 10px !important; +} + +:root .logHeaderActions .btn.small { + min-height: 36px !important; + padding: 0 14px !important; +} + +:root .log { + min-height: clamp(390px, 50vh, 600px) !important; + max-height: clamp(390px, 50vh, 600px) !important; + padding: 16px !important; +} + +@media (max-width: 1180px) { + :root { + --strict-rail: 74px; + --strict-status: 198px; + } + + :root .overviewCard { + min-height: 88px !important; + } + + :root .workspaceShell .configRail, + :root .configRail { + padding: 18px 9px !important; + } +} + +@media (max-width: 820px) { + :root { + --strict-panel-pad-x: 12px; + --strict-panel-pad-y: 12px; + } + + :root .header-actions { + gap: 6px !important; + padding: 8px !important; + } + + :root .primaryActions { + gap: 6px !important; + } + + :root .secondaryActions { + grid-template-columns: repeat(6, minmax(0, 1fr)) !important; + gap: 6px !important; + } + + :root .header .btn { + min-height: 36px !important; + padding: 0 7px !important; + } + + :root .header .secondaryActions .btn { + width: 100% !important; + min-width: 0 !important; + min-height: 36px !important; + padding: 0 !important; + gap: 0 !important; + overflow: hidden !important; + color: transparent !important; + font-size: 0 !important; + text-indent: -9999px !important; + white-space: nowrap !important; + } + + :root .header .secondaryActions .btn .btnIcon { + margin: 0 !important; + color: #172033 !important; + text-indent: 0 !important; + } + + :root .header .secondaryActions .btn .btnIcon svg { + color: inherit !important; + } + + :root .header .secondaryActions #btnSave .btnIcon { + color: #ffffff !important; + } + + :root .overview, + :root:not([data-premium-panel="device"]) .overview { + gap: 7px !important; + padding: 8px !important; + } + + :root .overviewCard { + min-height: 82px !important; + padding: 9px 10px !important; + } + + :root .overviewValue, + :root .overviewMeta { + display: block !important; + width: 100% !important; + white-space: nowrap !important; + overflow: hidden !important; + text-overflow: ellipsis !important; + overflow-wrap: normal !important; + } + + :root .workspaceShell .configRail, + :root .configRail { + top: 94px !important; + height: auto !important; + max-height: none !important; + padding: 6px 8px !important; + overflow-x: auto !important; + overflow-y: hidden !important; + } + + :root .sideNav { + gap: 5px !important; + } + + :root .sideNav .tabBtn, + :root .tabBtn { + width: 50px !important; + min-width: 50px !important; + height: 40px !important; + min-height: 40px !important; + } + + :root .configWorkspace, + :root:not([data-premium-panel="device"]) .configWorkspace { + padding: 8px !important; + } + + :root .panel, + :root .card[data-panel], + :root .cardReservations, + :root .cardLog, + :root .cardShot { + padding: var(--strict-panel-pad-y) var(--strict-panel-pad-x) !important; + } + + :root .panel > .sectionTitle, + :root .cardTitle, + :root .logTitle { + margin-bottom: 12px !important; + } + + :root .panel > .sectionTitle:not(:first-child) { + margin-top: 16px !important; + padding-top: 14px !important; + } + + :root .panel > .row, + :root .row, + :root .row.grid2, + :root .row.grid3, + :root .row.grid4, + :root .panel[data-panel="license"] .row { + gap: 6px !important; + padding: 7px 0 !important; + } + + :root .rowActions { + margin-top: 10px !important; + } + + :root #wifiScanResults { + min-height: 70px !important; + margin-top: 10px !important; + padding: 18px 10px !important; + } + + :root .preview { + min-height: 500px !important; + } + + :root .reservationsContent, + :root .reservationsContent > .hint:only-child { + min-height: 120px !important; + } + + :root .logHeader { + gap: 10px !important; + padding: 12px !important; + } + + :root .logHeaderActions { + gap: 8px !important; + } + + :root .log { + min-height: 320px !important; + max-height: 480px !important; + padding: 12px !important; + } +} diff --git a/webui/css/strict_ui_typography.css b/webui/css/strict_ui_typography.css new file mode 100644 index 0000000..c0687ad --- /dev/null +++ b/webui/css/strict_ui_typography.css @@ -0,0 +1,338 @@ +/* Strict UI typography and refinement pass. Visual-only; no feature changes. */ +:root { + --strict-type-brand: 24px; + --strict-type-action: 14px; + --strict-type-nav: 14px; + --strict-type-metric-title: 18px; + --strict-type-metric-body: 13px; + --strict-type-metric-value: 15px; + --strict-type-panel-title: 20px; + --strict-type-section: 16px; + --strict-type-label: 13px; + --strict-type-control: 13px; + --strict-type-hint: 12px; + --strict-type-stat: 22px; + --strict-type-log: 13px; + --strict-weight-title: 760; + --strict-weight-strong: 720; + --strict-weight-body: 520; + --strict-shadow-card: 0 8px 24px rgba(15, 23, 42, 0.055); + --strict-shadow-panel: 0 14px 38px rgba(15, 23, 42, 0.06); +} + +html, +body { + -webkit-font-smoothing: antialiased; + text-rendering: geometricPrecision; +} + +body { + background: + linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(241, 245, 249, 0.96)), + linear-gradient(90deg, rgba(15, 159, 142, 0.025), transparent 42%), + #f6f8fb !important; +} + +.title, +:root .title { + color: #0b1220 !important; + font-size: var(--strict-type-brand) !important; + font-weight: 780 !important; + line-height: 1 !important; + letter-spacing: 0 !important; +} + +.header { + background: rgba(255, 255, 255, 0.96) !important; + box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04) !important; +} + +.header .btn, +:root .header .btn { + min-height: 40px !important; + padding: 0 15px !important; + border-color: #d7e0ea !important; + border-radius: 8px !important; + color: #172033 !important; + background: linear-gradient(180deg, #ffffff, #f9fbfd) !important; + box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset !important; + font-size: var(--strict-type-action) !important; + font-weight: var(--strict-weight-strong) !important; + line-height: 1 !important; +} + +.header .btn:hover { + border-color: #b9c7d8 !important; + background: #ffffff !important; + box-shadow: var(--strict-shadow-card) !important; +} + +.header #btnStart, +.header .btnPrimary, +:root .header #btnStart, +:root .header .btnPrimary { + color: #ffffff !important; + border-color: #2563eb !important; + background: linear-gradient(180deg, #2f6df3, #245fe4) !important; + box-shadow: 0 8px 20px rgba(37, 99, 235, 0.2) !important; +} + +.header #btnStop, +.header #btnForceStop { + color: #dc2626 !important; + border-color: #fecdd3 !important; + background: linear-gradient(180deg, #ffffff, #fff8f9) !important; +} + +.configRail, +.workspaceShell .configRail { + background: rgba(255, 255, 255, 0.9) !important; +} + +.sideNav .tabBtn, +.tabBtn { + min-height: 46px !important; + height: 46px !important; + color: #334155 !important; + font-size: var(--strict-type-nav) !important; + font-weight: var(--strict-weight-strong) !important; +} + +.sideNav .tabText, +.tabText { + font-size: var(--strict-type-nav) !important; + font-weight: var(--strict-weight-strong) !important; + line-height: 1 !important; +} + +.sideNav .tabBtn.active, +.tabBtn.active, +.tabBtn[aria-selected="true"] { + color: #1d4ed8 !important; + border-color: #dbe7ff !important; + background: linear-gradient(90deg, #edf4ff, #f7faff) !important; +} + +.overviewCard, +:root .overviewCard { + min-height: 112px !important; + border-color: #dce4ee !important; + background: + linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 253, 0.96)), + #ffffff !important; + box-shadow: var(--strict-shadow-card) !important; +} + +.overviewLabel, +:root .overviewLabel { + color: #101828 !important; + font-size: var(--strict-type-metric-title) !important; + font-weight: var(--strict-weight-title) !important; + line-height: 1.18 !important; +} + +.overviewValue, +:root .overviewValue { + color: #64748b !important; + font-size: var(--strict-type-metric-body) !important; + font-weight: var(--strict-weight-body) !important; + line-height: 1.28 !important; +} + +.overviewMeta, +:root .overviewMeta { + color: #0f9f8e !important; + font-size: var(--strict-type-metric-value) !important; + font-weight: var(--strict-weight-strong) !important; + line-height: 1.22 !important; +} + +.premiumMetricIcon, +:root .premiumMetricIcon { + width: 52px !important; + height: 52px !important; + background: linear-gradient(145deg, #12b6a6, #0c9387) !important; + box-shadow: 0 10px 24px rgba(15, 159, 142, 0.16) !important; +} + +.panel, +.card[data-panel], +:root .panel, +:root .card[data-panel] { + border-color: #dce4ee !important; + background: + linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 252, 254, 0.98)), + #ffffff !important; + box-shadow: var(--strict-shadow-panel) !important; +} + +.panel > .sectionTitle, +.cardTitle, +.logTitle, +:root .panel > .sectionTitle, +:root .cardTitle, +:root .logTitle { + color: #101828 !important; + font-size: var(--strict-type-panel-title) !important; + font-weight: var(--strict-weight-title) !important; + line-height: 1.22 !important; +} + +:root .panel > .sectionTitle:not(:first-child), +.sectionTitle:not(:first-child) { + border-top-color: #e7edf4 !important; +} + +.label, +:root .label, +:root[data-premium-panel="debug"] .panel[data-panel="debug"] .label { + color: #263241 !important; + font-size: var(--strict-type-label) !important; + font-weight: var(--strict-weight-strong) !important; + line-height: 1.35 !important; +} + +.hint, +:root .hint, +:root[data-premium-panel="debug"] .panel[data-panel="debug"] .hint { + color: #718096 !important; + font-size: var(--strict-type-hint) !important; + font-weight: 450 !important; + line-height: 1.55 !important; +} + +.input, +.small, +.logSearchBox, +input[type="text"], +input[type="number"], +input[type="search"], +select, +textarea, +:root .input, +:root .small, +:root .logSearchBox, +:root input[type="text"], +:root input[type="number"], +:root input[type="search"], +:root select, +:root textarea, +:root[data-premium-panel="debug"] .panel[data-panel="debug"] .input { + min-height: 38px !important; + color: #1f2937 !important; + border-color: #cfd9e6 !important; + background: #ffffff !important; + font-size: var(--strict-type-control) !important; + font-weight: var(--strict-weight-body) !important; + line-height: 1.35 !important; +} + +.check, +:root .check, +:root[data-premium-panel="debug"] .panel[data-panel="debug"] .check { + color: #334155 !important; + font-size: var(--strict-type-control) !important; + font-weight: var(--strict-weight-body) !important; + line-height: 1.35 !important; +} + +.statLabel, +:root[data-premium-panel="stats"] .statLabel { + color: #667085 !important; + font-size: 12px !important; + font-weight: var(--strict-weight-strong) !important; + line-height: 1.35 !important; +} + +.statValue, +:root[data-premium-panel="stats"] .statValue, +:root[data-premium-panel="stats"] .statHero .statValue { + color: #111827 !important; + font-size: var(--strict-type-stat) !important; + font-weight: 780 !important; + line-height: 1.12 !important; +} + +.chartTitle, +:root[data-premium-panel="stats"] .chartTitle { + color: #1f2937 !important; + font-size: 14px !important; + font-weight: var(--strict-weight-strong) !important; +} + +:root[data-premium-panel="debug"] .panel[data-panel="debug"] > .sectionTitle { + min-height: 40px !important; + color: #111827 !important; + font-size: var(--strict-type-section) !important; + font-weight: var(--strict-weight-title) !important; + background: linear-gradient(180deg, #ffffff, #f8fbff) !important; +} + +.logHeader { + background: + linear-gradient(180deg, rgba(248, 252, 250, 0.98), rgba(241, 248, 246, 0.98)), + #f8fbfa !important; +} + +.logTitle, +:root .logTitle { + font-size: var(--strict-type-panel-title) !important; +} + +.log, +:root .log { + font-size: var(--strict-type-log) !important; + font-weight: 450 !important; + line-height: 1.62 !important; +} + +.appFooter { + color: #64748b !important; + font-size: 12px !important; + font-weight: 500 !important; +} + +@media (max-width: 820px) { + :root { + --strict-type-action: 13px; + --strict-type-metric-title: 13px; + --strict-type-metric-body: 12px; + --strict-type-metric-value: 12px; + --strict-type-panel-title: 17px; + --strict-type-section: 15px; + --strict-type-label: 12px; + --strict-type-control: 12px; + --strict-type-hint: 11px; + --strict-type-stat: 20px; + } + + .header .btn, + :root .header .btn { + min-height: 38px !important; + } + + .overviewCard, + :root .overviewCard { + min-height: 74px !important; + box-shadow: 0 5px 16px rgba(15, 23, 42, 0.055) !important; + } + + .sideNav .tabBtn, + .tabBtn { + height: 42px !important; + min-height: 42px !important; + } + + .secondaryActions .btn, + :root .header .secondaryActions .btn, + .secondaryActions #btnLoad, + .secondaryActions #btnSave, + .secondaryActions #btnTheme { + font-size: 0 !important; + gap: 0 !important; + } + + .secondaryActions .btn .btnIcon { + margin: 0 !important; + } +} diff --git a/webui/index.html b/webui/index.html index 24d4820..bd034f2 100644 --- a/webui/index.html +++ b/webui/index.html @@ -25,6 +25,8 @@ + +