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"');
|
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);
|
const html = renderPage("Test", "", defaultPrefs);
|
||||||
expect(html).toContain("VCR");
|
expect(html).not.toContain("All Active");
|
||||||
expect(html).toContain("All Active");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("includes theme toggle links", () => {
|
it("includes theme toggle links", () => {
|
||||||
|
|||||||
@@ -17,16 +17,7 @@ export function renderPage(title: string, bodyContent: string, prefs: Preference
|
|||||||
})
|
})
|
||||||
.join(" · ");
|
.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 = [
|
const themeLinks = [
|
||||||
{ key: "light", label: "☀️ Light" },
|
{ 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>
|
<h1 class="site-title"><a href="/week">📻 VCR Calendar</a></h1>
|
||||||
<p class="site-header__disclaimer">Subject to change, not official</p>
|
<p class="site-header__disclaimer">Subject to change, not official</p>
|
||||||
<nav class="controls-bar">
|
<nav class="controls-bar">
|
||||||
<div class="controls-row">${modeLinks}</div>
|
|
||||||
<div class="controls-row">
|
<div class="controls-row">
|
||||||
<a href="${prevLink}" class="week-nav" aria-label="Previous week">←</a>
|
<a href="${prevLink}" class="week-nav" aria-label="Previous week">←</a>
|
||||||
<span class="week-label">${weekBounds.label}</span>
|
<span class="week-label">${weekBounds.label}</span>
|
||||||
<a href="${nextLink}" class="week-nav" aria-label="Next week">→</a>
|
<a href="${nextLink}" class="week-nav" aria-label="Next week">→</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="controls-row">${tzLinks}</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>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
<main class="page-container">${bodyContent}</main>
|
<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++) {
|
for (let i = 0; i < 7; i++) {
|
||||||
const dayDate = new Date(weekBounds.start);
|
const dayDate = new Date(weekBounds.start);
|
||||||
dayDate.setUTCDate(dayDate.getUTCDate() + i);
|
dayDate.setUTCDate(dayDate.getUTCDate() + i);
|
||||||
|
const month = dayDate.getUTCMonth() + 1;
|
||||||
const dateNum = dayDate.getUTCDate();
|
const dateNum = dayDate.getUTCDate();
|
||||||
const todayClass = dateKeyFromUtcDate(dayDate) === todayKey ? " day-today" : "";
|
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>';
|
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);
|
color: var(--text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.controls-reset {
|
.controls-row--reset {
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reset-link {
|
||||||
font-size: 0.8125rem;
|
font-size: 0.8125rem;
|
||||||
color: var(--text-muted);
|
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 */
|
/* Timezone picker */
|
||||||
@@ -339,12 +358,11 @@ ${DARK_VARS}
|
|||||||
|
|
||||||
.show-block__name {
|
.show-block__name {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.35rem;
|
gap: 0.25rem 0.35rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.show-block__time {
|
.show-block__time {
|
||||||
@@ -582,7 +600,7 @@ ${DARK_VARS}
|
|||||||
}
|
}
|
||||||
|
|
||||||
.week-grid {
|
.week-grid {
|
||||||
grid-template-columns: 5.5rem repeat(7, 120px) 5.5rem;
|
grid-template-columns: 5.5rem repeat(7, 120px);
|
||||||
min-width: max-content;
|
min-width: max-content;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -592,13 +610,7 @@ ${DARK_VARS}
|
|||||||
}
|
}
|
||||||
|
|
||||||
.week-grid__gutter--right {
|
.week-grid__gutter--right {
|
||||||
position: sticky;
|
display: none;
|
||||||
right: 0;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.controls-reset {
|
|
||||||
margin-left: 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|||||||
Reference in New Issue
Block a user