diff --git a/client/src/mobile/screens/dashboard/MDashWidgets.tsx b/client/src/mobile/screens/dashboard/MDashWidgets.tsx index 73aaa8132..0521170b7 100644 --- a/client/src/mobile/screens/dashboard/MDashWidgets.tsx +++ b/client/src/mobile/screens/dashboard/MDashWidgets.tsx @@ -278,7 +278,7 @@ function MUpcomingWidget({ items }: { items: UpcomingReservation[] }): React.Rea navigate(`/trips/${tripId}`) } - const subFor = (r: UpcomingReservation): string => { + const subFor = (r: UpcomingReservation): string[] => { const parsed = splitReservationDateTime(r.reservation_time) const datePart = parsed.date || r.day_date || null const date = datePart ? new Date(datePart + 'T00:00:00Z') : null @@ -287,7 +287,8 @@ function MUpcomingWidget({ items }: { items: UpcomingReservation[] }): React.Rea : null const timeStr = parsed.time ? formatTime(parsed.time, locale, timeFormat) : null const tail = MOMENT_LABEL[r.type] ? t(MOMENT_LABEL[r.type]) : (r.location || r.place_name || r.trip_title || null) - return [dateStr, timeStr, tail].filter(Boolean).join(' · ') + // Each part a badge of its own instead of one line strung together with dots. + return [dateStr, timeStr, tail].filter((part): part is string => !!part) } return ( @@ -302,19 +303,24 @@ function MUpcomingWidget({ items }: { items: UpcomingReservation[] }): React.Rea onClick={() => openReservation(r.trip_id)} className="flex w-full items-center gap-[11px] border-b border-[color:var(--m-rowbr)] py-[9px] text-start" > - + {RES_ICON[r.type] || } + {/* Pending: the status's first letter on a dot at the icon's corner, the word for screen readers. */} + {r.status === 'pending' && ( + + {t('reservations.pending').charAt(0).toUpperCase()} + + )}
{r.title} - {r.status === 'pending' && ( - - {t('reservations.pending')} - - )}
-
{subFor(r)}
+
+ {subFor(r).map(part => ( + {part} + ))} +
diff --git a/client/src/pages/DashboardPage.desktop.test.tsx b/client/src/pages/DashboardPage.desktop.test.tsx index 33b347987..0b2b691f8 100644 --- a/client/src/pages/DashboardPage.desktop.test.tsx +++ b/client/src/pages/DashboardPage.desktop.test.tsx @@ -205,7 +205,10 @@ describe('DashboardPage (desktop)', () => { // Only the unconfirmed one is marked. const pending = container.querySelectorAll('.upc-pending'); expect(pending).toHaveLength(1); - expect(pending[0]).toHaveTextContent('Pending'); + // A letter on the type icon's corner, the word as its name and tooltip. + expect(pending[0]).toHaveTextContent(/^P$/); + expect(pending[0]).toHaveAttribute('aria-label', 'Pending'); + expect(pending[0].closest('.upc-type')).not.toBeNull(); }); it('FE-PAGE-DESKDASH-009: the currency tool converts and swaps the pair', async () => { diff --git a/client/src/pages/DashboardPage.tsx b/client/src/pages/DashboardPage.tsx index 13ec201f8..3e50d1ec3 100644 --- a/client/src/pages/DashboardPage.tsx +++ b/client/src/pages/DashboardPage.tsx @@ -769,14 +769,22 @@ function UpcomingTool({ items, locale, onOpen }: {
{r.title} - {r.status === 'pending' && {t('reservations.pending')}}
- {timeStr && <> {timeStr} · } - {moment ? t(moment) : (r.location || r.place_name || r.trip_title)} + {timeStr && {timeStr}} + {(moment || r.location || r.place_name || r.trip_title) && ( + {moment ? t(moment) : (r.location || r.place_name || r.trip_title)} + )}
-
{RES_ICON[r.type] || }
+
+ {RES_ICON[r.type] || } + {r.status === 'pending' && ( + + {t('reservations.pending').charAt(0).toUpperCase()} + + )} +
) })} diff --git a/client/src/styles/dashboard.css b/client/src/styles/dashboard.css index 526066dec..c58327040 100644 --- a/client/src/styles/dashboard.css +++ b/client/src/styles/dashboard.css @@ -650,10 +650,15 @@ .trek-dash .upc-info .t { font-size: 14px; font-weight: 500; margin-bottom: 2px; } .trek-dash .upc-info .t { display: flex; align-items: center; gap: 7px; } /* An unconfirmed booking looked exactly like a confirmed one here (#1934). */ -.trek-dash .upc-pending { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; padding: 2px 6px; border-radius: 999px; background: var(--bg-2); color: var(--ink-3); } -.trek-dash .upc-info .s { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; } +/* A pending booking: its status's first letter on a dot at the type icon's corner, the word as its tooltip. */ +.trek-dash .upc-pending { position: absolute; top: -5px; inset-inline-start: -5px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; font-weight: 700; line-height: 1; background: var(--ink); color: var(--surface); box-shadow: 0 0 0 2px var(--surface); } +.trek-dash .upc-info .s { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; margin-top: 3px; min-width: 0; } +.trek-dash .upc-info .s .upc-chip:first-child { flex-shrink: 0; } +.trek-dash .upc-info .s .upc-chip { min-width: 0; } +/* The time and the where as soft badges instead of a line strung together with dots. */ +.trek-dash .upc-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 8px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); font-size: 11.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .trek-dash .upc-info .s svg { width: 11px; height: 11px; } -.trek-dash .upc-type { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; } +.trek-dash .upc-type { position: relative; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; } .trek-dash .upc-type.flight { background: oklch(0.95 0.04 230); color: oklch(0.45 0.13 230); } .trek-dash .upc-type.hotel { background: oklch(0.95 0.04 145); color: oklch(0.4 0.12 155); } .trek-dash .upc-type.food { background: oklch(0.95 0.05 60); color: oklch(0.5 0.13 50); } diff --git a/client/tests/unit/mobile/dashboard/MDashWidgets.test.tsx b/client/tests/unit/mobile/dashboard/MDashWidgets.test.tsx index 723e74ad6..170907dc4 100644 --- a/client/tests/unit/mobile/dashboard/MDashWidgets.test.tsx +++ b/client/tests/unit/mobile/dashboard/MDashWidgets.test.tsx @@ -398,7 +398,10 @@ describe('MUpcomingWidget', () => { />, ); - expect(screen.getByText('Sep 3 · 19:30 · Narita')).toBeInTheDocument(); + // Date, time and place as badges of their own, no dots strung between them. + expect(screen.getByText('Sep 3')).toBeInTheDocument(); + expect(screen.getByText('19:30')).toBeInTheDocument(); + expect(screen.getByText('Narita')).toBeInTheDocument(); }); it('FE-MOB-DWID-030: an unparseable date degrades to the remaining parts', () => { @@ -449,6 +452,8 @@ describe('MUpcomingWidget', () => { />, ); - expect(screen.getAllByText('Pending')).toHaveLength(1); + // A letter on the icon's corner, with the word as its accessible name. + expect(screen.getAllByLabelText('Pending')).toHaveLength(1); + expect(screen.getByLabelText('Pending')).toHaveTextContent(/^P$/); }); });