diff --git a/client/src/components/Planner/PlaceDetailsColumn.test.tsx b/client/src/components/Planner/PlaceDetailsColumn.test.tsx index b0d576b7b..180732589 100644 --- a/client/src/components/Planner/PlaceDetailsColumn.test.tsx +++ b/client/src/components/Planner/PlaceDetailsColumn.test.tsx @@ -480,11 +480,11 @@ describe('PlaceDetailsColumn — chain description', () => { }) /** - * FE-PDC-032..037 — the lead image and its rail. + * FE-PDC-032..037 — the picture grid. * - * The grid was three 84px squares in a 288px column, which is too small to tell - * a facade from a foyer — the one thing the picker exists for. What must NOT - * change: picking a picture still takes one click. + * A lead image plus a thumbnail rail was tried and dropped: it took too much of + * a column that also has to show facts, hours and a description. What must hold + * either way is that picking a picture stays one click. */ describe('PlaceDetailsColumn — picture layout', () => { const photo = (n: number, over: Record = {}) => ({ @@ -508,19 +508,16 @@ describe('PlaceDetailsColumn — picture layout', () => { // alt="" makes an image presentational, so it carries no `img` role — these // read the DOM directly, the way the strip cases above already do. const shownImages = () => Array.from(document.querySelectorAll('img')) - const leadSrc = () => shownImages()[0]?.getAttribute('src') - it('FE-PDC-032: shows the first picture large and the rest as a rail', async () => { + it('FE-PDC-032: shows one tile per picture and nothing else', async () => { withPhotos(4) renderColumn() await screen.findByText('places.details.pickImage') - // One lead plus one thumbnail per picture. - expect(shownImages()).toHaveLength(5) - expect(leadSrc()).toBe('/api/maps/place-photo/p0/bytes') + expect(shownImages()).toHaveLength(4) }) - it('FE-PDC-033: leaves the rail off when there is only one picture', async () => { + it('FE-PDC-033: a single picture is a single tile', async () => { withPhotos(1) renderColumn() @@ -528,50 +525,45 @@ describe('PlaceDetailsColumn — picture layout', () => { expect(shownImages()).toHaveLength(1) }) - it('FE-PDC-034: picking a picture is still one click', async () => { + it('FE-PDC-034: picking a picture is one click', async () => { withPhotos(3) const { onPickImage } = renderColumn() await screen.findByText('places.details.pickImage') - // Buttons: lead first, then one per thumbnail. - const buttons = screen.getAllByRole('button', { name: /places.details.pickImage/ }) - fireEvent.click(buttons[2]) + const tiles = screen.getAllByRole('button', { name: /places.details.pickImage/ }) + fireEvent.click(tiles[1]) expect(onPickImage).toHaveBeenCalledWith('/api/maps/place-photo/p1/bytes') expect(onPickImage).toHaveBeenCalledTimes(1) }) - it('FE-PDC-035: hovering a thumbnail previews it without picking it', async () => { - withPhotos(3) - const { onPickImage } = renderColumn() - - await screen.findByText('places.details.pickImage') - const buttons = screen.getAllByRole('button', { name: /places.details.pickImage/ }) - fireEvent.mouseEnter(buttons[3]) - - expect(leadSrc()).toBe('/api/maps/place-photo/p2/bytes') - expect(onPickImage).not.toHaveBeenCalled() - }) - - it('FE-PDC-036: clicking the lead picks the picture it is showing, and unpicks it again', async () => { + it('FE-PDC-035: clicking the picked tile again clears the choice', async () => { withPhotos(2) const { onPickImage } = renderColumn({ selectedImageUrl: '/api/maps/place-photo/p1/bytes' }) await screen.findByText('places.details.pickImage') - const lead = screen.getAllByRole('button', { name: /places.details.pickImage/ })[0] - // The picked one is what the lead slot shows. - expect(leadSrc()).toBe('/api/maps/place-photo/p1/bytes') + const tiles = screen.getAllByRole('button', { name: /places.details.pickImage/ }) + fireEvent.click(tiles[1]) - fireEvent.click(lead) expect(onPickImage).toHaveBeenCalledWith(null) }) - it('FE-PDC-037: credits the picture in the lead slot, licence included', async () => { + it('FE-PDC-036: hovering a tile moves the credit to it without picking it', async () => { + withPhotos(3) + const { onPickImage } = renderColumn() + + await screen.findByText('Author 0') + const tiles = screen.getAllByRole('button', { name: /places.details.pickImage/ }) + fireEvent.mouseEnter(tiles[2]) + + expect(screen.getByText('Author 2')).toBeInTheDocument() + expect(onPickImage).not.toHaveBeenCalled() + }) + + it('FE-PDC-037: credits the picture in play, licence included', async () => { withPhotos(2) renderColumn() - // The credit rides on the picture rather than sitting in its own line, which - // used to change text on every hover. expect(await screen.findByText('Author 0')).toBeInTheDocument() expect(screen.getByText('Author 0').closest('a')).toHaveAttribute( 'href', diff --git a/client/src/components/Planner/PlaceDetailsColumn.tsx b/client/src/components/Planner/PlaceDetailsColumn.tsx index 90345e4b1..89924e260 100644 --- a/client/src/components/Planner/PlaceDetailsColumn.tsx +++ b/client/src/components/Planner/PlaceDetailsColumn.tsx @@ -283,17 +283,17 @@ function creditOf(photo: PlacePhotoCandidate): string { } /** - * The pictures: one large, the rest as a thumbnail rail. + * The picture grid. * - * This was a three-column square grid, which in a 288px column worked out to - * 84px tiles — too small to tell a facade from a foyer, and the whole reason - * for choosing one over another. A lead image at 4:3 shows what the picture - * actually is; the rail below it says how many others there are. + * A grid rather than one large image: this sits beside a form in a dialog, and + * a picture that takes half the column pushes the facts and the description out + * of sight. Three columns at 320px gives ~96px tiles, which is enough to tell + * the pictures apart while leaving the rest of the column visible. * - * The click count is unchanged: a thumbnail picks that picture, exactly as the - * tiles did. Hovering one only previews it in the lead slot, and clicking the - * lead toggles the picture currently shown — so nothing that worked before - * takes an extra step now. + * Only the picture in play is credited in full — crediting all of them at once + * cost two lines each and drowned the column, and the licence obligation + * attaches to the one that gets used. Every tile still carries the full credit + * as its tooltip and links to its source page. */ function PhotoStrip({ photos, @@ -309,53 +309,26 @@ function PhotoStrip({ const [hovered, setHovered] = useState(null) if (photos.length === 0) return null - const lead = photos.find((p) => p.url === (hovered ?? selectedImageUrl)) ?? photos[0] - const leadPicked = !!selectedImageUrl && lead.url === selectedImageUrl + const shown = photos.find((p) => p.url === (hovered ?? selectedImageUrl)) ?? photos[0] return (
{t('places.details.pickImage')} - - {photos.length > 1 && ( -
- {photos.map((photo) => ( - - ))} -
- )} +
+ {photos.map((photo) => ( + + ))} +
+

+ +

) } @@ -363,15 +336,12 @@ function PhotoStrip({ function PhotoTile({ photo, selected, - showing, onPick, onHover, t, }: { photo: PlacePhotoCandidate selected: boolean - /** Currently in the lead slot, whether by hover or by being the picked one. */ - showing: boolean onPick: (url: string | null) => void onHover: (url: string | null) => void t: TranslationFn @@ -389,23 +359,19 @@ function PhotoTile({ aria-pressed={selected} aria-label={`${t('places.details.pickImage')} — ${credit}`} title={`${credit}${photo.license ? ` · ${photo.license}` : ''}`} - className={`group relative block w-full aspect-square overflow-hidden rounded-md transition-shadow ${ - selected - ? 'ring-2 ring-accent' - : showing - ? 'ring-1 ring-content-muted' - : 'ring-1 ring-edge hover:ring-content-muted' + className={`group relative block w-full aspect-square overflow-hidden rounded-lg transition-shadow ${ + selected ? 'ring-2 ring-accent ring-offset-2 ring-offset-surface-secondary' : 'ring-1 ring-edge hover:ring-content-muted' }`} > {selected && ( - - + + )} @@ -419,7 +385,7 @@ function sourceLabelFor(source: PlacePhotoCandidate['source']): string { } /** - * Author and licence for the picture in the lead slot. + * Author and licence for the picture currently in play. * * Not decoration: Commons images are largely CC BY / CC BY-SA, and reusing one * without naming its author does not satisfy those terms. When a source hands