mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 16:33:16 +00:00
feat(planner): bring the plan tab and every trip dialog into the new look
The Plan tab was the last trip tab still in the old design. It now reads like Bookings, Costs, Lists, Files and Collab, without losing a function: - Day plan: each day is a card with a head band (day tile with weather, stay and rental pills, a "+" menu for place, stay, transport, transit and note), rows with "..." menus, white badges and a white route bar. - Places column: add, search and filters in three rows, a show dropdown, category and rating filters, and a selection bar at the foot. - Place inspector, day details and the stay editor on the shared dialog frame; the place form in the editor look with the name in the head band. - Clicking a booking or transport anywhere on the plan opens the booking detail popup first; Edit leads to the editor. The popup is one host shared with the Bookings and Transports tabs. - Files and Collab dialogs, notes, polls, links and chat moved to the same frame; shared DialogShell and dialogParts hold the building blocks. - The map hover card shows the place photo and follows the theme. Every new and reworded string is translated into all locales, and a few older English leftovers (help center, cost split, import hints) with them. Phone screens keep their own look.
This commit is contained in:
@@ -77,10 +77,10 @@ beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
// The booking type is one dropdown now (BookingTypeSelect): open it from the
|
||||
// field under the "Booking Type" label, then pick the option from its menu.
|
||||
// The booking type is a pill in the dialog's head band, named "Booking Type: <type>":
|
||||
// open it, then pick the option from its menu.
|
||||
function typeField(): HTMLButtonElement {
|
||||
return screen.getByText('Booking Type').parentElement!.querySelector('button') as HTMLButtonElement;
|
||||
return screen.getByRole('button', { name: /^Booking Type:/ }) as HTMLButtonElement;
|
||||
}
|
||||
async function pickType(name: RegExp) {
|
||||
await userEvent.click(typeField());
|
||||
@@ -133,8 +133,8 @@ describe('ReservationModal', () => {
|
||||
expect(screen.getByRole('button', { name: /^Event$/i })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: /^Tour$/i })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: /^Parking$/i })).toBeInTheDocument();
|
||||
// The field itself and its option both read "Other".
|
||||
expect(screen.getAllByRole('button', { name: /^Other$/i })).toHaveLength(2);
|
||||
// The pill reads "Booking Type: Other", so only its option is named plain "Other".
|
||||
expect(screen.getAllByRole('button', { name: /^Other$/i })).toHaveLength(1);
|
||||
expect(screen.queryByRole('button', { name: /^Flight$/i })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole('button', { name: /^Train$/i })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole('button', { name: /^Car$/i })).not.toBeInTheDocument();
|
||||
@@ -704,7 +704,7 @@ describe('ReservationModal', () => {
|
||||
it('FE-PLANNER-RESMODAL-046: other type renders and saves correctly', async () => {
|
||||
const onSave = vi.fn().mockResolvedValue(undefined);
|
||||
render(<ReservationModal {...defaultProps} onSave={onSave} />);
|
||||
await userEvent.click(screen.getByRole('button', { name: /^Other$/i }));
|
||||
await pickType(/^Other$/i);
|
||||
await userEvent.type(screen.getByPlaceholderText(/e\.g\. Lufthansa/i), 'Misc item');
|
||||
await userEvent.click(screen.getByRole('button', { name: /^Add$/i }));
|
||||
await waitFor(() => expect(onSave).toHaveBeenCalledWith(expect.objectContaining({ type: 'other' })));
|
||||
@@ -1503,8 +1503,8 @@ describe('ReservationModal', () => {
|
||||
render(<ReservationModal {...defaultProps} onSave={onSave} />);
|
||||
|
||||
await userEvent.type(screen.getByPlaceholderText(/e\.g\. Lufthansa/i), 'Boat trip');
|
||||
await userEvent.click(screen.getByText('Pending'));
|
||||
await userEvent.click(screen.getByRole('button', { name: 'Confirmed' }));
|
||||
// The status pill in the head band flips pending to confirmed.
|
||||
await userEvent.click(screen.getByRole('button', { name: 'Set to Confirmed' }));
|
||||
await userEvent.click(screen.getByRole('button', { name: /^Add$/i }));
|
||||
|
||||
await waitFor(() => expect(onSave).toHaveBeenCalled());
|
||||
|
||||
Reference in New Issue
Block a user