feat(web-site): harden sample desk, auth login, and form layout

Align nav/side/foot slots and shell CSS with table-driven admin desk;
add session login/logout mount and widen form fields for usable create UX.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-09-16 19:44:12 +08:00
1 parent 037592087c
commit 52b4bae423
14 files changed
+245 -73

No files matched your search

+1 -1
View File
@@ -21,7 +21,7 @@ Open http://127.0.0.1:18081/
| 3 | Open `index.mq.md` beside the browser | Narrative = program; field/rule/route/intro tables |
| 4 | `/new` empty title → submit | Server validation from **rule table** (no author JS) |
| 5 | `/new` valid title+slug → submit | Row appears on Home and Admin |
| 6 | `/admin` | List + create form — table-declared admin, not an SPA |
| 6 | Top-nav **Login** (`admin` / `demo`) → **Admin** | Session gate; desk shell + create form |
| 7 | Terminal check | `find examples/web-site \( -name '*.js' -o -name '*.css' \)` → **0** |
## Authoring contract
+29
View File
@@ -0,0 +1,29 @@
---
title: components/desk
description: Admin desk chrome — brand reads Admin; no public side rail.
---
## nav
`nav` =
| front | back | style | media | when |
|-------|------|-------|-------|------|
| Admin | /admin | | | |
| Site | / | | | |
| New | /new | | | |
| Logout | /admin/logout | | | auth |
*`nav`*
## foot
`foot` =
| front | back | style |
|-------|------|-------|
| Site | / | |
| Admin | /admin | |
| Logout | /admin/logout | |
*`foot`*
+1
View File
@@ -8,3 +8,4 @@
| Source | https://github.com/cflmy/marqdo | |
*`foot`*
+9 -7
View File
@@ -1,14 +1,16 @@
## nav
Brand first, then demo routes.
Brand first, then demo routes. Guest sees **Login**; signed-in sees **Admin** + **Logout**.
`nav` =
| front | back | style |
|-------|------|-------|
| Marqdo | / | |
| About | /about | |
| New | /new | |
| Admin | /admin | |
| front | back | style | media | when |
|-------|------|-------|-------|------|
| Marqdo | / | | | |
| About | /about | | | |
| New | /new | | | |
| Login | /login | | | guest |
| Admin | /admin | | | auth |
| Logout | /admin/logout | | | auth |
*`nav`*
+7 -6
View File
@@ -4,11 +4,12 @@ Hands-on demo checklist (links only — no JS).
`side` =
| front | back | style |
|-------|------|-------|
| 1. Home | / | |
| 2. New form | /new | |
| 3. Admin | /admin | |
| About | /about | |
| front | back | style | media | when |
|-------|------|-------|-------|------|
| 1. Home | / | | | |
| 2. New form | /new | | | |
| 3. Login | /login | | | guest |
| 3. Admin | /admin | | | auth |
| About | /about | | | |
*`side`*
+29 -5
View File
@@ -8,6 +8,7 @@ import shell:styles/shell.mq.md
import nav:components/nav.mq.md
import side:components/side.mq.md
import foot:components/foot.mq.md
import desk:components/desk.mq.md
import articles:db/articles.mq.md
import db:db/index.mq.md
---
@@ -26,6 +27,15 @@ no hand-written business JavaScript and no author .css file.
| side.`side` | shell.`side_panel` |
| foot.`foot` | shell.`footer` |
Public shell (nav + side + foot). Desk shell drops the public side rail.
`desk_shell` =
| src | style |
|-----|-------|
| desk.`nav` | shell.`topnav` |
| desk.`foot` | shell.`footer` |
List cards: summary + slug link (click through to detail).
`index` =
@@ -65,7 +75,7 @@ Home intro — same bind shape as main (front / back / style).
| claim | GFM tables | shell.`claim` |
| step | "Click any card — /post/{slug} opens the detail page from the same articles table." | shell.`step` |
| step | "Open [New](/new) and submit with an empty title (validation from a rule table)." | shell.`step` |
| step | "Submit a valid article — it appears on [Home](/) and [Admin](/admin)." | shell.`step` |
| step | "Open top-nav **Login** (admin / demo), then **Admin** — gated desk with create form + list." | shell.`step` |
`about_intro` =
@@ -90,9 +100,12 @@ Home intro — same bind shape as main (front / back / style).
| front | back | style |
|-------|------|-------|
| kicker | admin · table-declared | shell.`kicker` |
| kicker | desk · you are in admin | shell.`kicker` |
| title | Admin | shell.`intro_title` |
| lede | "List and create share the articles schema. Cards link to detail pages — no separate admin SPA." | shell.`lede` |
| lede | "This is the management desk (login required): same articles schema as the public site, assembled as list + create form — not a separate SPA. Use Site in the topnav to return, or Logout to end the session." | shell.`lede` |
| claim | login-gated | shell.`claim` |
| claim | table-declared | shell.`claim` |
| claim | "create + list" | shell.`claim` |
`post_intro` =
@@ -172,10 +185,11 @@ Neat CJK sans for body; Great Vibes for English display.
**new = > new.compose_form id="article" form=article_form**
**desk = > web.page title="Admin · Marqdo Web" shell_css="off"**
**desk = > desk.chrome body_class="is-desk"**
**desk = > desk.compose_intro intro=admin_intro**
**desk = > desk.head table=fonts**
**desk = > desk.css css=site_css**
**desk = > desk.compose_components components=home**
**desk = > desk.compose_components components=desk_shell**
**desk = > desk.compose_form id="article" form=article_form**
**desk = > desk.compose_main main=index**
**desk = > desk.link_prefix prefix="/post/"**
@@ -189,9 +203,19 @@ Neat CJK sans for body; Great Vibes for English display.
**post = > post.query query=by_slug**
**post = > post.detail detail=True**
**app = > web.app page=page db=store admin=False host="127.0.0.1" port=18081 shell_css="off"**
Demo credentials (table-declared users — host session auth, no author JS).
`admins` =
| username | password | role |
|----------|----------|------|
| admin | demo | admin |
**app = > web.app page=page db=store admin=False host="127.0.0.1" port=18081 shell_css="off" login_redirect="/admin" logout_redirect="/"**
**app = > app.route path="/about" page=about**
**app = > app.route path="/new" page=new**
**app = > app.route path="/admin" page=desk**
**app = > app.route path="/post/{slug}" page=post**
**app = > app.auth users=admins session_ttl=3600 login_path="/login" login_redirect="/admin" logout_redirect="/"**
**app = > app.gate path="/admin" roles="admin" match="prefix" on_deny="redirect" exclude="/login"**
> `app`.listen
+27 -3
View File
@@ -151,6 +151,8 @@ wine, cold gold, serif display.
| body.has-sidebar | grid-template-columns | "14rem minmax(0, 1fr)" |
| body.has-sidebar | grid-template-areas | '"top top" "side main" "foot foot"' |
| body.no-sidebar | grid-template-areas | '"top" "main" "foot"' |
| body.layout-stacked | grid-template-areas | '"top" "main" "foot"' |
| body.is-desk | grid-template-areas | '"top" "main" "foot"' |
| header.topnav | grid-area | top |
| aside.side | grid-area | side |
| main.main | grid-area | main |
@@ -194,6 +196,9 @@ wine, cold gold, serif display.
| (max-width: 860px) | aside.side | border-top | 1px solid var(--border-soft) |
| (max-width: 860px) | main.main | padding | "var(--space-6) var(--space-4) var(--space-8)" |
| (max-width: 860px) | .content.cards | grid-template-columns | 1fr |
| (max-width: 860px) | .site-form form | grid-template-columns | 1fr |
| (max-width: 860px) | .site-form label:nth-child(1) | grid-column | "1 / -1" |
| (max-width: 860px) | .site-form label:nth-child(2) | grid-column | "1 / -1" |
| (max-width: 860px) | header.topnav | padding | "0.85rem var(--space-4)" |
| (max-width: 860px) | .intro_title | font-size | "2.4rem" |
| (prefers-reduced-motion: reduce) | main.main | animation | none |
@@ -455,6 +460,16 @@ Panel + claim/steps group layout (field look comes from named bind styles).
| ul.nav a:hover | background | transparent |
| ul.nav a:hover | color | var(--gold) |
| ul.nav a:hover | text-decoration | none |
| ul.nav a[href="/admin"] | color | var(--gold) |
| ul.nav a[href="/admin"] | letter-spacing | "0.18em" |
| ul.nav a[href="/admin"] | border-bottom | 1px solid var(--gold-dim) |
| ul.side-nav a[href="/admin"] | color | var(--gold) |
| body.is-desk header.topnav | border-bottom | 1px solid rgba(107,30,58,0.55) |
| body.is-desk header.topnav | box-shadow | "0 12px 40px rgba(107,30,58,.18)" |
| body.is-desk .main-intro | border-left | 3px solid var(--wine) |
| body.is-desk .site-form | border-color | rgba(107,30,58,0.45) |
| body.is-desk .site-form | box-shadow | "0 0 0 1px rgba(212,175,55,.12), 0 18px 48px rgba(0,0,0,.35)" |
| body.is-desk .content.cards | margin-top | var(--space-6) |
| ul.nav li:first-child a | font-family | var(--display) |
| ul.nav li:first-child a | font-weight | "400" |
| ul.nav li:first-child a | color | var(--gold) |
@@ -522,15 +537,18 @@ Panel + claim/steps group layout (field look comes from named bind styles).
| .site-form | background | var(--glass) |
| .site-form | border | 1px solid var(--border) |
| .site-form | border-radius | var(--radius) |
| .site-form | padding | "var(--space-6)" |
| .site-form | padding | "var(--space-6) var(--space-6) var(--space-7, 1.75rem)" |
| .site-form | margin | "0 0 var(--space-6)" |
| .site-form | max-width | "28rem" |
| .site-form | max-width | "100%" |
| .site-form | width | "100%" |
| .site-form | box-shadow | var(--shadow) |
| .site-form | backdrop-filter | blur(16px) |
| .site-form | -webkit-backdrop-filter | blur(16px) |
| .site-form .meta | display | none |
| .site-form form | display | grid |
| .site-form form | grid-template-columns | "minmax(0, 1fr) minmax(0, 1fr)" |
| .site-form form | column-gap | var(--space-5) |
| .site-form form | row-gap | var(--space-5) |
| .site-form form | gap | var(--space-5) |
| .site-form form | margin | "0" |
| .site-form form | width | "100%" |
@@ -538,11 +556,16 @@ Panel + claim/steps group layout (field look comes from named bind styles).
| .site-form label | display | grid |
| .site-form label | gap | var(--space-2) |
| .site-form label | margin | "0" |
| .site-form label | min-width | "0" |
| .site-form label | font-weight | "400" |
| .site-form label | color | var(--gold) |
| .site-form label | font-size | "0.78rem" |
| .site-form label | letter-spacing | "0.16em" |
| .site-form label | text-transform | uppercase |
| .site-form label:nth-child(1) | grid-column | "1" |
| .site-form label:nth-child(2) | grid-column | "2" |
| .site-form label:nth-child(n+3) | grid-column | "1 / -1" |
| .site-form .actions | grid-column | "1 / -1" |
| .site-form input | -webkit-appearance | none |
| .site-form textarea | -webkit-appearance | none |
| .site-form input | appearance | none |
@@ -554,7 +577,8 @@ Panel + claim/steps group layout (field look comes from named bind styles).
| .site-form input | width | "100%" |
| .site-form textarea | width | "100%" |
| .site-form input | height | "2.75rem" |
| .site-form textarea | min-height | "8.5rem" |
| .site-form textarea | min-height | "10rem" |
| .site-form label:nth-child(4) textarea | min-height | "14rem" |
| .site-form textarea | resize | vertical |
| .site-form input | padding | "0 0.9rem" |
| .site-form textarea | padding | "0.75rem 0.9rem" |