Skip to content

Page redesign with global time range and Midnight Train branding - #2

Merged
ibsenc merged 3 commits into
mainfrom
website-redesign-rebrand
May 24, 2026
Merged

Page redesign with global time range and Midnight Train branding#2
ibsenc merged 3 commits into
mainfrom
website-redesign-rebrand

Conversation

@ibsenc

@ibsenc ibsenc commented May 24, 2026

Copy link
Copy Markdown
Owner

Redesigns the dashboard UI around a single global time-range selector and updates the app’s “Midnight Train” branding, ensuring stats, charts, and event listings all query consistently within the selected range.

Changes:

  • Added a global time range selector (24 hr, 3 day, 7 day, etc. presets + custom) and wired it into stats, chart, and event query panels.
  • Updated API calls to support time-range filtering for stats and to fetch the latest confirmed train by default.
  • Refreshed branding (header icon/title/tagline, footer links/credits) and updated favicon usage.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR redesigns the dashboard UI around a single global time-range selector and updates the app’s “Midnight Train” branding, ensuring stats, charts, and event listings all query consistently within the selected range.

Changes:

  • Added a global time range selector (presets + custom) and wired it into stats, chart, and event query panels.
  • Updated API calls to support time-range filtering for stats and to fetch the latest confirmed train by default.
  • Refreshed branding (header icon/title/tagline, footer links/credits) and updated favicon usage.

Reviewed changes

Copilot reviewed 10 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/types.ts Removes obsolete rolling-window stats fields from the Stats type.
src/components/TimeRangeQuery.tsx Refactors to be driven by global start/end props and auto-fetch on change.
src/components/StatsPanel.tsx Adds start/end props and fetches time-scoped stats; hardens dB parsing.
src/components/LatestTrain.tsx Switches to “latest confirmed” behavior and updates panel title.
src/components/GlobalTimeRange.tsx New global time-range selector component (presets + custom apply).
src/components/DetectionChart.tsx Makes chart time-range-driven and improves tick generation/formatting.
src/App.tsx Integrates global time range, updates header branding, adds footer.
src/App.css Adds styles for new branding/footer/global range UI and adjusts layout.
src/api.ts Extends stats query params and changes latest endpoint behavior.
public/icons.svg Removes unused icon sprite asset.
public/favicon.svg Removes old SVG favicon asset.
index.html Switches favicon link to train-icon.png.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +55 to +61
function handlePreset(preset: Preset) {
if (preset === 'custom') {
onChange({ preset: 'custom', start: undefined, end: undefined });
} else {
onChange(makePresetRange(preset));
}
}

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made a change to delay setting values for "Custom" until "Apply" is clicked

Comment thread src/App.css Outdated
Comment on lines +412 to +416
.preset-btn.active {
background: var(--accent);
border-color: var(--accent);
color: #fff;
}
Comment thread src/api.ts Outdated
Comment on lines 16 to 20
export async function fetchLatest(): Promise<Detection> {
const res = await fetch(`${BASE_URL}/api/detections/latest?confirmed_only=true`);
if (res.status === 404) throw new Error('No detections found');
if (!res.ok) throw new Error('Failed to fetch latest detection');
return res.json() as Promise<Detection>;
Comment thread index.html Outdated
Comment on lines 5 to 7
<link rel="icon" type="image/png" href="/train-icon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>train-detection-app</title>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 13 changed files in this pull request and generated 2 comments.

Comment on lines +55 to +62
function handlePreset(preset: Preset) {
setCustomError(null);
if (preset === 'custom') {
onChange({ ...value, preset: 'custom' });
} else {
onChange(makePresetRange(preset));
}
}
Comment thread src/components/DetectionChart.tsx Outdated
Comment on lines +178 to +186
const endMs = end ? new Date(end).getTime() : Date.now();
const startMs = start ? new Date(start).getTime() : undefined;
const dataMinMs = detections.length > 0
? detections.reduce((min, d) => Math.min(min, new Date(d.timestamp).getTime()), Infinity)
: undefined;
const effectiveStartMs = startMs ?? dataMinMs;
const rangeDays = effectiveStartMs !== undefined ? (endMs - effectiveStartMs) / (24 * 60 * 60 * 1000) : 365;
const ticks = effectiveStartMs !== undefined ? generateTicks(effectiveStartMs, endMs, rangeDays) : undefined;
const tickFormatter = (ms: number) => formatXTick(ms, rangeDays);

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 13 changed files in this pull request and generated 3 comments.

Comment on lines +98 to +104
<button
key={p.preset}
className={`range-btn${activePreset === p.preset ? ' active' : ''}`}
onClick={() => handlePreset(p.preset)}
>
{p.label}
</button>
Comment on lines +51 to +52
<StatCard label="Avg dB" value={isNaN(parseFloat(stats.avg_decibels)) ? '0.0 dB' : `${parseFloat(stats.avg_decibels).toFixed(1)} dB`} />
<StatCard label="Max dB" value={isNaN(parseFloat(stats.max_decibels)) ? '0.0 dB' : `${parseFloat(stats.max_decibels).toFixed(1)} dB`} />
Comment on lines +65 to +69
const interval = 48 * 60 * 60 * 1000;
while (t <= endMs) { if (t >= startMs) ticks.push(t); t += interval; }
}

return ticks;
@ibsenc
ibsenc merged commit f068286 into main May 24, 2026
1 check passed
@ibsenc
ibsenc deleted the website-redesign-rebrand branch May 24, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants