mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 03:26:07 +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:
@@ -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