mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 08:30:05 +00:00
fix(mobile): share the bookings tabs' sections, and fit two tests to the sheets they test
Both bookings tabs built the same status sections; listSections in the shared filter hook now does it once. The photo sort test looks for the sheet in the document, as the sheet is portalled to the body, and the saved place test expects the notes the sheet now sends.
This commit is contained in:
@@ -1,7 +1,20 @@
|
||||
import { useState } from 'react';
|
||||
|
||||
import type { Day, Reservation } from '../../../types';
|
||||
import { groupTransports, onTravelers } from './bookingsModel';
|
||||
import { groupTransports, onTravelers, type StatusGroups } from './bookingsModel';
|
||||
|
||||
/**
|
||||
* The status sections both tabs list, in their order, leaving out the empty ones.
|
||||
* Bookings never fill `transit`, so that section only ever shows among transports.
|
||||
*/
|
||||
export function listSections(groups: StatusGroups, t: (key: string) => string) {
|
||||
return [
|
||||
{ id: 'confirmed', label: t('reservations.confirmed'), rows: groups.confirmed },
|
||||
{ id: 'pending', label: t('reservations.pending'), rows: groups.pending },
|
||||
{ id: 'transit', label: t('reservations.type.transit'), rows: groups.transit },
|
||||
{ id: 'past', label: t('reservations.past'), rows: groups.past },
|
||||
].filter((s) => s.rows.length > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* The traveller filter and the folded sections of the phone's bookings and
|
||||
|
||||
Reference in New Issue
Block a user