Profiles in a dialog, the chip in the map's bottom-left corner picks one (the Design canvas' Vehicle): a car gains fuel, Euro class, stickers and vignettes / toll units with dates; drive mode's Menu steps through them. Speed limits by country for cars and over 3.5 t (public/js/speed_limits.js, sources in it): the route's roads (km, road class, country), the limit shown the lower of the sign and the profile's; the Route panel's countries with their limits and how the motorways are paid; past a border a card in drive mode (GridBorder). The itinerary in the Route panel (Itinerary): the trip's name, leave time, days start; per stop a night, stay and note, planned times, day headers; another screen's change shown where it happened with Undo
This commit is contained in:
1 parent
a6158f4083
commit
5e31dfaba9
15 files changed
+733
-169
No files matched your search
@@ -0,0 +1,71 @@
|
||||
// The countries' general speed limits (km/h) for a car / a vehicle up to
|
||||
// 3.5 t and for a motorhome over 3.5 t: [motorway, expressway, outside towns,
|
||||
// in towns]; null = no general limit. What a road's own sign says wins when
|
||||
// it's lower (dashboard.js), these fill in what a vehicle may not exceed.
|
||||
//
|
||||
// Sources (read 2026-12-03; both are camping guides built on ADAC's tables,
|
||||
// not the laws themselves — check before relying on a figure):
|
||||
// W = womoly.app/wohnmobil-ratgeber/tempolimits-europa (Stand Oktober 2026)
|
||||
// C = copilot.travel/maps/caravan-speed-limits (read up to 2026-10-31)
|
||||
// CZ, HU, PL, SK only from C (a secondary source). Left out where the two
|
||||
// disagree or depend on the registration: ES, SE, NO, BE, LU, and countries
|
||||
// neither covers (RO, BG, GR).
|
||||
// ponytail: one figure per road class; night/rain limits, Germany's 100 only for a
|
||||
// registered Wohnmobil up to 7.5 t, France's 80/90 by département not modelled
|
||||
export const SPEED_LIMITS = {
|
||||
AT: { car: [130, 100, 100, 50], heavy: [80, 80, 70, 50], src: "W, C" },
|
||||
CH: { car: [120, 100, 80, 50], heavy: [100, 100, 80, 50], src: "W, C" },
|
||||
CZ: { car: [130, 110, 90, 50], heavy: [80, 80, 80, 50], src: "C" },
|
||||
DE: { car: [null, 100, 100, 50], heavy: [100, 100, 80, 50], src: "W, C; 100 only registered as Wohnmobil, else 80" },
|
||||
DK: { car: [130, 80, 80, 50], heavy: [80, 80, 80, 50], src: "W, C" },
|
||||
FR: { car: [130, 110, 80, 50], heavy: [110, 100, 80, 50], src: "W, C" },
|
||||
HR: { car: [130, 110, 90, 50], heavy: [90, 80, 80, 50], src: "W, C" },
|
||||
HU: { car: [130, 110, 90, 50], heavy: [80, 70, 70, 50], src: "C" },
|
||||
IT: { car: [130, 110, 90, 50], heavy: [100, 80, 80, 50], src: "W, C" },
|
||||
NL: { car: [100, 100, 80, 50], heavy: [80, 80, 80, 50], src: "W, C; 130 at night on some motorways" },
|
||||
PL: { car: [140, 120, 90, 50], heavy: [80, 80, 70, 50], src: "C" },
|
||||
PT: { car: [120, 100, 90, 50], heavy: [100, 90, 80, 50], src: "W, C" },
|
||||
SI: { car: [130, 110, 90, 50], heavy: [80, 80, 80, 50], src: "W, C" },
|
||||
SK: { car: [130, 130, 90, 50], heavy: [90, 90, 90, 50], src: "C" },
|
||||
};
|
||||
|
||||
// Motorways paid by a time-based vignette (a car up to 3.5 t); over 3.5 t
|
||||
// these countries charge by distance (a toll unit) instead.
|
||||
export const VIGNETTE_COUNTRIES = new Set(["AT", "BG", "CH", "CZ", "HU", "MD", "RO", "SI", "SK"]);
|
||||
|
||||
export const COUNTRY_NAMES = new Intl.DisplayNames(["en"], { type: "region" });
|
||||
|
||||
// Over 3.5 t: a car profile heavier than that.
|
||||
export const isHeavy = (vehicle) => (vehicle?.type || "car") === "car" && (vehicle?.weight ?? 0) > 3.5;
|
||||
|
||||
// The column of the four for a Valhalla road class.
|
||||
const column = (roadClass) => (roadClass === "motorway" ? 0 : roadClass === "trunk" ? 1 : 2);
|
||||
|
||||
// The vehicle's limit on this road: the general one for its class and road
|
||||
// class (outside towns: Valhalla doesn't say where a town starts, a town's
|
||||
// own 50 is the road's sign), or null where none is known.
|
||||
export function vehicleLimit(code, roadClass, vehicle) {
|
||||
const row = SPEED_LIMITS[code];
|
||||
return row ? row[isHeavy(vehicle) ? "heavy" : "car"][column(roadClass)] : null;
|
||||
}
|
||||
|
||||
// The lower of the road's sign (a number, "unlimited" or null) and the
|
||||
// vehicle's own limit there. Only for a heavy vehicle: a car's general limit
|
||||
// is what the road's sign already says, or unknown.
|
||||
export function effectiveLimit(sign, code, roadClass, vehicle) {
|
||||
const own = isHeavy(vehicle) ? vehicleLimit(code, roadClass, vehicle) : null;
|
||||
if (own == null) return sign;
|
||||
return typeof sign === "number" ? Math.min(sign, own) : own;
|
||||
}
|
||||
|
||||
// How the motorways are paid there, and whether the profile has it:
|
||||
// { how: "vignette" | "toll unit" | null, has: true | false | null, until }.
|
||||
export function motorwayPayment(code, vehicle, today = new Date().toISOString().slice(0, 10)) {
|
||||
const heavy = isHeavy(vehicle);
|
||||
const how = VIGNETTE_COUNTRIES.has(code) ? (heavy ? "toll unit" : "vignette") : null;
|
||||
if (!how) return { how: null, has: null };
|
||||
const kind = heavy ? "toll" : "vignette";
|
||||
const owned = (vehicle?.vignettes || []).find((v) => v.country === code && (v.kind || "vignette") === kind);
|
||||
if (!owned) return { how, has: false };
|
||||
return { how, has: !owned.until || owned.until >= today, until: owned.until || null };
|
||||
}
|
||||
Reference in new issue
Block a user