Files
TREK/client/src/components/Tours/PlacesToursModeSwitch.tsx
T
Maurice c92478c5ad feat(tours): align the Tours UI with the planner redesign
The Tours surfaces now use the same building blocks as the rest of the
planner: tinted head bands, eyebrow labels, white field boxes and pills,
place-style list rows and the inspector frame for the map detail.

- Tour detail on the map uses the place inspector's frame, head band,
  labelled metric fields, collapsible track colour and footer buttons
- Tour rows in the Plan sidebar and the Tours tab look like place rows,
  with the facts as pills and a "+" that opens the trip's days as a menu
- Tours tab rails get the planner head bands, editor fields and
  waypoint rows in the day card style; notices share one look
- Map hint shortened to one line and the empty state reads as a single
  sentence in all locales
- New "tours" mascot scene with a pack, a trekking pole, hills and a
  trail, used by the Tours empty states
2026-10-05 12:04:49 +02:00

49 lines
1.9 KiB
TypeScript

import React from 'react'
import { MapPin, Mountain } from 'lucide-react'
import { useTranslation } from '../../i18n/TranslationContext'
import { NEUTRAL_TINT, fs } from '../shared/DialogShell'
interface PlacesToursModeSwitchProps {
active: boolean
onChange: (tours: boolean) => void
}
/**
* Switches the right add-panel between the ordinary Places sidebar and the
* Tours selection list. Top level of the panel, mirroring RoadtripModeSwitch
* (Days <-> Roadtrip), using the same placement and addon gating convention.
* Only rendered while the tours addon is on.
*/
export default function PlacesToursModeSwitch({ active, onChange }: PlacesToursModeSwitchProps): React.ReactElement {
const { t } = useTranslation()
const options: [boolean, string, typeof MapPin][] = [
[false, t('tours.mode.places'), MapPin],
[true, t('tours.mode.tours'), Mountain],
]
return (
<div className="flex-none px-3 pb-0.5 pt-2.5" style={{ background: NEUTRAL_TINT }}>
<div role="tablist" aria-label={t('tours.mode.label')} className="flex w-full gap-0.5 rounded-[10px] bg-surface-tertiary p-[3px]">
{options.map(([value, label, Icon]) => {
const selected = active === value
return (
<button
key={label}
type="button"
role="tab"
aria-selected={selected}
onClick={() => onChange(value)}
style={fs(12.5, 'body')}
className={`flex flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-[8px] px-3 py-1.5 font-medium transition-colors ${
selected ? 'bg-surface-card text-content shadow-sm' : 'text-content-muted hover:text-content'
}`}
>
<Icon size={13} strokeWidth={2} aria-hidden />
<span className="truncate">{label}</span>
</button>
)
})}
</div>
</div>
)
}