Web dashboard v2 step 4: table-of-contents sidebar
Signed-in issue pages (issue, article, world, behind) get a chapter list that marks where the reader is. One `issue_toc` helper builds it for all four handlers: the picks in issue order numbered across sections, then World Briefing, Behind the paper and a colophon anchor, with position/total over the navigable chapters. At `lg` and up it is a sticky left column with its own sticky header (issue number, "Chapter N of M", a 2px progress bar); below `lg` the same `<nav>` collapses behind a sticky hamburger bar and drops down as a panel that closes on link tap, Escape and outside tap. Without JS the panel is simply visible; `theme.js` marks the document scripted before paint so it never flashes open. Article pages advance the progress bar with scroll position through `requestAnimationFrame`, and the bar is a `<progress>` element because a percentage width would need an inline style the CSP forbids. Also fixes the phone "ears" row from the step 2 review: the row no longer wraps at 390px, the dateline has a short form below `sm:`, and the toggle and account link stay on one line. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NHyYupFdBiR4VfoUM7NjSM
This commit is contained in:
@@ -139,6 +139,17 @@ pub fn display_date(date: Date) -> String {
|
||||
format!("{weekday}, {month} {}, {}", date.day(), date.year())
|
||||
}
|
||||
|
||||
/// "Fri, Aug 15" — the same dateline abbreviated for narrow screens (web only).
|
||||
pub fn short_display_date(date: Date) -> String {
|
||||
const WEEKDAYS: [&str; 7] = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
||||
const MONTHS: [&str; 12] = [
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
|
||||
];
|
||||
let weekday = WEEKDAYS[(date.weekday().to_monday_zero_offset() as usize).min(6)];
|
||||
let month = MONTHS[(date.month() as usize).clamp(1, 12) - 1];
|
||||
format!("{weekday}, {month} {}", date.day())
|
||||
}
|
||||
|
||||
/// Materialize the [`Issue`] the EPUB builder consumes (§3.10).
|
||||
///
|
||||
/// Pure: every count is derived from the lineup, so the same inputs always give
|
||||
|
||||
Reference in New Issue
Block a user