Files
TREK/client/src/constants/tripTabs.ts
T
Maurice fe05afec19 feat(trips): trip settings with a linked journal tab
The Share button becomes the trip's Settings, a round button beside the back
pill. The dialog is rebuilt around three areas (People, Sharing, Journal) with
a side navigation, a fixed height and 960 px width on wide screens.

Journal links one of your journals from the Journey addon to the trip. Every
trip member is ticked as a reader by default, each can be raised to editor or
left out, and the people a save would let in for the first time are named
before it saves. The link can be changed or removed. With a link the trip gets
a Journal tab on desktop and phone that shows the Journey addon's own view,
live through its sync and trip:journal:changed. Nothing shows with the addon
off.

members.shareTrip and nav.share are gone with the button that used them.
2026-10-18 17:41:25 +02:00

57 lines
2.0 KiB
TypeScript

/**
* The trip planner's core tab ids, in the order the tab bar shows them.
*
* These are the German legacy names the planner has always used internally
* ('buchungen', 'finanzplan', 'dateien', 'listen') — not the English labels.
* They are what sessionStorage, the ?tab= deep link and the startup-destination
* setting persist, so renaming one would silently strand saved preferences.
*
* Addon-owned tabs are listed here even while their addon is off: useTripPlanner
* builds TRIP_TABS from what is actually enabled, and anything pointing at a tab
* that isn't there falls back to the plan view.
*/
export const TRIP_TAB_IDS = [
'plan',
'tour-planner',
'roadtrip',
'transports',
'buchungen',
'listen',
'finanzplan',
'dateien',
'collab',
'journal',
] as const
export type TripTabId = (typeof TRIP_TAB_IDS)[number]
/**
* Translation key per tab, so the startup-destination picker in Settings names
* the tabs exactly as the planner's own tab bar does. useTripPlanner builds its
* TRIP_TABS from these too — one source, or the two would drift apart the first
* time a tab is renamed.
*/
export const TRIP_TAB_LABEL_KEYS: Record<TripTabId, string> = {
plan: 'trip.tabs.plan',
'tour-planner': 'trip.tabs.tourPlanner',
roadtrip: 'roadtrip.title',
transports: 'trip.tabs.transports',
buchungen: 'trip.tabs.reservations',
listen: 'trip.tabs.lists',
finanzplan: 'trip.tabs.budget',
dateien: 'trip.tabs.files',
collab: 'admin.addons.catalog.collab.name',
journal: 'trip.tabs.journal',
}
export const isTripTabId = (value: unknown): value is TripTabId =>
typeof value === 'string' && (TRIP_TAB_IDS as readonly string[]).includes(value)
/**
* What `/trips/:id?tab=…` accepts. Trip-page plugins mount as tabs too and are
* addressable by their `plugin:<id>` form, so a shortcut can point at one — the
* planner's own guard still drops it if that plugin isn't installed.
*/
export const isDeepLinkableTripTab = (value: string): boolean =>
isTripTabId(value) || value.startsWith('plugin:')