diff --git a/client/src/pages/sharedTrip/SharedChrome.tsx b/client/src/pages/sharedTrip/SharedChrome.tsx index d619eade6..4d3a3c42a 100644 --- a/client/src/pages/sharedTrip/SharedChrome.tsx +++ b/client/src/pages/sharedTrip/SharedChrome.tsx @@ -80,9 +80,9 @@ export function SharedHero({ trip, stats }: HeroProps) { {dates} )} -

{trip.title}

+

{trip.title}

{trip.description && ( -

{trip.description}

// theme-lint-disable: white type over a photo +

{trip.description}

// theme-lint-disable: white type over a photo )} {stats.length > 0 && (
diff --git a/client/src/pages/sharedTrip/SharedDayCard.test.tsx b/client/src/pages/sharedTrip/SharedDayCard.test.tsx new file mode 100644 index 000000000..3f0a3285c --- /dev/null +++ b/client/src/pages/sharedTrip/SharedDayCard.test.tsx @@ -0,0 +1,49 @@ +import { describe, expect, it, vi } from 'vitest'; + +import { render, screen } from '../../../tests/helpers/render'; +import { SharedDayCard, type SharedDayCardProps } from './SharedDayCard'; + +/** FE-PAGE-SHARED-DAY-001: a day note's detail line on a shared trip wraps inside its card (#3082). */ + +const LONG_DETAIL = + 'Lorem Ipsum is simply dummy text of the printing and typesetting industry, https://example.com/a/very/long/unbroken/path/that/never/stops'; + +function renderDay(note: { id: number; text: string; time: string | null }) { + const props: SharedDayCardProps = { + day: { id: 9, title: 'Day One', date: '2026-07-02', day_number: 1 }, + index: 0, + selected: false, + collapsed: false, + onSelect: vi.fn(), + onToggleCollapse: vi.fn(), + items: [{ type: 'note', sortKey: 0, data: note }], + stays: [], + placeCount: 0, + stopNumber: {}, + categories: [], + }; + return render(); +} + +describe('SharedDayCard', () => { + it('FE-PAGE-SHARED-DAY-001: a long note detail wraps in its row instead of running out of a nowrap pill', () => { + renderDay({ id: 1, text: 'Test', time: LONG_DETAIL }); + + const detail = screen.getByTestId('shared-note-detail'); + expect(detail).toHaveTextContent(LONG_DETAIL); + expect(detail.className).toContain('[overflow-wrap:anywhere]'); + expect(detail.className).toContain('min-w-0'); + // Nothing between the text and the row may forbid wrapping. + let el: HTMLElement | null = screen.getByText(/Lorem Ipsum/); + for (; el && el !== document.body; el = el.parentElement) { + expect(el.className).not.toMatch(/whitespace-nowrap/); + } + }); + + it('FE-PAGE-SHARED-DAY-001: a leading HH:MM stays a time pill and the rest becomes the wrapping detail', () => { + renderDay({ id: 2, text: 'Museum', time: '08:30 meet at the north entrance' }); + + expect(screen.getByText('08:30')).toBeInTheDocument(); + expect(screen.getByTestId('shared-note-detail')).toHaveTextContent('meet at the north entrance'); + }); +}); diff --git a/client/src/pages/sharedTrip/SharedDayCard.tsx b/client/src/pages/sharedTrip/SharedDayCard.tsx index 334290d25..dc83326a8 100644 --- a/client/src/pages/sharedTrip/SharedDayCard.tsx +++ b/client/src/pages/sharedTrip/SharedDayCard.tsx @@ -7,6 +7,8 @@ import { TypeTile } from '../../components/Planner/bookings/bookingParts' import { typeInfo } from '../../components/Planner/bookings/bookingsModel' import { getNoteIcon } from '../../components/Planner/DayPlanSidebar.constants' import { noteSurface } from '../../components/Planner/noteSurface' +import { SafeMarkdown } from '../../components/shared/SafeMarkdown' +import { splitNoteTime } from '../../mobile/screens/trip/lib/dayNotes' import { useTranslation } from '../../i18n' import { useSettingsStore } from '../../store/settingsStore' import { getDisplayTimeForDay, getSpanPhase, type MergedItem } from '../../utils/dayMerge' @@ -160,7 +162,7 @@ export function PlaceRow({ place, notes, number, category }: PlaceRowProps) {
- {place.name} + {place.name} {time && {time}}
@@ -197,9 +199,16 @@ function TransportRow({ r, dayId }: { r: SharedTransport; dayId: number }) { ) } +/** + * A day note. Its `time` column is not a time but the note's free detail line + * (#3082): only a leading HH:MM is a real time and gets the pill, the rest is + * the owner's text and wraps under the title, rendered as the planner renders it. + * In a pill, which never wraps, a sentence ran off the edge of the card. + */ function NoteRow({ note }: { note: { id: number; text: string; time?: string | null; icon?: string | null; color?: string | null } }) { const skin = noteSurface(note.color) const Icon = getNoteIcon(note.icon) + const { time, detail } = splitNoteTime(note.time) return (
@@ -207,7 +216,16 @@ function NoteRow({ note }: { note: { id: number; text: string; time?: string | n
{note.text}
- {note.time &&
{note.time}
} + {(time || detail) && ( +
+ {time && {time}} + {detail && ( +
+ {detail} +
+ )} +
+ )}
) diff --git a/client/src/pages/sharedTrip/SharedListsViews.tsx b/client/src/pages/sharedTrip/SharedListsViews.tsx index b1043d0f8..ba7499f46 100644 --- a/client/src/pages/sharedTrip/SharedListsViews.tsx +++ b/client/src/pages/sharedTrip/SharedListsViews.tsx @@ -56,7 +56,7 @@ export function SharedPackingView({ items }: { items: PackingItem[] }) { {item.checked ? : } - {item.name} + {item.name} {(item.quantity ?? 1) > 1 && ×{item.quantity}} ))} @@ -149,7 +149,7 @@ export function SharedCostsView({ items, base, tripCurrency, convert }: CostsPro return (
  • -
    {item.name}
    +
    {item.name}
    {entered &&
    {entered}
    }
    {!!item.total_price && {money(valueOf(item))}}