The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
refactor(client): the rail's shared styles move to RoadtripSidebar.constants
Maurice7bd351f9b7f5
diff --git a/client/src/components/Roadtrip/RoadtripSidebar.constants.test.ts b/client/src/components/Roadtrip/RoadtripSidebar.constants.test.tsnew file mode 100644index 000000000..b9f02556e--- /dev/null+++ b/client/src/components/Roadtrip/RoadtripSidebar.constants.test.ts@@ -0,0 +1,25 @@+import { describe, expect, it } from 'vitest'+import { DAY_BADGE, DISC, RAIL_DASH, RAIL_GRID, STAT_LABEL } from './RoadtripSidebar.constants'++const classes = (list: string): string[] => list.split(' ')++describe('Road trip rail styles', () => {+ it('FE-ROADTRIP-RAILSTYLE-001: the marker column is exactly as wide as the disc that sits in it', () => {+ expect(RAIL_GRID).toEqual({ gridTemplateColumns: '24px 1fr', columnGap: 10 })+ // h-6 and w-6 are 1.5rem, the 24px the column keeps free, so a disc never pushes the+ // content beside it out of line with the rows above and below.+ expect(classes(DISC)).toEqual(expect.arrayContaining(['h-6', 'w-6', 'shrink-0', 'rounded-full']))+ })++ it('FE-ROADTRIP-RAILSTYLE-002: the line between stops is a gradient with an exact dash, not a dashed border', () => {+ expect(RAIL_DASH.width).toBe(1.5)+ expect(RAIL_DASH.backgroundImage).toBe('repeating-linear-gradient(var(--border-primary) 0 4px, transparent 4px 8px)')+ expect(RAIL_DASH).not.toHaveProperty('borderStyle')+ })++ it('FE-ROADTRIP-RAILSTYLE-003: captions and day badges are tracked capitals in a quiet tone, and a day badge stays at medium weight', () => {+ expect(classes(STAT_LABEL)).toEqual(expect.arrayContaining(['uppercase', 'tracking-[0.15em]', 'text-content-faint']))+ expect(classes(DAY_BADGE)).toEqual(expect.arrayContaining(['uppercase', 'tracking-[0.09em]', 'font-medium', 'text-content-muted']))+ expect(classes(DAY_BADGE)).not.toContain('font-semibold')+ })+})diff --git a/client/src/components/Roadtrip/RoadtripSidebar.constants.ts b/client/src/components/Roadtrip/RoadtripSidebar.constants.tsnew file mode 100644index 000000000..5dc4049b4--- /dev/null+++ b/client/src/components/Roadtrip/RoadtripSidebar.constants.ts@@ -0,0 +1,39 @@+import type { CSSProperties } from 'react'++// The rail's shared geometry and type styles. A plain module rather than exports beside+// the components, so every component file of the rail stays a Fast Refresh boundary.++/** The column the markers and the line share, and the gap to the content beside it. */+export const RAIL_GRID: CSSProperties = { gridTemplateColumns: '24px 1fr', columnGap: 10 }++/**+ * The line between two stops.+ *+ * A repeating gradient rather than a dashed border: a 1px dashed border renders as a+ * smear at this width, and the gradient keeps the dash length exact.+ */+export const RAIL_DASH: CSSProperties = {+ width: 1.5,+ backgroundImage: 'repeating-linear-gradient(var(--border-primary) 0 4px, transparent 4px 8px)',+}++/** A 24px disc: a stop's number, or a service stop's icon. */+export const DISC = 'grid h-6 w-6 shrink-0 place-items-center rounded-full'++/**+ * The small capitalised caption over a number, and the badges in a day's header.+ *+ * Wide letter-spacing and uppercase rather than a size change: the labels have to stay+ * legible at a third of the column's width in 23 languages, and shrinking them further+ * was what made "Driving time" unreadable before it was ever clipped.+ */+export const STAT_LABEL = 'font-geist font-semibold uppercase tracking-[0.15em] text-content-faint'++/**+ * A day-header badge: the date, the drive, the count.+ *+ * Medium weight in the quiet ink, not semibold in the strong one. Three uppercase badges+ * with wide tracking already carry as much emphasis as a line can take; adding weight and+ * contrast on top made the day's supporting facts shout louder than the day's own name.+ */+export const DAY_BADGE = 'inline-flex h-[20px] items-center rounded-lg px-2 font-geist font-medium uppercase tracking-[0.09em] text-content-muted'diff --git a/client/src/components/Roadtrip/RoadtripSidebar.tsx b/client/src/components/Roadtrip/RoadtripSidebar.tsxindex 4393b733c..1cf950c49 100644--- a/client/src/components/Roadtrip/RoadtripSidebar.tsx+++ b/client/src/components/Roadtrip/RoadtripSidebar.tsx@@ -41,6 +41,7 @@ import { bookingClock, bookingIcon, dayBookings } from './stopBookings'import type { Reservation } from '../../types'import type { StayDraft } from './RoadtripStayModal'import { missedLeaveOf, readStay, shownStay, stayDraftOf, type StayReading } from './stayReading'+import { DAY_BADGE, DISC, RAIL_DASH, RAIL_GRID, STAT_LABEL } from './RoadtripSidebar.constants'interface RoadtripSidebarProps {onFocusPoint?: (lat: number, lng: number) => void@@ -142,53 +143,18 @@ const MODE_ICON: Record<string, LucideIcon> = {// own copy of each, and its rest_area icon had drifted away from the popup's.-/** The column the markers and the line share, and the gap to the content beside it. */-const RAIL_GRID: React.CSSProperties = { gridTemplateColumns: '24px 1fr', columnGap: 10 }--/**- * The line between two stops.- *- * A repeating gradient rather than a dashed border: a 1px dashed border renders as a- * smear at this width, and the gradient keeps the dash length exact.- */-const RAIL_DASH: React.CSSProperties = {- width: 1.5,- backgroundImage: 'repeating-linear-gradient(var(--border-primary) 0 4px, transparent 4px 8px)',-}-/** The rail's dash laid on its side: the ride between two terminals, drawn like a leg. */const RIDE_DASH: React.CSSProperties = {height: 1.5,backgroundImage: 'repeating-linear-gradient(90deg, var(--border-primary) 0 4px, transparent 4px 8px)',}-/** A 24px disc — a stop's number, or a service stop's icon. */-const DISC = 'grid h-6 w-6 shrink-0 place-items-center rounded-full'--/**- * The small capitalised caption over a number, and the badges in a day's header.- *- * Wide letter-spacing and uppercase rather than a size change: the labels have to stay- * legible at a third of the column's width in 23 languages, and shrinking them further- * was what made "Driving time" unreadable before it was ever clipped.- */-const STAT_LABEL = 'font-geist font-semibold uppercase tracking-[0.15em] text-content-faint'-/*** Below this width the rail stops counting stops: the trip head drops its third figure and* the day headers their count, rather than squeezing every badge onto a line too short.*/const RAIL_NARROW_PX = 330-/**- * A day-header badge: the date, the drive, the count.- *- * Medium weight in the quiet ink, not semibold in the strong one. Three uppercase badges- * with wide tracking already carry as much emphasis as a line can take; adding weight and- * contrast on top made the day's supporting facts shout louder than the day's own name.- */-const DAY_BADGE = 'inline-flex h-[20px] items-center rounded-lg px-2 font-geist font-medium uppercase tracking-[0.09em] text-content-muted'-/*** How long the traveller stays here, and the way to change it.*