Review M2: the Links toggle reads the panel's state; L6 the peek bar is drawn hidden; L7 a paged month is drawn open
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Fable's Phase 1 review (6e3aa6b): Review M2: the Links toggle reads the panel's state; L6 the peek bar is drawn hidden; L7 a paged month is drawn open
4 files changed,
+13
−6
internal/mapa/frame.go+6 −3internal/mapa/static/links.js+3 −0internal/mapa/templates/frame.html+2 −2internal/mapa/today.go+2 −1
diff --git a/internal/mapa/frame.go b/internal/mapa/frame.go| index 11c9df7..1105ade 100644 |
| --- a/internal/mapa/frame.go |
| +++ b/internal/mapa/frame.go |
| @@ -44,6 +44,8 @@ type pageChrome struct { |
| type dayPill struct { |
| Date, Today, Prev, Next string |
| Month *MonthView |
| + // Open draws the month open: the person is paging it (?month=). |
| + Open bool |
| } |
| // leadView is the lead slot's data: presence, save status, the pill. |
| @@ -58,6 +60,10 @@ type leadView struct { |
| func (app *app) buildFrame(request *http.Request, page *view) error { |
| tmpl := pages[page.name] |
| page.Frame.Side = app.side(request, page) |
| + // The panel's state first: the Links toggle reads it (review M2). |
| + if page.Chrome != nil && page.Chrome.Links { |
| + page.Frame.Panel = linksState(request) |
| + } |
| menus, err := fragment(tmpl, "mapa-menubar", menusFor(page)) |
| if err != nil { |
| return err |
| @@ -77,9 +83,6 @@ func (app *app) buildFrame(request *http.Request, page *view) error { |
| Menu: "Menu"}, |
| Menubar: menus, Lead: lead, |
| } |
| - if page.Chrome != nil && page.Chrome.Links { |
| - page.Frame.Panel = linksState(request) |
| - } |
| return nil |
| } |
diff --git a/internal/mapa/static/links.js b/internal/mapa/static/links.js| index 420f2bc..929771c 100644 |
| --- a/internal/mapa/static/links.js |
| +++ b/internal/mapa/static/links.js |
| @@ -38,6 +38,9 @@ |
| // The phone's sheet: the peek line opens it; Esc or the peek closes. |
| var peek = panel.querySelector("[mapa-peek]"); |
| if (peek) { |
| + // Drawn hidden: without script it would be a button that does |
| + // nothing, and the page's foot already has the lists. |
| + peek.hidden = false; |
| peek.addEventListener("click", function () { |
| var open = !panel.hasAttribute("data-open"); |
| panel.toggleAttribute("data-open", open); |
diff --git a/internal/mapa/templates/frame.html b/internal/mapa/templates/frame.html| index e722204..d6b09f4 100644 |
| --- a/internal/mapa/templates/frame.html |
| +++ b/internal/mapa/templates/frame.html |
| @@ -37,7 +37,7 @@ |
| dayPill. */}} |
| {{define "mapa-day-pill"}}<nav mapa-day aria-label="Days"> |
| <a mapa-day-step href="/d/{{.Prev}}" aria-label="Previous day, {{longDate .Prev}}">{{icon "chevron-left"}}</a> |
| - <details mapa-calendar name="estilo-menus"> |
| + <details mapa-calendar name="estilo-menus"{{if .Open}} open{{end}}> |
| <summary mapa-day-now aria-label="{{longDate .Date}}: choose a day">{{icon "calendar"}}<span>{{if eq .Date .Today}}Today{{else}}{{shortDate .Date}}{{end}}</span></summary> |
| {{with .Month}}{{template "mapa-month" .}}{{end}} |
| </details> |
| @@ -66,7 +66,7 @@ |
| sheet. Its state is the mapa-links cookie, rendered. Data: dict |
| Page (PageView), Week (*WeekView or nil), State. */}} |
| {{define "mapa-links-panel"}}{{$page := .Page}}<aside mapa-links id="mapa-links" aria-label="Links"{{if eq .State "closed"}} hidden{{end}}> |
| - <button mapa-peek type="button" aria-expanded="false" aria-controls="mapa-links-body"><span mapa-grabber aria-hidden="true"></span><span>{{icon "map"}}{{template "mapa-peek-line" .}}</span></button> |
| + <button mapa-peek type="button" hidden aria-expanded="false" aria-controls="mapa-links-body"><span mapa-grabber aria-hidden="true"></span><span>{{icon "map"}}{{template "mapa-peek-line" .}}</span></button> |
| <div mapa-links-body id="mapa-links-body"> |
| {{with .Week}}{{template "mapa-week" .}}{{end}} |
| {{with $page.Around}}{{if not $.Week}}<section aria-labelledby="mapa-around-h"><h2 id="mapa-around-h">Around this page</h2>{{template "mapa-map" .Map}}</section>{{end}}{{end}} |
diff --git a/internal/mapa/today.go b/internal/mapa/today.go| index bc825ee..85c8b9e 100644 |
| --- a/internal/mapa/today.go |
| +++ b/internal/mapa/today.go |
| @@ -99,7 +99,8 @@ func (app *app) dayCalendar(request *http.Request, viewer Viewer, |
| } |
| data.Week = &week |
| data.Pill = &dayPill{Date: date, Today: data.Today, Prev: data.Prev, |
| - Next: data.Next, Month: &month} |
| + Next: data.Next, Month: &month, |
| + Open: request.URL.Query().Get("month") != ""} |
| return nil |
| } |