mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 13:10:29 +00:00
fix(mobile): forms on the shared form sheet, and the details the review found
Expense, payment, booking, transport, day note, place edit, new trip, journey entry, collab note, poll, task, packing item and packing import use the form sheet: one header with its icon tile, a body that scrolls with a fade, the footer, and full height with the actions beside the title on a short window. Create New Trip loses its nested section cards. Details: - Add payment gets its icon tile and the currency inside the amount field. - The expense's category field has the same fill as every other field. - Day and date fields keep their year at phone width; From and To stack in a narrow form. - The place sheet's category chip sits under the name, uncut, the photo on the cards' leading edge, labels in the sheets' small capitals. - Stars no longer keep a hover preview after a tap. - A hotel booking shows its stay's check-in and check-out when it has none of its own, instead of the grey hint reading as a saved time. - The collab note's title field is labelled Title (common.title). - Shorter airport hint in German and Russian; long hints end in an ellipsis. - The journey story grows with its lines (useAutoGrow). - Member avatars show the member's initial, yours too, and turn over on a selected chip. - The trip's More sheet scrolls, dims a short window and is marked in the dock while open; long titles wrap to two lines.
This commit is contained in:
@@ -112,6 +112,46 @@ describe('reservation form fields', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('FE-PLANNER-RESFORM-017: a hotel booking without its own times shows the ones its stay keeps', () => {
|
||||
// The stay's check-in and check-out live on the accommodation; a booking that
|
||||
// never had them written into its own metadata showed the "15:00" hint as if
|
||||
// it were the saved time.
|
||||
const acc = {
|
||||
id: 9,
|
||||
place_id: 4,
|
||||
start_day_id: 2,
|
||||
end_day_id: 3,
|
||||
check_in: '15:00',
|
||||
check_in_end: '22:00',
|
||||
check_out: '11:00',
|
||||
} as Accommodation;
|
||||
const res = buildReservation({
|
||||
type: 'hotel',
|
||||
accommodation_id: 9,
|
||||
metadata: JSON.stringify({ price: '2184' }),
|
||||
} as Partial<Reservation>);
|
||||
expect(reservationFieldsFrom(res, [acc], [], false)).toMatchObject({
|
||||
meta_check_in_time: '15:00',
|
||||
meta_check_out_time: '11:00',
|
||||
});
|
||||
expect(reservationFieldsFrom(res, [acc], [], true)).toMatchObject({ meta_check_in_end_time: '22:00' });
|
||||
// The booking's own times still win.
|
||||
const own = buildReservation({
|
||||
type: 'hotel',
|
||||
accommodation_id: 9,
|
||||
metadata: JSON.stringify({ check_in_time: '14:00', check_out_time: '10:00' }),
|
||||
} as Partial<Reservation>);
|
||||
expect(reservationFieldsFrom(own, [acc], [], false)).toMatchObject({
|
||||
meta_check_in_time: '14:00',
|
||||
meta_check_out_time: '10:00',
|
||||
});
|
||||
// Nothing anywhere stays empty, so the hint shows as a hint.
|
||||
expect(reservationFieldsFrom(buildReservation({ type: 'hotel' }), [], [], false)).toMatchObject({
|
||||
meta_check_in_time: '',
|
||||
meta_check_out_time: '',
|
||||
});
|
||||
});
|
||||
|
||||
it('FE-PLANNER-RESFORM-004: an import under review resolves its stay days and keeps its source details', () => {
|
||||
const pf = {
|
||||
title: 'Inn',
|
||||
|
||||
@@ -97,9 +97,13 @@ export function reservationFieldsFrom(
|
||||
url: res.url || '',
|
||||
place_id: res.place_id || '',
|
||||
accommodation_id: res.accommodation_id || '',
|
||||
meta_check_in_time: meta.check_in_time || '',
|
||||
...(withCheckInEnd ? { meta_check_in_end_time: meta.check_in_end_time || '' } : {}),
|
||||
meta_check_out_time: meta.check_out_time || '',
|
||||
// The stay's own times when the booking carries none: a hotel booked before
|
||||
// the times were written on it, or whose stay was edited from the plan,
|
||||
// keeps them on the accommodation, and the empty field showed the
|
||||
// "15:00" hint as if it were the saved check-in.
|
||||
meta_check_in_time: meta.check_in_time || acc?.check_in || '',
|
||||
...(withCheckInEnd ? { meta_check_in_end_time: meta.check_in_end_time || acc?.check_in_end || '' } : {}),
|
||||
meta_check_out_time: meta.check_out_time || acc?.check_out || '',
|
||||
hotel_place_id: acc?.place_id || '',
|
||||
hotel_start_day: acc?.start_day_id || '',
|
||||
hotel_end_day: acc?.end_day_id || '',
|
||||
|
||||
@@ -70,13 +70,23 @@ describe('Stars', () => {
|
||||
const filled = () => Array.from(container.querySelectorAll('span > span')).filter(o => (o as HTMLElement).style.width).length
|
||||
|
||||
expect(filled()).toBe(1)
|
||||
fireEvent.mouseEnter(screen.getByRole('radio', { name: '4' }))
|
||||
fireEvent.pointerEnter(screen.getByRole('radio', { name: '4' }), { pointerType: 'mouse' })
|
||||
expect(filled()).toBe(4)
|
||||
|
||||
fireEvent.mouseLeave(container.querySelector('[role="radiogroup"]')!)
|
||||
fireEvent.pointerLeave(container.querySelector('[role="radiogroup"]')!, { pointerType: 'mouse' })
|
||||
expect(filled()).toBe(1)
|
||||
})
|
||||
|
||||
it('FE-W4STAR-016: a finger previews nothing, so a tap cannot leave the stars filled', () => {
|
||||
// A tap fires an enter with no leave after it: the preview used to stick,
|
||||
// and an unrated place showed five full stars beside "Not rated yet".
|
||||
const { container } = render(<Stars value={0} onRate={() => {}} />)
|
||||
const filled = () => Array.from(container.querySelectorAll('span > span')).filter(o => (o as HTMLElement).style.width).length
|
||||
|
||||
fireEvent.pointerEnter(screen.getByRole('radio', { name: '5' }), { pointerType: 'touch' })
|
||||
expect(filled()).toBe(0)
|
||||
})
|
||||
|
||||
it('FE-W4STAR-008: focus previews and blur clears the preview', () => {
|
||||
const { container } = render(<Stars value={0} onRate={() => {}} />)
|
||||
const filled = () => Array.from(container.querySelectorAll('span > span')).filter(o => (o as HTMLElement).style.width).length
|
||||
|
||||
@@ -29,7 +29,7 @@ export function Stars({ value, size = 15, onRate, myRating = null, ariaLabel }:
|
||||
role={onRate ? 'radiogroup' : undefined}
|
||||
aria-label={ariaLabel}
|
||||
style={{ display: 'inline-flex', gap: 2, cursor: onRate ? 'pointer' : 'default' }}
|
||||
onMouseLeave={() => setHover(null)}
|
||||
onPointerLeave={() => setHover(null)}
|
||||
>
|
||||
{[1, 2, 3, 4, 5].map(i => {
|
||||
// Fractional fill for averages: full below, empty above, clipped between.
|
||||
@@ -52,7 +52,11 @@ export function Stars({ value, size = 15, onRate, myRating = null, ariaLabel }:
|
||||
role="radio"
|
||||
aria-checked={myRating === i}
|
||||
aria-label={`${i}`}
|
||||
onMouseEnter={() => setHover(i)}
|
||||
// A preview for a pointer that hovers (a mouse, a trackpad, a pen held
|
||||
// above the screen). A finger has no hover: the enter it fires on a
|
||||
// tap has no leave after it, so the preview stuck and an unrated
|
||||
// place showed five full stars beside "Not rated yet".
|
||||
onPointerEnter={e => { if (e.pointerType !== 'touch') setHover(i) }}
|
||||
onFocus={() => setHover(i)}
|
||||
onBlur={() => setHover(null)}
|
||||
onClick={() => onRate(myRating === i ? null : i)}
|
||||
|
||||
Reference in New Issue
Block a user