fix: date format, hide mode toggle, wrap show names, hide mobile right gutter, move reset
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -42,10 +42,9 @@ describe("renderPage", () => {
|
||||
expect(html).toContain('aria-current="true"');
|
||||
});
|
||||
|
||||
it("includes mode toggle links", () => {
|
||||
it("does not show mode toggle in UI (mode is URL-only)", () => {
|
||||
const html = renderPage("Test", "", defaultPrefs);
|
||||
expect(html).toContain("VCR");
|
||||
expect(html).toContain("All Active");
|
||||
expect(html).not.toContain("All Active");
|
||||
});
|
||||
|
||||
it("includes theme toggle links", () => {
|
||||
|
||||
@@ -17,16 +17,7 @@ export function renderPage(title: string, bodyContent: string, prefs: Preference
|
||||
})
|
||||
.join(" · ");
|
||||
|
||||
const modeLinks = [
|
||||
{ key: "vcr", label: "VCR" },
|
||||
{ key: "all", label: "All Active" },
|
||||
]
|
||||
.map(({ key, label }) => {
|
||||
const isCurrent = key === prefs.mode;
|
||||
const href = buildLink("/week", { ...prefs, mode: key });
|
||||
return `<a href="${href}" class="mode-link${isCurrent ? " mode-link--active" : ""}"${isCurrent ? ' aria-current="true"' : ""}>${label}</a>`;
|
||||
})
|
||||
.join(" | ");
|
||||
|
||||
|
||||
const themeLinks = [
|
||||
{ key: "light", label: "☀️ Light" },
|
||||
@@ -56,14 +47,14 @@ export function renderPage(title: string, bodyContent: string, prefs: Preference
|
||||
<h1 class="site-title"><a href="/week">📻 VCR Calendar</a></h1>
|
||||
<p class="site-header__disclaimer">Subject to change, not official</p>
|
||||
<nav class="controls-bar">
|
||||
<div class="controls-row">${modeLinks}</div>
|
||||
<div class="controls-row">
|
||||
<a href="${prevLink}" class="week-nav" aria-label="Previous week">←</a>
|
||||
<span class="week-label">${weekBounds.label}</span>
|
||||
<a href="${nextLink}" class="week-nav" aria-label="Next week">→</a>
|
||||
</div>
|
||||
<div class="controls-row">${tzLinks}</div>
|
||||
<div class="controls-row">${themeLinks} · <a href="/week?reset=1" class="reset-link">Reset</a></div>
|
||||
<div class="controls-row">${themeLinks}</div>
|
||||
<div class="controls-row controls-row--reset"><a href="/week?reset=1" class="reset-link" title="Resets timezone, theme, and mode to defaults">↺ Reset</a><span class="reset-hint">resets all options</span></div>
|
||||
</nav>
|
||||
</header>
|
||||
<main class="page-container">${bodyContent}</main>
|
||||
|
||||
@@ -69,9 +69,10 @@ export function renderWeekGrid(shows: Show[], prefs: Preferences): string {
|
||||
for (let i = 0; i < 7; i++) {
|
||||
const dayDate = new Date(weekBounds.start);
|
||||
dayDate.setUTCDate(dayDate.getUTCDate() + i);
|
||||
const month = dayDate.getUTCMonth() + 1;
|
||||
const dateNum = dayDate.getUTCDate();
|
||||
const todayClass = dateKeyFromUtcDate(dayDate) === todayKey ? " day-today" : "";
|
||||
html += `<div class="week-grid__day-header${todayClass}" style="grid-column:${i + 2}; grid-row:1">${DAY_SHORT[i]}<br>${dateNum}</div>`;
|
||||
html += `<div class="week-grid__day-header${todayClass}" style="grid-column:${i + 2}; grid-row:1">${DAY_SHORT[i]} ${month}/${dateNum}</div>`;
|
||||
}
|
||||
html += '<div class="week-grid__gutter week-grid__header-gutter week-grid__gutter--right" style="grid-column:9; grid-row:1"></div>';
|
||||
|
||||
|
||||
@@ -192,10 +192,29 @@ ${DARK_VARS}
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.controls-reset {
|
||||
.controls-row--reset {
|
||||
justify-content: flex-end;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.reset-link {
|
||||
font-size: 0.8125rem;
|
||||
color: var(--text-muted);
|
||||
margin-left: auto;
|
||||
padding: 0.15rem 0.5rem;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.reset-link:hover {
|
||||
color: var(--text);
|
||||
background: var(--today-highlight);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.reset-hint {
|
||||
font-size: 0.6875rem;
|
||||
color: var(--text-muted);
|
||||
opacity: 0.6;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* Timezone picker */
|
||||
@@ -339,12 +358,11 @@ ${DARK_VARS}
|
||||
|
||||
.show-block__name {
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
gap: 0.25rem 0.35rem;
|
||||
flex-wrap: wrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.show-block__time {
|
||||
@@ -582,7 +600,7 @@ ${DARK_VARS}
|
||||
}
|
||||
|
||||
.week-grid {
|
||||
grid-template-columns: 5.5rem repeat(7, 120px) 5.5rem;
|
||||
grid-template-columns: 5.5rem repeat(7, 120px);
|
||||
min-width: max-content;
|
||||
}
|
||||
|
||||
@@ -592,13 +610,7 @@ ${DARK_VARS}
|
||||
}
|
||||
|
||||
.week-grid__gutter--right {
|
||||
position: sticky;
|
||||
right: 0;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.controls-reset {
|
||||
margin-left: 0;
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user