mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 21:11:14 +00:00
feat(mobile): icon-only action rows in the transport and booking sheets (#2585)
The transport sheet's row wrapped once a ticket and the wallet were there. Its actions are icons now, named by their labels, and the attachments sit in their own rows with a download, like the transports list. The wallet is a black circle, beside the close button in the booking editor. A failed download on the phone now says so.
This commit is contained in:
@@ -85,6 +85,14 @@ describe('useReservationCard', () => {
|
||||
expect(openFile).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('FE-PLANNER-RESLISTFILTER-008b: a download that fails says so with a toast', async () => {
|
||||
vi.mocked(downloadFile).mockRejectedValueOnce(new Error('offline'));
|
||||
const opts = host();
|
||||
const { result } = renderHook(() => useReservationCard(ann, opts));
|
||||
result.current.downloadFile(file);
|
||||
await vi.waitFor(() => expect(opts.toast.error).toHaveBeenCalledWith('files.downloadError'));
|
||||
});
|
||||
|
||||
it('FE-PLANNER-RESLISTFILTER-009: the card knows whether deleting it takes a linked expense along (#2604)', () => {
|
||||
resetAllStores();
|
||||
seedStore(useTripStore, { budgetItems: [buildBudgetItem({ id: 1, reservation_id: 10 } as never)] });
|
||||
|
||||
@@ -19,9 +19,10 @@ export interface ReservationCardHost {
|
||||
* opening: its booking code blurred until tapped while the "Blur booking codes"
|
||||
* preference is on (off, the code is plain and has no toggle), the delete
|
||||
* behind a question with a toast when it fails, and its attached files, which
|
||||
* open or download from their own row. A file that cannot be opened or saved
|
||||
* stays silent here; the desktop panel toasts it. The delete question names a
|
||||
* linked expense, which goes with the booking.
|
||||
* open or download from their own row. A download that fails says so with a
|
||||
* toast, since a save button that does nothing reads as broken; opening stays
|
||||
* silent as it always was. The delete question names a linked expense, which
|
||||
* goes with the booking.
|
||||
*/
|
||||
export function useReservationCard(res: Reservation, host: ReservationCardHost) {
|
||||
const blurCodes = host.settings.blur_booking_codes;
|
||||
@@ -45,6 +46,6 @@ export function useReservationCard(res: Reservation, host: ReservationCardHost)
|
||||
void confirmDelete();
|
||||
},
|
||||
openFile: (f: Attachment) => openAttachment(f),
|
||||
downloadFile: (f: Attachment) => downloadAttachment(f),
|
||||
downloadFile: (f: Attachment) => downloadAttachment(f, () => host.toast.error(host.t('files.downloadError'))),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user