diff --git a/client/src/components/Roadtrip/RoadtripLimitsCard.tsx b/client/src/components/Roadtrip/RoadtripLimitsCard.tsx
index 991d54edc..b3171cdbf 100644
--- a/client/src/components/Roadtrip/RoadtripLimitsCard.tsx
+++ b/client/src/components/Roadtrip/RoadtripLimitsCard.tsx
@@ -15,7 +15,6 @@ import RangeStrip from './RangeStrip'
import { valhallaAvailable } from '../Map/valhallaRoute'
import ToggleSwitch from '../Settings/ToggleSwitch'
import type { DistanceUnit, RouteAvoidClass } from '../../types'
-import { FS } from './typeScale'
import DayWindowFields from './DayWindowFields'
import SettingsHint from './SettingsHint'
import { dayWindow } from './dayWindow'
diff --git a/client/src/components/Roadtrip/RoadtripSidebar.constants.test.ts b/client/src/components/Roadtrip/RoadtripSidebar.constants.test.ts
index d1b09dc24..a2221cea7 100644
--- a/client/src/components/Roadtrip/RoadtripSidebar.constants.test.ts
+++ b/client/src/components/Roadtrip/RoadtripSidebar.constants.test.ts
@@ -5,10 +5,9 @@ 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']))
+ expect(RAIL_GRID).toEqual({ gridTemplateColumns: '28px minmax(0, 1fr)', columnGap: 10 })
+ // size-7 matches the 28px reserved for the marker.
+ expect(classes(DISC)).toEqual(expect.arrayContaining(['size-7', 'shrink-0', 'rounded-full']))
})
it('FE-ROADTRIP-RAILSTYLE-002: the line between stops is a gradient with an exact dash, not a dashed border', () => {
@@ -18,8 +17,8 @@ describe('Road trip rail styles', () => {
})
it('FE-ROADTRIP-RAILSTYLE-003: captions are the eyebrow of the dialogs, and a day badge is the round pill of the day plan in a quiet tone at normal weight', () => {
- expect(classes(STAT_LABEL)).toEqual(expect.arrayContaining(['uppercase', 'tracking-[.08em]', 'font-bold', 'text-content-faint']))
- expect(classes(DAY_BADGE)).toEqual(expect.arrayContaining(['rounded-full', 'uppercase', 'tracking-[.05em]', 'font-normal', 'text-content-secondary']))
+ expect(classes(STAT_LABEL)).toEqual(expect.arrayContaining(['font-medium', 'text-content-muted']))
+ expect(classes(DAY_BADGE)).toEqual(expect.arrayContaining(['rounded-full', 'min-h-6', 'font-normal', 'text-content-secondary']))
expect(classes(DAY_BADGE)).not.toContain('font-semibold')
})
})
diff --git a/client/src/components/Roadtrip/RoadtripSidebar.test.tsx b/client/src/components/Roadtrip/RoadtripSidebar.test.tsx
index d4bca995f..a08a14be3 100644
--- a/client/src/components/Roadtrip/RoadtripSidebar.test.tsx
+++ b/client/src/components/Roadtrip/RoadtripSidebar.test.tsx
@@ -1397,7 +1397,7 @@ describe('RoadtripSidebar with a hire car and the day\'s bookings (#2428)', () =
const onOpenBooking = vi.fn()
wrap(
)
// The table is there to read, not a button that does nothing; the taxi is a button.
- expect(screen.queryByRole('button', { name: /Tisch Bullerei/ })).toBeNull()
+ expect(screen.queryByRole('button', { name: 'Tisch Bullerei, Confirmed' })).toBeNull()
const taxi = screen.getByRole('button', { name: 'Taxi zum Hafen, Confirmed' })
expect(taxi).toHaveTextContent('18:30')
fireEvent.click(screen.getByText('19:30'))
diff --git a/client/src/components/SystemNotices/SystemNoticeModal.test.tsx b/client/src/components/SystemNotices/SystemNoticeModal.test.tsx
index ab2810494..42f09b6bf 100644
--- a/client/src/components/SystemNotices/SystemNoticeModal.test.tsx
+++ b/client/src/components/SystemNotices/SystemNoticeModal.test.tsx
@@ -839,7 +839,7 @@ describe('ModalRenderer', () => {
await flushGraceDelay();
const secondary = document.getElementById('notice-cta2-secondary-action') as HTMLElement;
- expect(secondary.className).toContain('bg-blue-600');
+ expect(secondary.className).toContain('bg-surface-secondary');
await act(async () => {
fireEvent.click(secondary);
@@ -1028,7 +1028,7 @@ describe('ModalRenderer', () => {
render(
);
await flushGraceDelay();
- expect(screen.getByRole('dialog').className).toContain('rounded-2xl');
+ expect(screen.getByRole('dialog')).toHaveClass('rounded-[22px]');
expect(screen.getByText('Test Title')).toBeTruthy();
});
@@ -1047,7 +1047,7 @@ describe('ModalRenderer', () => {
render(
);
await flushGraceDelay();
- expect(screen.getByRole('dialog').className).toContain('rounded-2xl');
+ expect(screen.getByRole('dialog')).toHaveClass('rounded-[22px]');
await act(async () => {
mqChangeListeners.forEach(cb => cb({ matches: true } as MediaQueryListEvent));
diff --git a/client/src/components/Trips/TripFormModal.test.tsx b/client/src/components/Trips/TripFormModal.test.tsx
index 63ff66283..d279671a7 100644
--- a/client/src/components/Trips/TripFormModal.test.tsx
+++ b/client/src/components/Trips/TripFormModal.test.tsx
@@ -535,7 +535,7 @@ describe('TripFormModal', () => {
render(
);
// Store default is false, so the section starts as the disabled hint.
expect(screen.getByText(/Trip reminders are disabled/i)).toBeInTheDocument();
- await screen.findByRole('button', { name: 'Custom' });
+ await screen.findByRole('button', { name: 'Reminder' });
expect(useAuthStore.getState().tripRemindersEnabled).toBe(true);
});
diff --git a/client/src/components/Trips/TripTagField.tsx b/client/src/components/Trips/TripTagField.tsx
index ae3fc085d..4d48b0c6f 100644
--- a/client/src/components/Trips/TripTagField.tsx
+++ b/client/src/components/Trips/TripTagField.tsx
@@ -1,116 +1,143 @@
-import { MAX_TRIP_TAGS, TRIP_TAG_NAME_MAX, tripTagKey, uniqueTripTags } from '@trek/shared'
-import { Plus, X } from 'lucide-react'
-import { useCallback, useId, useRef, useState } from 'react'
-import { createPortal } from 'react-dom'
-import { useAnchoredPosition } from '../../hooks/useAnchoredPosition'
-import { useOverlay } from '../../hooks/overlayStack'
-import { useTranslation } from '../../i18n'
-import { tripRepo } from '../../repo/tripRepo'
-import { tripTagOptions } from './tripTags'
+import { MAX_TRIP_TAGS, TRIP_TAG_NAME_MAX, tripTagKey, uniqueTripTags } from '@trek/shared';
+import { Plus, X } from 'lucide-react';
+import { useCallback, useId, useRef, useState } from 'react';
+import { createPortal } from 'react-dom';
+import { useOverlay } from '../../hooks/overlayStack';
+import { useAnchoredPosition } from '../../hooks/useAnchoredPosition';
+import { useTranslation } from '../../i18n';
+import { tripRepo } from '../../repo/tripRepo';
+import { tripTagOptions } from './tripTags';
-const chip = 'inline-flex min-w-0 max-w-full items-center gap-1 rounded-full px-2.5 py-1 text-caption font-medium'
-const selectedFill = 'bg-[color:var(--m-act,var(--bg-inverse))] text-[color:var(--m-actfg,var(--text-inverse))]'
-const selectedChip = `${chip} ${selectedFill}`
+const chip = 'inline-flex min-w-0 max-w-full items-center gap-1 rounded-full px-2.5 py-1 text-caption font-medium';
+const selectedFill = 'bg-[color:var(--m-act,var(--bg-inverse))] text-[color:var(--m-actfg,var(--text-inverse))]';
+const selectedChip = `${chip} ${selectedFill}`;
-export function TripTagChips({ tags, className = '', chipClassName = selectedChip, limit = tags?.length ?? 0 }: {
- tags?: string[]
- className?: string
- chipClassName?: string
- limit?: number
+export function TripTagChips({
+ tags,
+ className = '',
+ chipClassName = selectedChip,
+ limit = tags?.length ?? 0,
+}: {
+ tags?: string[];
+ className?: string;
+ chipClassName?: string;
+ limit?: number;
}) {
- if (!tags?.length) return null
+ if (!tags?.length) return null;
return (
- {tags.slice(0, limit).map(tag => (
- {tag}
+ {tags.slice(0, limit).map((tag) => (
+
+
+ {tag}
+
+
))}
{tags.length > limit && +{tags.length - limit} }
- )
+ );
}
-export function TripTagField({ tags, draft, onChange, onDraftChange, readOnly, inputClass, labelClass, className = '' }: {
- tags: string[]
- draft: string
- onChange: (tags: string[]) => void
- onDraftChange: (draft: string) => void
- readOnly?: boolean
- inputClass: string
- labelClass: string
- className?: string
+function availableTags(options: string[], selected: Set
, query: string, unavailable: boolean) {
+ if (unavailable) return [];
+ return options.filter((tag) => !selected.has(tripTagKey(tag)) && tripTagKey(tag).includes(query)).slice(0, 6);
+}
+
+export function TripTagField({
+ tags,
+ draft,
+ onChange,
+ onDraftChange,
+ readOnly,
+ inputClass,
+ labelClass,
+ className = '',
+}: {
+ tags: string[];
+ draft: string;
+ onChange: (tags: string[]) => void;
+ onDraftChange: (draft: string) => void;
+ readOnly?: boolean;
+ inputClass: string;
+ labelClass: string;
+ className?: string;
}) {
- const { t, locale } = useTranslation()
- const id = useId()
- const menuId = `${id}-suggestions`
- const inputRef = useRef(null)
- const rowRef = useRef(null)
- const boundaryRef = useRef(null)
- const menuRef = useRef(null)
- const request = useRef | null>(null)
- const [active, setActive] = useState(false)
- const [highlighted, setHighlighted] = useState(-1)
- const [options, setOptions] = useState([])
- const selected = new Set(tags.map(tripTagKey))
- const draftKey = tripTagKey(draft)
- const atLimit = tags.length >= MAX_TRIP_TAGS
- const canAdd = !atLimit && draftKey.length > 0 && !selected.has(draftKey)
- const suggestions = !readOnly && !atLimit
- ? options.filter(tag => !selected.has(tripTagKey(tag)) && tripTagKey(tag).includes(draftKey)).slice(0, 6)
- : []
+ const { t, locale } = useTranslation();
+ const id = useId();
+ const menuId = `${id}-suggestions`;
+ const inputRef = useRef(null);
+ const rowRef = useRef(null);
+ const boundaryRef = useRef(null);
+ const menuRef = useRef(null);
+ const request = useRef | null>(null);
+ const [active, setActive] = useState(false);
+ const [highlighted, setHighlighted] = useState(-1);
+ const [options, setOptions] = useState([]);
+ const selected = new Set(tags.map(tripTagKey));
+ const draftKey = tripTagKey(draft);
+ const atLimit = tags.length >= MAX_TRIP_TAGS;
+ const canAdd = !atLimit && draftKey.length > 0 && !selected.has(draftKey);
+ const suggestions = availableTags(options, selected, draftKey, !!readOnly || atLimit);
const setAnchor = useCallback((row: HTMLDivElement | null) => {
- rowRef.current = row
- boundaryRef.current = row?.closest('.overflow-y-auto') ?? null
- }, [])
+ rowRef.current = row;
+ boundaryRef.current = row?.closest('.overflow-y-auto') ?? null;
+ }, []);
const closeMenu = useCallback(() => {
- setActive(false)
- setHighlighted(-1)
- }, [])
+ setActive(false);
+ setHighlighted(-1);
+ }, []);
const position = useAnchoredPosition(rowRef, active && suggestions.length > 0, {
estimatedHeight: 116,
boundary: { ref: boundaryRef, onAnchorHidden: closeMenu },
- })
- const menuOpen = active && suggestions.length > 0 && !!position
- const activeTag = menuOpen ? suggestions[highlighted] : undefined
- const { flipped, ...menuStyle } = position ?? { flipped: false }
- useOverlay(menuOpen, closeMenu, true)
+ });
+ const menuOpen = active && suggestions.length > 0 && !!position;
+ const activeTag = menuOpen ? suggestions[highlighted] : undefined;
+ const { flipped, ...menuStyle } = position ?? { flipped: false };
+ useOverlay(menuOpen, closeMenu, true);
const add = (name: string) => {
- if (atLimit || !tripTagKey(name)) return
- onChange(uniqueTripTags([...tags, name]))
- onDraftChange('')
- setHighlighted(-1)
- inputRef.current?.focus({ preventScroll: true })
- }
+ if (atLimit || !tripTagKey(name)) return;
+ onChange(uniqueTripTags([...tags, name]));
+ onDraftChange('');
+ setHighlighted(-1);
+ inputRef.current?.focus({ preventScroll: true });
+ };
if (readOnly) {
- if (!tags.length) return null
+ if (!tags.length) return null;
return (
{t('mobileJourney.tags')}
- )
+ );
}
return (
{
- if (event.relatedTarget !== inputRef.current && !menuRef.current?.contains(event.relatedTarget)) closeMenu()
+ onBlur={(event) => {
+ if (event.relatedTarget !== inputRef.current && !menuRef.current?.contains(event.relatedTarget)) closeMenu();
}}
>
- {atLimit
- ?
{t('mobileJourney.tags')}
- :
{t('mobileJourney.tags')} }
+ {atLimit ? (
+
{t('mobileJourney.tags')}
+ ) : (
+
+ {t('mobileJourney.tags')}
+
+ )}
{tags.length > 0 && (
- {tags.map(tag => (
-
- {tag}
+ {tags.map((tag) => (
+
+
+ {tag}
+
onChange(tags.filter(name => tripTagKey(name) !== tripTagKey(tag)))}
+ onClick={() => onChange(tags.filter((name) => tripTagKey(name) !== tripTagKey(tag)))}
className="grid size-8 shrink-0 place-items-center rounded-full hover:opacity-75 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-4 focus-visible:outline-current"
>
@@ -135,33 +162,40 @@ export function TripTagField({ tags, draft, onChange, onDraftChange, readOnly, i
aria-expanded={menuOpen}
aria-controls={menuOpen ? menuId : undefined}
aria-activedescendant={activeTag ? `${menuId}-${highlighted}` : undefined}
- onChange={event => {
- onDraftChange(event.target.value)
- setActive(true)
- setHighlighted(-1)
+ onChange={(event) => {
+ onDraftChange(event.target.value);
+ setActive(true);
+ setHighlighted(-1);
}}
onFocus={() => {
- setActive(true)
- request.current ??= tripRepo.list()
+ setActive(true);
+ request.current ??= tripRepo
+ .list()
.then(({ trips, archivedTrips }) => setOptions(tripTagOptions([...trips, ...archivedTrips], locale)))
- .catch(() => { request.current = null })
+ .catch(() => {
+ request.current = null;
+ });
}}
- onKeyDown={event => {
- if (event.nativeEvent.isComposing) return
+ onKeyDown={(event) => {
+ if (event.nativeEvent.isComposing) return;
if ((event.key === 'ArrowDown' || event.key === 'ArrowUp') && suggestions.length) {
- event.preventDefault()
- const backwards = event.key === 'ArrowUp'
- const last = suggestions.length - 1
+ event.preventDefault();
+ const backwards = event.key === 'ArrowUp';
+ const last = suggestions.length - 1;
const next = backwards
- ? highlighted <= 0 ? last : highlighted - 1
- : highlighted >= last ? 0 : highlighted + 1
- setActive(true)
- setHighlighted(next)
- menuRef.current?.children[next]?.scrollIntoView({ block: 'nearest' })
+ ? highlighted <= 0
+ ? last
+ : highlighted - 1
+ : highlighted >= last
+ ? 0
+ : highlighted + 1;
+ setActive(true);
+ setHighlighted(next);
+ menuRef.current?.children[next]?.scrollIntoView({ block: 'nearest' });
}
if (event.key === 'Enter' && (activeTag || draftKey)) {
- event.preventDefault()
- if (activeTag || canAdd) add(activeTag ?? draft)
+ event.preventDefault();
+ if (activeTag || canAdd) add(activeTag ?? draft);
}
}}
className={`min-w-0 flex-1 ${inputClass}`}
@@ -178,35 +212,39 @@ export function TripTagField({ tags, draft, onChange, onDraftChange, readOnly, i
)}
- {menuOpen && position && createPortal(
- ,
- document.body,
- )}
+ {menuOpen &&
+ position &&
+ createPortal(
+ ,
+ document.body
+ )}
- )
+ );
}
diff --git a/client/src/components/Trips/TripTagFilter.tsx b/client/src/components/Trips/TripTagFilter.tsx
index f4a29fbab..1d90f9ec6 100644
--- a/client/src/components/Trips/TripTagFilter.tsx
+++ b/client/src/components/Trips/TripTagFilter.tsx
@@ -1,31 +1,36 @@
-import { tripTagKey } from '@trek/shared'
-import { Tag } from 'lucide-react'
-import { useTranslation } from '../../i18n'
-import CustomSelect from '../shared/CustomSelect'
+import { tripTagKey } from '@trek/shared';
+import { Tag } from 'lucide-react';
+import { useTranslation } from '../../i18n';
+import CustomSelect from '../shared/CustomSelect';
-export default function TripTagFilter({ tags, selected, onChange, className = '' }: {
- tags: readonly string[]
- selected: string
- onChange: (value: string) => void
- className?: string
+export default function TripTagFilter({
+ tags,
+ selected,
+ onChange,
+ className = '',
+}: {
+ tags: readonly string[];
+ selected: string;
+ onChange: (value: string) => void;
+ className?: string;
}) {
- const { t } = useTranslation()
- if (!tags.length) return null
- const icon =
+ const { t } = useTranslation();
+ if (!tags.length) return null;
+ const icon = ;
return (
onChange(String(value))}
+ onChange={(value) => onChange(String(value))}
options={[
{ value: '', label: t('dashboard.tags.all'), icon },
- ...tags.map(tag => ({ value: tripTagKey(tag), label: tag, icon })),
+ ...tags.map((tag) => ({ value: tripTagKey(tag), label: tag, icon })),
]}
size="sm"
menuFit="content"
searchable={tags.length > 8}
/>
- )
+ );
}
diff --git a/client/src/components/Trips/tripTags.ts b/client/src/components/Trips/tripTags.ts
index 7649584fd..e4f75ffc5 100644
--- a/client/src/components/Trips/tripTags.ts
+++ b/client/src/components/Trips/tripTags.ts
@@ -1,12 +1,10 @@
-import { MAX_TRIP_TAGS, uniqueTripTags } from '@trek/shared'
+import { MAX_TRIP_TAGS, uniqueTripTags } from '@trek/shared';
export function tripTagOptions(trips: readonly { tags?: string[] }[], locale: string): string[] {
- return uniqueTripTags(trips.flatMap(trip => trip.tags ?? []))
- .sort((a, b) => a.localeCompare(b, locale))
+ return uniqueTripTags(trips.flatMap((trip) => trip.tags ?? [])).sort((a, b) => a.localeCompare(b, locale));
}
export function tripTagsToSave(tags: string[], draft: string, previous: string[] = []): { tags?: string[] } {
- const next = uniqueTripTags([...tags, draft]).slice(0, MAX_TRIP_TAGS)
- return next.length === previous.length && next.every((tag, index) => tag === previous[index])
- ? {} : { tags: next }
+ const next = uniqueTripTags([...tags, draft]).slice(0, MAX_TRIP_TAGS);
+ return next.length === previous.length && next.every((tag, index) => tag === previous[index]) ? {} : { tags: next };
}
diff --git a/client/src/components/shared/DialogShell.test.tsx b/client/src/components/shared/DialogShell.test.tsx
index 6dae0105a..d888fbc18 100644
--- a/client/src/components/shared/DialogShell.test.tsx
+++ b/client/src/components/shared/DialogShell.test.tsx
@@ -183,7 +183,7 @@ describe('body and footer parts', () => {
>,
);
expect(screen.getByText('Travelers')).toBeInTheDocument();
- expect(screen.getByText('Maria').closest('section')?.className).toBe('own');
+ expect(screen.getByText('Maria').closest('section')).toHaveClass('trek-dialog-section', 'own');
await userEvent.click(screen.getByRole('button', { name: 'Add' }));
expect(onAdd).toHaveBeenCalledTimes(1);
expect(screen.getAllByRole('button')).toHaveLength(1);
diff --git a/client/src/index.css b/client/src/index.css
index 39ae45f41..b7be17add 100644
--- a/client/src/index.css
+++ b/client/src/index.css
@@ -48,7 +48,6 @@ body { height: 100%; overflow: auto; overscroll-behavior: none; -webkit-overflow
pixels out of line — the one thing a column of nested cards cannot hide. */
.roadtrip-rail-scroll { scrollbar-width: none; -ms-overflow-style: none; }
.roadtrip-rail-scroll::-webkit-scrollbar { display: none; }
-.roadtrip-rail-scroll[data-fade-top] { mask-image: linear-gradient(to bottom, transparent, currentColor 18px); }
/* Journey video: let the player fill the box the lightbox gives it.
*
@@ -817,238 +816,6 @@ input[type="number"], input[type="time"], input[type="date"], input[type="dateti
--vg-hi: inset 0 1px 0 oklch(1 0 0 / .8);
}
-.trek-select-search { position: relative; padding: 6px 6px 2px; }
-.trek-select-search > svg { display: none; }
-.trek-dialog-section-icon { display: none; }
-
-/* The default desktop palette mirrors the matte surfaces of mobile sheets. */
-@media (min-width: 768px) and (min-height: 501px), (min-width: 768px) and (pointer: fine), (min-width: 768px) and (pointer: none) {
- html:not(.dark, [data-scheme], [data-native-app]) :where(.trek-modal-enter, [role="dialog"], [role="alertdialog"], .trek-select-menu, .trek-control-popover, .trek-desktop-panel) {
- --bg-card: #f7f7f7;
- --bg-secondary: #eeeeee;
- --bg-tertiary: #e9e9e9;
- --bg-input: #ffffff;
- --bg-hover: #e7e7e7;
- --bg-selected: #e4e4e4;
- --text-primary: #101013;
- --text-secondary: #353535;
- --text-muted: #595959;
- --text-faint: #666666;
- --border-primary: #dddddd;
- --border-secondary: #e5e5e5;
- --border-faint: #dedede;
- --accent: var(--text-primary);
- --accent-on: var(--accent);
- --accent-hover: #313131;
- --accent-subtle: var(--bg-secondary);
- --bg-inverse: var(--text-primary);
- --scrollbar-track: #f0f0f0;
- --scrollbar-thumb: #cccccc;
- --scrollbar-hover: #999999;
- }
-
- html.dark:not([data-scheme], [data-native-app]) :where(.trek-modal-enter, [role="dialog"], [role="alertdialog"], .trek-select-menu, .trek-control-popover, .trek-desktop-panel) {
- --bg-card: #181818;
- --bg-secondary: #222222;
- --bg-tertiary: #2a2a2a;
- --bg-input: #191919;
- --bg-hover: #2e2e2e;
- --bg-selected: #343434;
- --text-primary: #f5f5f5;
- --text-secondary: #dddddd;
- --text-muted: #bbbbbb;
- --text-faint: #aaaaaa;
- --border-primary: #393939;
- --border-secondary: #333333;
- --border-faint: #353535;
- --accent: var(--text-primary);
- --accent-on: var(--accent);
- --accent-hover: #dadada;
- --accent-subtle: var(--bg-secondary);
- --bg-inverse: var(--text-primary);
- --scrollbar-track: #202020;
- --scrollbar-thumb: #626262;
- --scrollbar-hover: #808080;
- }
-
- html:not([data-scheme], [data-native-app]) .trek-desktop-panel {
- --bg-card: var(--bg-input);
- --bg-tertiary: var(--bg-secondary);
- }
-
- html:not([data-native-app]) .trek-control-popover {
- --control-popover-radius: 14px;
- --context-menu-padding: 6px;
- --context-menu-item-radius: 8px;
- --context-menu-item-size: 13px;
- --context-menu-item-height: 36px;
- }
-
- html:not([data-native-app]) .trek-control-popover button:focus-visible {
- outline: 2px solid var(--text-muted);
- outline-offset: -2px;
- }
-
- html:not([data-native-app]) .trek-select-menu {
- --select-menu-radius: 14px;
- --select-option-radius: 8px;
- --select-option-padding: 7px 10px;
- --select-search-padding: 8px 10px;
- --select-search-size: 13px;
- --select-search-bg: var(--bg-input);
- --select-selected-bg: var(--bg-selected);
- padding: 6px;
- }
-
- html:not([data-native-app]) .trek-select-menu .trek-select-search {
- --select-search-padding: 8px 10px 8px 32px;
- padding: 0 0 6px;
- }
-
- html:not([data-native-app]) .trek-select-menu .trek-select-search > svg {
- position: absolute;
- inset-inline-start: 10px;
- top: 10px;
- display: block;
- color: var(--text-muted);
- pointer-events: none;
- }
-
- html:not([data-native-app]) .trek-select-menu .trek-select-search input { padding-inline: 32px 10px; }
- html:not([data-native-app]) .trek-select-menu .trek-select-search input::placeholder { color: var(--text-faint); }
- html:not([data-native-app]) .trek-select-menu .trek-select-options {
- border-radius: 10px;
- background: var(--bg-input);
- scrollbar-gutter: stable;
- }
- html:not([data-native-app]) .trek-select-menu [data-select-option] { min-height: 36px; }
- html:not([data-native-app]) .trek-select-menu [data-select-option][aria-pressed="true"] { font-weight: 600; }
- html:not([data-native-app]) .trek-select-menu :is(input, [data-select-option]):focus-visible {
- box-shadow: inset 0 0 0 1px var(--text-muted);
- }
-
- html:not([data-native-app]) :where(.trek-modal-enter, [role="dialog"], [role="alertdialog"], .trek-tour-panel, .trek-place-inspector-body) :is(.trek-dialog-field-label, .trek-dialog-section-label) {
- color: var(--text-primary);
- font-family: inherit;
- font-size: calc(12px * var(--fs-scale-body, 1));
- font-weight: 500;
- letter-spacing: normal;
- text-transform: none;
- }
-
- html:not([data-native-app]) :where(.trek-modal-enter, [role="dialog"], .trek-tour-panel) :is(.trek-form-control, [data-field-trigger]) {
- min-height: var(--form-control-min-height, 40px);
- font-size: calc(13px * var(--fs-scale-body, 1));
- }
-
- html:not([data-native-app]) :where(.trek-modal-enter, [role="dialog"]) .trek-form-chip {
- min-height: 34px;
- padding-block: 0;
- font-size: calc(12px * var(--fs-scale-body, 1));
- }
-
- html:not([data-native-app]) :where(.trek-modal-enter, [role="dialog"]) .trek-form-square {
- width: 40px;
- height: 40px;
- }
-
- html:not([data-native-app]) :where(.trek-modal-enter, [role="dialog"], [role="alertdialog"], .trek-dialog-footer, .trek-tour-panel) [data-dialog-action] {
- min-height: 40px;
- padding-inline: 16px;
- border-radius: 999px;
- font-weight: 600;
- }
-
- .trek-tour-panel .font-geist { font-family: inherit; }
- .trek-tour-panel .trek-tour-rail-head { align-items: center; }
- .trek-tour-panel .trek-tour-rail-title h2 {
- font-weight: 600;
- letter-spacing: normal;
- }
- .trek-tour-panel .trek-tour-rail-title { padding-block-start: 0; }
- .trek-tour-panel .trek-tour-card { background: var(--bg-secondary); }
- .trek-tour-panel .trek-tour-card-heading { border-bottom-color: var(--border-faint); }
- .trek-tour-panel .trek-tour-card-icon {
- width: 28px;
- height: 28px;
- border-radius: 9px;
- background: var(--bg-input);
- }
- .trek-tour-panel .trek-tour-icon-action,
- .trek-tour-panel .trek-tour-editor-toolbar > button,
- .trek-tour-panel .trek-tour-retry {
- border-radius: 999px;
- background: var(--bg-input);
- color: var(--text-muted);
- }
- .trek-tour-panel .trek-tour-icon-action:enabled:hover,
- .trek-tour-panel .trek-tour-editor-toolbar > button:enabled:hover,
- .trek-tour-panel .trek-tour-retry:hover {
- background: var(--bg-hover);
- color: var(--text-primary);
- }
- .trek-tour-panel .trek-tour-count {
- display: grid;
- min-width: 24px;
- min-height: 24px;
- place-items: center;
- padding-inline: 5px;
- border-radius: 999px;
- background: var(--bg-input);
- }
- .trek-tour-panel .trek-tour-waypoints {
- margin-inline: 0;
- padding: 4px;
- border-radius: 12px;
- background: var(--bg-input);
- }
-
- html:not([data-native-app]) .trek-dialog-footer [data-dialog-icon-action] {
- width: 40px;
- height: 40px;
- }
-
- html:not([data-native-app]) .trek-dialog-footer > [data-dialog-action="secondary"] {
- background: var(--bg-secondary);
- box-shadow: none;
- }
-
- html:not([data-native-app]) .trek-dialog-footer > [data-dialog-action="secondary"]:hover {
- background: var(--bg-tertiary);
- }
-
- html:not([data-native-app]) :where(.trek-modal-enter, [role="dialog"], .trek-place-inspector-body) .trek-dialog-section {
- min-width: 0;
- padding: 12px;
- border: 1px solid var(--border-faint);
- border-radius: 14px;
- background: var(--bg-secondary);
- }
-
- html:not([data-native-app]) :where(.trek-modal-enter, [role="dialog"], .trek-place-inspector-body) .trek-dialog-section-head[data-section-icon] {
- min-height: 32px;
- height: auto;
- gap: 8px;
- flex-wrap: wrap;
- }
-
- html:not([data-native-app]) :where(.trek-modal-enter, [role="dialog"], .trek-place-inspector-body) .trek-dialog-section-head[data-section-icon] .trek-dialog-section-icon {
- display: grid;
- width: 32px;
- height: 32px;
- flex: none;
- place-items: center;
- border-radius: 10px;
- background: var(--bg-input);
- color: var(--text-muted);
- }
-
- html:not([data-native-app]) :where(.trek-modal-enter, [role="dialog"], .trek-place-inspector-body) .trek-dialog-section-head[data-section-icon] .trek-dialog-section-label {
- font-size: calc(14px * var(--fs-scale-body, 1));
- font-weight: 600;
- }
-}
-
@media (max-width: 767px), (pointer: coarse) and (max-height: 500px) {
:root { --bottom-nav-h: calc(84px + env(safe-area-inset-bottom, 0px)); }
}
diff --git a/client/src/main.tsx b/client/src/main.tsx
index 2031ff903..9306bd130 100644
--- a/client/src/main.tsx
+++ b/client/src/main.tsx
@@ -25,6 +25,7 @@ import '@fontsource/geist-sans/600.css'
// several .leaflet-* styles.
import 'leaflet/dist/leaflet.css'
import './index.css'
+import './styles/desktop-controls.css'
import './styles/leafletCanvas.css'
import './native/nativeApp.css'
import './styles/rtl.css'
diff --git a/client/src/mobile/screens/dashboard/MDashboard.tsx b/client/src/mobile/screens/dashboard/MDashboard.tsx
index c123dedb4..ff964f38d 100644
--- a/client/src/mobile/screens/dashboard/MDashboard.tsx
+++ b/client/src/mobile/screens/dashboard/MDashboard.tsx
@@ -46,6 +46,17 @@ interface CardAction {
* data hook — every mutation runs through the same store/hook actions the
* desktop page uses.
*/
+function tripTagActions(t: ReturnType['t'], tagOptions: string[], selectedTag: string, setTripTagFilter: (tag: string) => void): CardAction[] {
+ return [
+ { key: '', label: t('dashboard.tags.all') },
+ ...tagOptions.map(tag => ({ key: tripTagKey(tag), label: tag })),
+ ].map(({ key, label }) => ({
+ key, label, icon: key === selectedTag ? : ,
+ pressed: key === selectedTag,
+ onClick: () => setTripTagFilter(key),
+ }))
+}
+
export default function MDashboard(): React.ReactElement {
const {
demoMode, locale, t, navigate,
@@ -129,14 +140,7 @@ export default function MDashboard(): React.ReactElement {
icon: , onClick: () => setSubOpen(true),
},
]
- const tagFilterActions = [
- { key: '', label: t('dashboard.tags.all') },
- ...tagOptions.map(tag => ({ key: tripTagKey(tag), label: tag })),
- ].map(({ key, label }) => ({
- key, label, icon: key === selectedTag ? : ,
- pressed: key === selectedTag,
- onClick: () => setTripTagFilter(key),
- }))
+ const tagFilterActions = tripTagActions(t, tagOptions, selectedTag, setTripTagFilter)
// One dashboard block by token: 'trips' is the filter row + trip list; the
// rest are the inline widgets (rendered only when their toggle is on).
diff --git a/client/src/pages/admin/AdminUsersTab.tsx b/client/src/pages/admin/AdminUsersTab.tsx
index 6a65898ff..2ea621781 100644
--- a/client/src/pages/admin/AdminUsersTab.tsx
+++ b/client/src/pages/admin/AdminUsersTab.tsx
@@ -212,7 +212,7 @@ export default function AdminUsersTab({ admin, t, locale }: AdminUsersTabProps):
setShowCreateInvite(false)}>{t('common.cancel')}
- }>
+ void handleCreateInvite()} icon={ }>
{t('admin.invite.createAndCopy')}
diff --git a/client/src/styles/desktop-controls.css b/client/src/styles/desktop-controls.css
new file mode 100644
index 000000000..c890e1cac
--- /dev/null
+++ b/client/src/styles/desktop-controls.css
@@ -0,0 +1,294 @@
+.roadtrip-rail-scroll[data-fade-top] {
+ mask-image: linear-gradient(to bottom, transparent, currentColor 18px);
+}
+
+.trek-select-search {
+ position: relative;
+ padding: 6px 6px 2px;
+}
+.trek-select-search > svg {
+ display: none;
+}
+.trek-dialog-section-icon {
+ display: none;
+}
+
+/* The default desktop palette mirrors the matte surfaces of mobile sheets. */
+@media (min-width: 768px) and (min-height: 501px),
+ (min-width: 768px) and (pointer: fine),
+ (min-width: 768px) and (pointer: none) {
+ html:not(.dark, [data-scheme], [data-native-app])
+ :where(
+ .trek-modal-enter,
+ [role='dialog'],
+ [role='alertdialog'],
+ .trek-select-menu,
+ .trek-control-popover,
+ .trek-desktop-panel
+ ) {
+ --bg-card: #f7f7f7;
+ --bg-secondary: #eeeeee;
+ --bg-tertiary: #e9e9e9;
+ --bg-input: #ffffff;
+ --bg-hover: #e7e7e7;
+ --bg-selected: #e4e4e4;
+ --text-primary: #101013;
+ --text-secondary: #353535;
+ --text-muted: #595959;
+ --text-faint: #666666;
+ --border-primary: #dddddd;
+ --border-secondary: #e5e5e5;
+ --border-faint: #dedede;
+ --accent: var(--text-primary);
+ --accent-on: var(--accent);
+ --accent-hover: #313131;
+ --accent-subtle: var(--bg-secondary);
+ --bg-inverse: var(--text-primary);
+ --scrollbar-track: #f0f0f0;
+ --scrollbar-thumb: #cccccc;
+ --scrollbar-hover: #999999;
+ }
+
+ html.dark:not([data-scheme], [data-native-app])
+ :where(
+ .trek-modal-enter,
+ [role='dialog'],
+ [role='alertdialog'],
+ .trek-select-menu,
+ .trek-control-popover,
+ .trek-desktop-panel
+ ) {
+ --bg-card: #181818;
+ --bg-secondary: #222222;
+ --bg-tertiary: #2a2a2a;
+ --bg-input: #191919;
+ --bg-hover: #2e2e2e;
+ --bg-selected: #343434;
+ --text-primary: #f5f5f5;
+ --text-secondary: #dddddd;
+ --text-muted: #bbbbbb;
+ --text-faint: #aaaaaa;
+ --border-primary: #393939;
+ --border-secondary: #333333;
+ --border-faint: #353535;
+ --accent: var(--text-primary);
+ --accent-on: var(--accent);
+ --accent-hover: #dadada;
+ --accent-subtle: var(--bg-secondary);
+ --bg-inverse: var(--text-primary);
+ --scrollbar-track: #202020;
+ --scrollbar-thumb: #626262;
+ --scrollbar-hover: #808080;
+ }
+
+ html:not([data-scheme], [data-native-app]) .trek-desktop-panel {
+ --bg-card: var(--bg-input);
+ --bg-tertiary: var(--bg-secondary);
+ }
+
+ html:not([data-native-app]) .trek-control-popover {
+ --control-popover-radius: 14px;
+ --context-menu-padding: 6px;
+ --context-menu-item-radius: 8px;
+ --context-menu-item-size: 13px;
+ --context-menu-item-height: 36px;
+ }
+
+ html:not([data-native-app]) .trek-control-popover button:focus-visible {
+ outline: 2px solid var(--text-muted);
+ outline-offset: -2px;
+ }
+
+ html:not([data-native-app]) .trek-select-menu {
+ --select-menu-radius: 14px;
+ --select-option-radius: 8px;
+ --select-option-padding: 7px 10px;
+ --select-search-padding: 8px 10px;
+ --select-search-size: 13px;
+ --select-search-bg: var(--bg-input);
+ --select-selected-bg: var(--bg-selected);
+ padding: 6px;
+ }
+
+ html:not([data-native-app]) .trek-select-menu .trek-select-search {
+ --select-search-padding: 8px 10px 8px 32px;
+ padding: 0 0 6px;
+ }
+
+ html:not([data-native-app]) .trek-select-menu .trek-select-search > svg {
+ position: absolute;
+ inset-inline-start: 10px;
+ top: 10px;
+ display: block;
+ color: var(--text-muted);
+ pointer-events: none;
+ }
+
+ html:not([data-native-app]) .trek-select-menu .trek-select-search input {
+ padding-inline: 32px 10px;
+ }
+ html:not([data-native-app]) .trek-select-menu .trek-select-search input::placeholder {
+ color: var(--text-faint);
+ }
+ html:not([data-native-app]) .trek-select-menu .trek-select-options {
+ border-radius: 10px;
+ background: var(--bg-input);
+ scrollbar-gutter: stable;
+ }
+ html:not([data-native-app]) .trek-select-menu [data-select-option] {
+ min-height: 36px;
+ }
+ html:not([data-native-app]) .trek-select-menu [data-select-option][aria-pressed='true'] {
+ font-weight: 600;
+ }
+ html:not([data-native-app]) .trek-select-menu :is(input, [data-select-option]):focus-visible {
+ box-shadow: inset 0 0 0 1px var(--text-muted);
+ }
+
+ html:not([data-native-app])
+ :where(.trek-modal-enter, [role='dialog'], [role='alertdialog'], .trek-tour-panel, .trek-place-inspector-body)
+ :is(.trek-dialog-field-label, .trek-dialog-section-label) {
+ color: var(--text-primary);
+ font-family: inherit;
+ font-size: calc(12px * var(--fs-scale-body, 1));
+ font-weight: 500;
+ letter-spacing: normal;
+ text-transform: none;
+ }
+
+ html:not([data-native-app])
+ :where(.trek-modal-enter, [role='dialog'], .trek-tour-panel)
+ :is(.trek-form-control, [data-field-trigger]) {
+ min-height: var(--form-control-min-height, 40px);
+ font-size: calc(13px * var(--fs-scale-body, 1));
+ }
+
+ html:not([data-native-app]) :where(.trek-modal-enter, [role='dialog']) .trek-form-chip {
+ min-height: 34px;
+ padding-block: 0;
+ font-size: calc(12px * var(--fs-scale-body, 1));
+ }
+
+ html:not([data-native-app]) :where(.trek-modal-enter, [role='dialog']) .trek-form-square {
+ width: 40px;
+ height: 40px;
+ }
+
+ html:not([data-native-app])
+ :where(.trek-modal-enter, [role='dialog'], [role='alertdialog'], .trek-dialog-footer, .trek-tour-panel)
+ [data-dialog-action] {
+ min-height: 40px;
+ padding-inline: 16px;
+ border-radius: 999px;
+ font-weight: 600;
+ }
+
+ .trek-tour-panel .font-geist {
+ font-family: inherit;
+ }
+ .trek-tour-panel .trek-tour-rail-head {
+ align-items: center;
+ }
+ .trek-tour-panel .trek-tour-rail-title h2 {
+ font-weight: 600;
+ letter-spacing: normal;
+ }
+ .trek-tour-panel .trek-tour-rail-title {
+ padding-block-start: 0;
+ }
+ .trek-tour-panel .trek-tour-card {
+ background: var(--bg-secondary);
+ }
+ .trek-tour-panel .trek-tour-card-heading {
+ border-bottom-color: var(--border-faint);
+ }
+ .trek-tour-panel .trek-tour-card-icon {
+ width: 28px;
+ height: 28px;
+ border-radius: 9px;
+ background: var(--bg-input);
+ }
+ .trek-tour-panel .trek-tour-icon-action,
+ .trek-tour-panel .trek-tour-editor-toolbar > button,
+ .trek-tour-panel .trek-tour-retry {
+ border-radius: 999px;
+ background: var(--bg-input);
+ color: var(--text-muted);
+ }
+ .trek-tour-panel .trek-tour-icon-action:enabled:hover,
+ .trek-tour-panel .trek-tour-editor-toolbar > button:enabled:hover,
+ .trek-tour-panel .trek-tour-retry:hover {
+ background: var(--bg-hover);
+ color: var(--text-primary);
+ }
+ .trek-tour-panel .trek-tour-count {
+ display: grid;
+ min-width: 24px;
+ min-height: 24px;
+ place-items: center;
+ padding-inline: 5px;
+ border-radius: 999px;
+ background: var(--bg-input);
+ }
+ .trek-tour-panel .trek-tour-waypoints {
+ margin-inline: 0;
+ padding: 4px;
+ border-radius: 12px;
+ background: var(--bg-input);
+ }
+
+ html:not([data-native-app]) .trek-dialog-footer [data-dialog-icon-action] {
+ width: 40px;
+ height: 40px;
+ }
+
+ html:not([data-native-app]) .trek-dialog-footer > [data-dialog-action='secondary'] {
+ background: var(--bg-secondary);
+ box-shadow: none;
+ }
+
+ html:not([data-native-app]) .trek-dialog-footer > [data-dialog-action='secondary']:hover {
+ background: var(--bg-tertiary);
+ }
+
+ html:not([data-native-app])
+ :where(.trek-modal-enter, [role='dialog'], .trek-place-inspector-body)
+ .trek-dialog-section {
+ min-width: 0;
+ padding: 12px;
+ border: 1px solid var(--border-faint);
+ border-radius: 14px;
+ background: var(--bg-secondary);
+ }
+
+ html:not([data-native-app])
+ :where(.trek-modal-enter, [role='dialog'], .trek-place-inspector-body)
+ .trek-dialog-section-head[data-section-icon] {
+ min-height: 32px;
+ height: auto;
+ gap: 8px;
+ flex-wrap: wrap;
+ }
+
+ html:not([data-native-app])
+ :where(.trek-modal-enter, [role='dialog'], .trek-place-inspector-body)
+ .trek-dialog-section-head[data-section-icon]
+ .trek-dialog-section-icon {
+ display: grid;
+ width: 32px;
+ height: 32px;
+ flex: none;
+ place-items: center;
+ border-radius: 10px;
+ background: var(--bg-input);
+ color: var(--text-muted);
+ }
+
+ html:not([data-native-app])
+ :where(.trek-modal-enter, [role='dialog'], .trek-place-inspector-body)
+ .trek-dialog-section-head[data-section-icon]
+ .trek-dialog-section-label {
+ font-size: calc(14px * var(--fs-scale-body, 1));
+ font-weight: 600;
+ }
+}
diff --git a/client/tests/unit/mobile/dashboard/MDashboard.test.tsx b/client/tests/unit/mobile/dashboard/MDashboard.test.tsx
index 9dc1a033d..8f06f1e9b 100644
--- a/client/tests/unit/mobile/dashboard/MDashboard.test.tsx
+++ b/client/tests/unit/mobile/dashboard/MDashboard.test.tsx
@@ -60,6 +60,9 @@ function buildDash(over: Record = {}): Record
loadError: false,
retryLoad: vi.fn(),
tripFilter: 'planned',
+ tagOptions: [],
+ selectedTag: '',
+ setTripTagFilter: vi.fn(),
setTripFilter: vi.fn(),
viewMode: 'grid',
toggleViewMode: vi.fn(),
diff --git a/plugin-sdk/src/generated/host-facts.ts b/plugin-sdk/src/generated/host-facts.ts
index 297c9dd4d..32e9ec8c4 100644
--- a/plugin-sdk/src/generated/host-facts.ts
+++ b/plugin-sdk/src/generated/host-facts.ts
@@ -442,6 +442,7 @@ export const PLUGIN_ENTITY_FIELDS = {
'is_owner',
'owner_username',
'shared_count',
+ 'tags',
],
place: [
'id',
diff --git a/server/src/db/entities/Trips.entity.ts b/server/src/db/entities/Trips.entity.ts
index 40cb93c2c..985b6760f 100644
--- a/server/src/db/entities/Trips.entity.ts
+++ b/server/src/db/entities/Trips.entity.ts
@@ -54,7 +54,6 @@ export class Trips {
user_id!: number;
title!: string;
description?: string | null;
- tags_json?: string | null;
start_date?: string | null;
end_date?: string | null;
currency?: string | null = 'EUR';
@@ -66,6 +65,7 @@ export class Trips {
updated_at?: string | null;
reminder_sent_for?: string | null;
costs_mode: TTripsCostsMode & Opt = TripsCostsMode.SPLIT;
+ tags_json?: string | null;
assistant_attachments_collection = new Collection(this);
assistant_threads_collection = new Collection(this);
budget_category_order_collection = new Collection(this);
@@ -136,7 +136,6 @@ export const TripsSchema = defineEntity({
user_id: p.integer().persist(false).index('idx_trips_user_id'),
title: p.text(),
description: p.text().nullable(),
- tags_json: p.text().nullable(),
start_date: p.text().nullable(),
end_date: p.text().nullable(),
currency: p.text().nullable(),
@@ -148,6 +147,7 @@ export const TripsSchema = defineEntity({
updated_at: p.type(DbTimestampType).nullable().defaultRaw(`CURRENT_TIMESTAMP`),
reminder_sent_for: p.text().nullable(),
costs_mode: p.enum(() => TripsCostsMode).default('split'),
+ tags_json: p.text().nullable(),
assistant_attachments_collection: () => p.oneToMany(AssistantAttachments).mappedBy('trip').hidden(),
assistant_threads_collection: () => p.oneToMany(AssistantThreads).mappedBy('trip').hidden(),
budget_category_order_collection: () => p.oneToMany(BudgetCategoryOrder).mappedBy('trip').hidden(),
diff --git a/server/src/db/migrations/Migration20200101046650_trips_can_carry_custom_tags.ts b/server/src/db/migrations/Migration20200101046650_trips_can_carry_custom_tags.ts
index 326a9a81a..5534c42cd 100644
--- a/server/src/db/migrations/Migration20200101046650_trips_can_carry_custom_tags.ts
+++ b/server/src/db/migrations/Migration20200101046650_trips_can_carry_custom_tags.ts
@@ -1,5 +1,5 @@
-import { Migration } from '@mikro-orm/migrations';
import { engineDdl } from '../migration-utils';
+import { Migration } from '@mikro-orm/migrations';
export class Migration20200101046650_trips_can_carry_custom_tags extends Migration {
override name = 'Migration20200101046650_trips_can_carry_custom_tags';
diff --git a/server/src/nest/plugins/protocol/output-contract.ts b/server/src/nest/plugins/protocol/output-contract.ts
index ee92103a0..8f062f7e8 100644
--- a/server/src/nest/plugins/protocol/output-contract.ts
+++ b/server/src/nest/plugins/protocol/output-contract.ts
@@ -67,10 +67,10 @@ export const PLUGIN_ENTITY_CONTRACT = {
'reminder_sent_for',
'costs_mode',
],
- // The sole credential of the anonymous calendar feed.
- withheld: ['feed_token'],
+ // Keep the calendar credential and internal tag serialization out of the plugin API.
+ withheld: ['feed_token', 'tags_json'],
wholeRow: true,
- derived: ['day_count', 'place_count', 'is_owner', 'owner_username', 'shared_count'],
+ derived: ['day_count', 'place_count', 'is_owner', 'owner_username', 'shared_count', 'tags'],
},
place: {
table: 'places',
diff --git a/server/src/nest/trips/trips.helpers.ts b/server/src/nest/trips/trips.helpers.ts
index 5fe0c7a26..2d9dfc234 100644
--- a/server/src/nest/trips/trips.helpers.ts
+++ b/server/src/nest/trips/trips.helpers.ts
@@ -35,7 +35,16 @@ export function withoutFeedToken(row: T): T {
}
/** The fields of a trip update that count as an edit, as against archiving it or changing its cover. */
-const TRIP_EDIT_FIELDS = ['title', 'description', 'tags', 'start_date', 'end_date', 'currency', 'reminder_days', 'day_count'];
+const TRIP_EDIT_FIELDS = [
+ 'title',
+ 'description',
+ 'tags',
+ 'start_date',
+ 'end_date',
+ 'currency',
+ 'reminder_days',
+ 'day_count',
+];
/**
* The permissions a trip update needs, in the order PUT /api/trips/:id checks
diff --git a/server/src/nest/trips/trips.mcp.ts b/server/src/nest/trips/trips.mcp.ts
index 9a5edb357..11c0934ad 100644
--- a/server/src/nest/trips/trips.mcp.ts
+++ b/server/src/nest/trips/trips.mcp.ts
@@ -262,9 +262,21 @@ export class TripsMcp {
costs_mode: tripUpdateRequestSchema.shape.costs_mode.describe(
'How the trip keeps its costs: split (who paid and who shares each expense, with settling up) or totals (what the trip costs, nothing split). Who paid and the shares stay stored either way. Needs the budget_edit permission rather than trip_edit',
),
- tags: tripTagNamesSchema.optional().describe('Replace all custom tags on the trip. Send an empty array to clear them. Cannot be combined with add_tags or remove_tags'),
- add_tags: tripTagNamesSchema.optional().describe('Assign existing or new custom tags to the trip, keeping its other tags. Tag names are matched case-insensitively'),
- remove_tags: tripTagNamesSchema.optional().describe('Remove these custom tags from this trip only. Other tags stay assigned. Removals apply before additions'),
+ tags: tripTagNamesSchema
+ .optional()
+ .describe(
+ 'Replace all custom tags on the trip. Send an empty array to clear them. Cannot be combined with add_tags or remove_tags',
+ ),
+ add_tags: tripTagNamesSchema
+ .optional()
+ .describe(
+ 'Assign existing or new custom tags to the trip, keeping its other tags. Tag names are matched case-insensitively',
+ ),
+ remove_tags: tripTagNamesSchema
+ .optional()
+ .describe(
+ 'Remove these custom tags from this trip only. Other tags stay assigned. Removals apply before additions',
+ ),
},
annotations: TOOL_ANNOTATIONS_WRITE,
access: { group: 'trips', mode: 'write' },
@@ -329,7 +341,9 @@ export class TripsMcp {
};
// The rights PUT /api/trips/:id asks for, field by field: archiving, the cover and the costs mode have their own.
const granted = await Promise.all(
- tripUpdatePermissions({ ...fields, tags: tags ?? add_tags ?? remove_tags }).map(({ action }) => this.guards.hasTripPermission(action, tripId, ctx.userId)),
+ tripUpdatePermissions({ ...fields, tags: tags ?? add_tags ?? remove_tags }).map(({ action }) =>
+ this.guards.hasTripPermission(action, tripId, ctx.userId),
+ ),
);
if (granted.includes(false)) return permissionDenied();
if (tags !== undefined && (add_tags !== undefined || remove_tags !== undefined))
@@ -425,7 +439,9 @@ export class TripsMcp {
const notice = ctx.getDeprecationNotice ? ctx.getDeprecationNotice() : null;
const accessible = await this.trips.list(ctx.userId, include_archived ? null : 0);
const tagKey = tag ? tripTagKey(tag) : null;
- const trips = tagKey ? accessible.filter(trip => trip.tags?.some(name => tripTagKey(name) === tagKey)) : accessible;
+ const trips = tagKey
+ ? accessible.filter((trip) => trip.tags?.some((name) => tripTagKey(name) === tagKey))
+ : accessible;
if (notice)
return {
isError: true as const,
diff --git a/server/tests/unit/db/legacy-baseline.test.ts b/server/tests/unit/db/legacy-baseline.test.ts
index 9b99f0164..92246d9c7 100644
--- a/server/tests/unit/db/legacy-baseline.test.ts
+++ b/server/tests/unit/db/legacy-baseline.test.ts
@@ -130,6 +130,7 @@ const UNNUMBERED = [
'Migration20200101046620_a_journey_link_can_ask_for_a_password_and_run_out',
'Migration20200101046630_a_journey_gathers_comments_and_followers',
'Migration20200101046640_bahrain_flights_keep_bahrain_time',
+ 'Migration20200101046650_trips_can_carry_custom_tags',
];
// The last step the positional runner ever had; planLegacyBaseline refuses a
// schema_version past it.
diff --git a/server/tests/unit/db/repositories/Reservations.repository.test.ts b/server/tests/unit/db/repositories/Reservations.repository.test.ts
index 14eaa6bef..74729a62f 100644
--- a/server/tests/unit/db/repositories/Reservations.repository.test.ts
+++ b/server/tests/unit/db/repositories/Reservations.repository.test.ts
@@ -98,7 +98,9 @@ describe('ReservationsRepository — CL1 (findRaw, existing method reused by cal
// test-sql-allow: the legacy statement is the oracle the repository read is held to.
const legacy = testDb.prepare('SELECT * FROM trips WHERE id = ?').get(trip.id);
- expect(typed).toEqual(legacy);
+ const { tags_json, ...tripFields } = legacy as Record;
+ expect(tags_json).toBeNull();
+ expect(typed).toEqual({ ...tripFields, tags: [] });
});
});
diff --git a/server/tests/unit/db/repositories/Trips.repository.test.ts b/server/tests/unit/db/repositories/Trips.repository.test.ts
index fab7b5aec..95f345183 100644
--- a/server/tests/unit/db/repositories/Trips.repository.test.ts
+++ b/server/tests/unit/db/repositories/Trips.repository.test.ts
@@ -13,6 +13,10 @@ import type { EntityData } from '@mikro-orm/core';
import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest';
+function expectedTrip({ tags_json, ...fields }: Record) {
+ return { ...fields, tags: typeof tags_json === 'string' ? JSON.parse(tags_json) : [] };
+}
+
const testDb = createSnapshotTestDb();
let t: TestOrm;
let trips: TripsRepository;
@@ -238,7 +242,7 @@ describe('TripsRepository — TripMembersService / TripReadModelService (Plan 3c
// test-sql-allow: the legacy statement is the oracle the repository read is held to.
const legacyRow = testDb.prepare('SELECT * FROM trips WHERE id = ?').get(trip.id);
const row = await trips.findRaw(trip.id);
- expect(row).toEqual(legacyRow);
+ expect(row).toEqual(expectedTrip(legacyRow as Record));
expect(row?.feed_token).toBe('secret-token');
});
@@ -329,7 +333,7 @@ describe('TripsRepository.findForViewer / listForUser / activeTrip (Plan 3c Task
)
.get({ userId: owner.id, tripId: trip.id });
const row = await trips.findForViewer(trip.id, owner.id);
- expect(row).toEqual(legacyOwner);
+ expect(row).toEqual(expectedTrip(legacyOwner as Record));
// createTrip's own start_date/end_date span already generates 5 days;
// the two explicit createDay calls above add 2 more, for 7 total.
expect(row).toMatchObject({
@@ -356,7 +360,7 @@ describe('TripsRepository.findForViewer / listForUser / activeTrip (Plan 3c Task
)
.get({ userId: member.id, tripId: trip.id });
const memberRow = await trips.findForViewer(trip.id, member.id);
- expect(memberRow).toEqual(legacyMember);
+ expect(memberRow).toEqual(expectedTrip(legacyMember as Record));
expect(memberRow).toMatchObject({ is_owner: 0, day_count: 7, place_count: 3, shared_count: 1 });
});
@@ -376,7 +380,7 @@ describe('TripsRepository.findForViewer / listForUser / activeTrip (Plan 3c Task
)
.get({ userId: owner.id, tripId: trip.id });
const row = await trips.findForViewer(trip.id, owner.id);
- expect(row).toEqual(legacy);
+ expect(row).toEqual(expectedTrip(legacy as Record));
expect(row).toMatchObject({
description: null,
start_date: null,
@@ -429,7 +433,7 @@ describe('TripsRepository.findForViewer / listForUser / activeTrip (Plan 3c Task
)
.all({ userId: owner.id });
const rows = await trips.listForUser(owner.id, null);
- expect(rows).toEqual(legacy);
+ expect(rows).toEqual(legacy.map(row => expectedTrip(row as Record)));
expect(rows.map((r) => r.id).sort()).toEqual([owned.id, shared.id, archived.id].sort());
});
@@ -450,7 +454,7 @@ describe('TripsRepository.findForViewer / listForUser / activeTrip (Plan 3c Task
`,
)
.all({ userId: owner.id, archived: 1 });
- expect(await trips.listForUser(owner.id, 1)).toEqual(legacyArchived);
+ expect(await trips.listForUser(owner.id, 1)).toEqual(legacyArchived.map(row => expectedTrip(row as Record)));
expect((await trips.listForUser(owner.id, 1)).map((r) => r.id)).toEqual([archived.id]);
expect((await trips.listForUser(owner.id, 0)).map((r) => r.id)).toEqual([active.id]);
});
@@ -1082,7 +1086,7 @@ describe('TripsRepository.listOwnedOrMember — AT1 parity with the legacy state
const legacy = testDb.prepare(LEGACY_OWNED_OR_MEMBER).all(caller.id, caller.id, caller.id);
const rows = await trips.listOwnedOrMember(caller.id);
- expect(rows).toEqual(legacy);
+ expect(rows).toEqual(legacy.map(row => expectedTrip(row as Record)));
expect(rows.map((r) => r.id)).toEqual([memberOf.id, owned.id]);
});
diff --git a/server/tests/unit/mcp/tools-trips.test.ts b/server/tests/unit/mcp/tools-trips.test.ts
index decbffb90..9c643123f 100644
--- a/server/tests/unit/mcp/tools-trips.test.ts
+++ b/server/tests/unit/mcp/tools-trips.test.ts
@@ -308,9 +308,13 @@ describe('Tool: update_trip', () => {
arguments: { tripId: trip.id, remove_tags: ['work'], add_tags: [' FAMILY ', 'City break'] },
});
expect(parseToolResult(result)).toMatchObject({ trip: { title: 'Weekend', tags: ['Family', 'City break'] } });
- expect(broadcastMock).toHaveBeenCalledWith(trip.id, 'trip:updated', expect.objectContaining({
- trip: expect.objectContaining({ tags: ['Family', 'City break'] }),
- }));
+ expect(broadcastMock).toHaveBeenCalledWith(
+ trip.id,
+ 'trip:updated',
+ expect.objectContaining({
+ trip: expect.objectContaining({ tags: ['Family', 'City break'] }),
+ }),
+ );
});
});