Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(mobile): booking status toggle as tall as the fields, with status dots

Maurice69d88ffefd23
diff --git a/client/src/mobile/screens/trip/sheets/MBookingFields.test.tsx b/client/src/mobile/screens/trip/sheets/MBookingFields.test.tsx
index 29a31b17b..3b5534bb1 100644
--- a/client/src/mobile/screens/trip/sheets/MBookingFields.test.tsx
+++ b/client/src/mobile/screens/trip/sheets/MBookingFields.test.tsx
@@ -35,15 +35,15 @@ describe('MBookingCodeStatus', () => {
fireEvent.change(input, { target: { value: 'XYZ9' } });
expect(onCodeChange).toHaveBeenCalledWith('XYZ9');
- fireEvent.click(screen.getByRole('button', { name: 'reservations.confirmed' }));
+ fireEvent.click(screen.getByRole('radio', { name: 'reservations.confirmed' }));
expect(onStatusChange).toHaveBeenCalledWith('confirmed');
});
it('FE-COMP-MBOOKINGFIELDS-002: marks the current status as the active segment', () => {
render(<MBookingCodeStatus t={t} code="" onCodeChange={vi.fn()} status="confirmed" onStatusChange={vi.fn()} />);
- expect(screen.getByRole('button', { name: 'reservations.confirmed' }).className).toContain('bg-m-act');
- expect(screen.getByRole('button', { name: 'reservations.pending' }).className).toContain('text-m-muted');
+ expect(screen.getByRole('radio', { name: 'reservations.confirmed' }).className).toContain('bg-m-act');
+ expect(screen.getByRole('radio', { name: 'reservations.pending' }).className).toContain('text-m-muted');
});
});
diff --git a/client/src/mobile/screens/trip/sheets/MBookingFields.tsx b/client/src/mobile/screens/trip/sheets/MBookingFields.tsx
index aabf41e9a..471ee7661 100644
--- a/client/src/mobile/screens/trip/sheets/MBookingFields.tsx
+++ b/client/src/mobile/screens/trip/sheets/MBookingFields.tsx
@@ -32,11 +32,15 @@ interface MBookingCodeStatusProps {
onStatusChange: (status: BookingStatus) => void;
}
-/** Booking code and the pending / confirmed toggle, side by side. */
+/**
+ * Booking code and the pending / confirmed toggle, one under the other: side
+ * by side the two words did not fit half a phone's width once each carried its
+ * status dot.
+ */
export function MBookingCodeStatus({ t, code, onCodeChange, status, onStatusChange }: MBookingCodeStatusProps) {
return (
- <div className="mt-3 flex gap-2">
- <div className="min-w-0 flex-1">
+ <div className="mt-3 flex flex-col gap-3">
+ <div className="min-w-0">
<Eyebrow className="mb-[5px] uppercase">{t('reservations.confirmationCode')}</Eyebrow>
<BookingCodeInput
value={code}
@@ -45,19 +49,31 @@ export function MBookingCodeStatus({ t, code, onCodeChange, status, onStatusChan
className={FIELD_CLS}
/>
</div>
- <div className="min-w-0 flex-1">
+ <div className="min-w-0">
<Eyebrow className="mb-[5px] uppercase">{t('reservations.status')}</Eyebrow>
- <div className="flex rounded-full bg-[color:var(--m-ic)] p-[3px]">
+ {/* As tall as the code field beside it, the status colour in each option's dot. */}
+ <div
+ role="radiogroup"
+ aria-label={t('reservations.status')}
+ className="flex h-[42px] rounded-full border border-[color:var(--m-rowbr)] bg-[color:var(--m-ic)] p-[3px]"
+ >
{(['pending', 'confirmed'] as const).map((s) => (
<button
key={s}
type="button"
+ role="radio"
+ aria-checked={status === s}
onClick={() => onStatusChange(s)}
- className={`flex-1 rounded-full py-[7px] text-[0.71875rem] font-semibold ${
+ className={`flex min-w-0 flex-1 items-center justify-center gap-1.5 rounded-full px-2 text-[length:calc(12px*var(--fs-scale-body,1))] font-semibold transition-colors ${
status === s ? 'bg-m-act text-m-actfg' : 'text-m-muted'
}`}
>
- {t(`reservations.${s}`)}
+ <span
+ aria-hidden="true"
+ className="h-[7px] w-[7px] flex-none rounded-full"
+ style={{ background: s === 'confirmed' ? 'var(--m-st-confirmed)' : 'var(--m-st-pending)' }}
+ />
+ <span className="truncate">{t(`reservations.${s}`)}</span>
</button>
))}
</div>