Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ repeat it. Here is the operational knowledge on top of that.
- **Protocol changes:** update `docs/protocol.md`, both sides, bump
`PROTOCOL_VERSION` for breaking changes.
- **Structural decisions:** add an ADR to `docs/adr/` (NNNN-short-name.md;
context, decision, consequences). There are 19 so far.
context, decision, consequences). There are 20 so far.
- **Feature design:** significant features go through the superpowers workflow —
a design spec and an implementation plan in `docs/superpowers/{specs,plans}/`
(see the 2026-10-19 examples). Follow that pattern for new features.
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

- Start menu: the language switch is a compact dropdown (any future language shows up in it), the version and Privacy link sit in a quiet footer, and a new version shows a "Reload / Later" toast instead of a link in the header. On phones the tabs share one row instead of scrolling.
- Installed on a phone or tablet (home screen), OpenRadlr no longer locks itself to landscape: it turns with the device, so the start menu and the ride also work in portrait.
- The 2D ride map now follows the selected season and time of day, like the 3D world: winter paints snow, ice and pine tree dots, golden hour and dusk tint the ground, water, road and buildings, and `auto` follows the local clock. The start menu's map uses the same palette, so the season carries from the menu into the ride.
- The 2D view is a top-down map of the road around you: the coast, every road, the ridden road with its lane markings, and nearby riders, with your marker heading up. It replaces the lane strip that stretched over the whole window and had nothing to show when riding alone. In the Training layout the map ends above the workout band. When you're drafting, a soft band marks the gap ahead of you, as the lane strip did; the golden lemons and the best-lap ghost keep their places on the map.
- The 2D map has small tree dots in and near forests and thin outline houses in villages, plus the café at the start. They come from the route's scenery zones and the map's cafés, are generated once and culled to the view; no extra requests. Tree dots now scale with the map's zoom, so they grow with the road instead of staying pin-sized.

### Added

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ uploaded to Strava.
e.g. Wahoo KICKR Core, Van Rysel D500) and heart rate straps, a simulated trainer,
trainer difficulty, virtual shifting (for Zwift Cog and single-gear setups), a
ERG mode with structured workouts (built-in presets and `.zwo` import),
low-poly 3D view with chase camera, a 2D lane view, an elevation profile, a
low-poly 3D view with chase camera, a top-down 2D map view, an elevation profile, a
minimap, nearby riders, race panel and chat; live player counts in the start
menu and during the ride; ride photos and a summary image; ride summary with
`.tcx`/`.gpx`/`.fit` download and Strava upload (as a virtual ride with its climbing), placed on the map in a virtual world off Mallorca;
Expand Down
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "openradlr-client",
"version": "0.1.0",
"private": true,
"description": "OpenRadlr browser client (proof of concept): Web Bluetooth trainers and a 2D view.",
"description": "OpenRadlr browser client (proof of concept): Web Bluetooth trainers and a 2D map view.",
"license": "AGPL-3.0-or-later",
"type": "module",
"engines": {
Expand Down
6 changes: 4 additions & 2 deletions client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@
<link rel="modulepreload" href="js/view/overviewView.js" />
<link rel="modulepreload" href="js/view/paddleView.js" />
<link rel="modulepreload" href="js/view/panels.js" />
<link rel="modulepreload" href="js/view/pelotonView.js" />
<link rel="modulepreload" href="js/view/photos.js" />
<link rel="modulepreload" href="js/view/profileView.js" />
<link rel="modulepreload" href="js/view/raceTimelineView.js" />
<link rel="modulepreload" href="js/view/rideMapView.js" />
<link rel="modulepreload" href="js/view/splitsView.js" />
<link rel="modulepreload" href="js/view/startMenu.js" />
<link rel="modulepreload" href="js/view/stravaUploadView.js" />
Expand Down Expand Up @@ -131,6 +131,8 @@
<link rel="modulepreload" href="js/util/emitter.js" />
<link rel="modulepreload" href="js/view/botKits.js" />
<link rel="modulepreload" href="js/view/remoteRiders.js" />
<link rel="modulepreload" href="js/view/rideMapDecor.js" />
<link rel="modulepreload" href="js/view/rideMapTheme.js" />
<link rel="modulepreload" href="js/view3d/biomes/temperate.js" />
<link rel="modulepreload" href="js/view3d/biomes/winter/index.js" />
<link rel="modulepreload" href="js/view3d/chaseCamera.js" />
Expand Down Expand Up @@ -427,7 +429,7 @@ <h2 id="events-title" class="visually-hidden" data-i18n="events.title">Events</h
<canvas id="world3d" class="canvas-world" aria-label="3D view of the road behind your rider" data-i18n-attr="aria-label:ride.3dViewOfThe"></canvas>
<div id="labels3d" class="labels3d" aria-hidden="true"></div>
</div>
<canvas id="peloton" class="canvas-peloton" aria-label="Riders around you, one row per lane" data-i18n-attr="aria-label:ride.ridersAroundYouOne"></canvas>
<canvas id="ride-map" class="canvas-ride-map" aria-label="Top-down map of the road around you" data-i18n-attr="aria-label:ride.mapOfTheRoad"></canvas>
<div id="studio-wrap" class="world-wrap studio-only" hidden>
<canvas id="studio3d" class="canvas-world" aria-label="3D view of the spin studio" data-i18n-attr="aria-label:ride.3dViewOfThe2"></canvas>
<div id="studio-labels" class="labels3d" aria-hidden="true"></div>
Expand Down
2 changes: 1 addition & 1 deletion client/public/js/i18n/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default {
"ride.gap": "Abstand",
"ride.aroundYou": "Um dich herum",
"ride.3dViewOfThe": "3D-Ansicht der Straße hinter deinem Fahrer",
"ride.ridersAroundYouOne": "Fahrer um dich herum, eine Reihe pro Spur",
"ride.mapOfTheRoad": "Draufsicht auf die Straße um dich herum",
"ride.3dViewOfThe2": "3D-Ansicht des Spinning-Studios",
"ride.leftPaddle": "Linkes Paddle",
"ride.rightPaddle": "Rechtes Paddle",
Expand Down
2 changes: 1 addition & 1 deletion client/public/js/i18n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default {
"ride.gap": "Gap",
"ride.aroundYou": "Around you",
"ride.3dViewOfThe": "3D view of the road behind your rider",
"ride.ridersAroundYouOne": "Riders around you, one row per lane",
"ride.mapOfTheRoad": "Top-down map of the road around you",
"ride.3dViewOfThe2": "3D view of the spin studio",
"ride.leftPaddle": "Left paddle",
"ride.rightPaddle": "Right paddle",
Expand Down
22 changes: 13 additions & 9 deletions client/public/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import {
} from "./view/hud.js";
import { appendFeed, describeEvent, inRace, nearbyRiders, onlineSummary, raceStatus, renderResults, renderRiderList, riderName, riderSections } from "./view/panels.js";
import { PhotoAlbum, canShareFiles, canvasToPng, composePhoto, composeSummary, downloadBlob, grabScene, photoActions, photoFileName, photoStats } from "./view/photos.js";
import { drawPeloton } from "./view/pelotonView.js";
import { drawRideMap } from "./view/rideMapView.js";
import { renderSplits } from "./view/splitsView.js";
import { drawProfile, drawUpcoming } from "./view/profileView.js";
import { ftpProvenance } from "./view/ftpProvenance.js";
Expand Down Expand Up @@ -398,6 +398,8 @@ const app = {
/** The menu's 3D view, handed over to the ride when it was built for the joined route. */
menuView: null,
viewMode: "2d",
/** The selected time of day, also used by the 2D map when there is no 3D view. */
timeMode: TIME_MODES.includes(readSetting(TIME_KEY)) ? readSetting(TIME_KEY) : "day",
hud: null,
layoutChoice: "auto",
layout: "cockpit",
Expand Down Expand Up @@ -849,7 +851,7 @@ function initMenuStage() {
$("menu-profile").hidden = !route;
// Docked in the corner, the map points at the picked route; with none (Workout, Studio) it is an empty box.
$("menu-map").hidden = !route && $("setup").classList.contains("map-docked");
drawMapPreview($("menu-map"), { routes, selectedId: route?.id ?? null, network: shown.network ?? null });
drawMapPreview($("menu-map"), { routes, selectedId: route?.id ?? null, network: shown.network ?? null, biome: app.biome, timeMode: app.timeMode });
if (route) drawProfile($("menu-profile"), { route, riders: [], myId: null, colors: themeColors() });
};
app.redrawStage = drawStage;
Expand Down Expand Up @@ -4130,18 +4132,20 @@ function setQuality(quality) {
}

function setTimeMode(mode) {
if (!app.view3d) return;
app.view3d.setTimeMode(mode);
$("time-mode").value = mode;
writeSetting(TIME_KEY, mode);
const next = TIME_MODES.includes(mode) ? mode : "day";
app.timeMode = next;
// The 2D map has no view to configure, but it reads the same setting.
app.view3d?.setTimeMode(next);
$("time-mode").value = next;
writeSetting(TIME_KEY, next);
app.viewPopover?.refresh();
}

function setViewMode(mode, { remember = true } = {}) {
const use3d = mode === "3d" && Boolean(app.view3d);
app.viewMode = use3d ? "3d" : "2d";
$("world-wrap").hidden = !use3d;
$("peloton").hidden = use3d;
$("ride-map").hidden = use3d;
$("view-3d").setAttribute("aria-pressed", String(use3d));
$("view-2d").setAttribute("aria-pressed", String(!use3d));
$("scene-controls").hidden = !use3d;
Expand Down Expand Up @@ -4420,11 +4424,11 @@ function frame() {
if (app.viewMode === "3d") {
app.view3d.render({ riders: ghost ? [...everyone, ghost] : everyone, myId: app.riderId, myCadence: app.session.latest.cadence, timeS: time, colors });
} else {
drawPeloton($("peloton"), { route: app.route, riders: ghost ? [...riders, ghost] : riders, me, draft, colors, lemons: app.lemonHunt?.lemons });
drawRideMap($("ride-map"), { route: app.route, riders: ghost ? [...riders, ghost] : riders, me, draft, lemons: app.lemonHunt?.lemons, colors, network: app.network, routes: app.routes, biome: app.biome, timeMode: app.timeMode });
}
// Read the canvas now: a WebGL buffer is cleared once the frame is shown.
if (app.sceneRequests.length) {
const scene = grabScene(app.viewMode === "3d" ? $("world3d") : $("peloton"));
const scene = grabScene(app.viewMode === "3d" ? $("world3d") : $("ride-map"));
for (const callback of app.sceneRequests.splice(0)) callback(scene);
}

Expand Down
37 changes: 16 additions & 21 deletions client/public/js/view/mapPreview.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { prepareCanvas } from "./canvas.js";
import { MAP_COLORS, rideMapTheme } from "./rideMapTheme.js";
import { islandShape } from "../view3d/island.js";
import { roadNetworkOf } from "../route/worldMap.js";

export { MAP_COLORS };

/**
* Top-down map of the routes on one map: the island, every road, the picked
* route highlighted with its climbs and sprints, and the start. Shown in the
Expand All @@ -10,17 +13,6 @@ import { roadNetworkOf } from "../route/worldMap.js";
* for tests.
*/

export const MAP_COLORS = Object.freeze({
sea: "#163a4e",
land: "#2d5b3b",
sand: "#cdb98a",
road: "rgba(232, 236, 241, 0.5)",
accent: "#ff7a1a",
climb: "#ff5d5d",
sprint: "#4cc3ff",
start: "#ffd21f",
});

/** Road samples like the 3D world's (world x/z, north is −z), for the island's shape. */
export function roadSamples(routes, step = 6) {
const samples = [];
Expand Down Expand Up @@ -75,13 +67,15 @@ function markerAt(route, distance) {

/**
* @param {HTMLCanvasElement} canvas
* @param {{routes: object[], selectedId: string | null, colors?: object, island?: object | null, network?: object | null}} options
* @param {{routes: object[], selectedId: string | null, colors?: object, island?: object | null, network?: object | null, biome?: string, timeMode?: string, date?: Date}} options
* routes are RouteGeometry objects of one map; with the map's `network`
* file, the island and every road come from it
* file, the island and every road come from it. `biome` and `timeMode`
* colour the map like the ride's 2D view.
*/
export function drawMapPreview(canvas, { routes, selectedId, colors = MAP_COLORS, network = null, island }) {
export function drawMapPreview(canvas, { routes, selectedId, colors = MAP_COLORS, network = null, island, biome = "temperate", timeMode = "day", date }) {
const { ctx, width, height } = prepareCanvas(canvas);
ctx.fillStyle = colors.sea;
const theme = rideMapTheme({ biome, timeMode, date, colors });
ctx.fillStyle = theme.sea;
ctx.fillRect(0, 0, width, height);
if (!routes.length) return;
const roadNetwork = network ? roadNetworkOf(network) : null;
Expand All @@ -99,9 +93,9 @@ export function drawMapPreview(canvas, { routes, selectedId, colors = MAP_COLORS

if (coast.length) {
path(coast, true);
ctx.fillStyle = colors.land;
ctx.fillStyle = theme.land;
ctx.fill();
ctx.strokeStyle = colors.sand;
ctx.strokeStyle = theme.sand;
ctx.lineWidth = 3;
ctx.stroke();
}
Expand All @@ -112,7 +106,7 @@ export function drawMapPreview(canvas, { routes, selectedId, colors = MAP_COLORS
routes.forEach((route, i) => {
if (route === selected) return;
path(roads[i], route.loop !== false);
ctx.strokeStyle = colors.road;
ctx.strokeStyle = theme.contextRoad;
ctx.lineWidth = 2;
ctx.stroke();
});
Expand All @@ -125,17 +119,18 @@ export function drawMapPreview(canvas, { routes, selectedId, colors = MAP_COLORS
ctx.beginPath();
ctx.moveTo(...frame.toScreen(a.x, -a.y));
ctx.lineTo(...frame.toScreen(b.x, -b.y));
ctx.strokeStyle = kind === "climb" ? colors.climb : kind === "sprint" ? colors.sprint : colors.accent;
const accent = kind === "climb" ? (colors.climb ?? MAP_COLORS.climb) : kind === "sprint" ? (colors.sprint ?? MAP_COLORS.sprint) : (colors.accent ?? MAP_COLORS.accent);
ctx.strokeStyle = accent;
ctx.lineWidth = 4;
ctx.stroke();
}
const start = selected.positionAt(0);
const [sx, sy] = frame.toScreen(start.x, -start.y);
ctx.beginPath();
ctx.arc(sx, sy, 5, 0, Math.PI * 2);
ctx.fillStyle = colors.start;
ctx.fillStyle = colors.start ?? MAP_COLORS.start;
ctx.fill();
ctx.strokeStyle = colors.sea;
ctx.strokeStyle = theme.sea;
ctx.lineWidth = 2;
ctx.stroke();
}
Expand Down
144 changes: 0 additions & 144 deletions client/public/js/view/pelotonView.js

This file was deleted.

Loading
Loading