mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-29 16:10:07 +00:00
feat(help): rewrite the help center for v5 with a Tours section, new pictures in every language, and fix the tour planner bugs it surfaced
Every help screen checked against the v5 redesign. Tours is documented for the first time, as a screen of its own with twelve screens under it, and notifications get help of their own. All pictures are taken again on a realistic demo trip, with short loops where a still cannot show the motion. The English is plain and every language is written naturally rather than word for word. The switcher shows two levels at most, a screen's overview lists its sub-screens as cards above its guides, each wiki page is linked once, and the help sidebar is wider. Fixes found along the way: Save to Collection keeps a tour's route, a track dropped on the places column opens the Tours import, tour Share on desktop, the unsaved tour draft lives on the account, a route click no longer adds an end point, Trip places leaves the trip's tours out, Escape closes a stage's day menu, confirms before destructive deletes, DWD warnings sharing one id kept apart, a booking's date moves with it, and smaller fixes across notifications, bookings, the day plan, stays, Atlas, Collections, Vacay and the admin screens.
This commit is contained in:
@@ -276,12 +276,12 @@ describe('TourMapLayerSwitcher piste switch (SKI-01)', () => {
|
||||
expect(key).toHaveAccessibleName('Piste key')
|
||||
})
|
||||
|
||||
it('FE-COMP-MAPLAYER-023: a piste source that stopped answering shows the warning badge, says so, and hides the key', async () => {
|
||||
it('FE-COMP-MAPLAYER-023: a piste source that stopped answering shows the warning badge, says so, and keeps the key readable', async () => {
|
||||
render(<TourMapLayerSwitcher active="default" onChange={() => {}} layers={{ overlays: [pisteOverlay({ active: true, status: 'down' })] }} />)
|
||||
const toggle = screen.getByRole('button', { name: 'Pistes, cross-country trails and lifts' })
|
||||
expect(toggle).toHaveAttribute('data-status', 'down')
|
||||
expect(toggle).toHaveTextContent('!')
|
||||
expect(screen.queryByTestId('piste-key-button')).toBeNull()
|
||||
expect(screen.getByTestId('piste-key-button')).toBeInTheDocument()
|
||||
expect(screen.getByRole('status')).toHaveTextContent('Pistes are not loading. The map and your route still work.')
|
||||
fireEvent.mouseEnter(toggle)
|
||||
expect(await screen.findByRole('tooltip')).toHaveTextContent('Pistes are not loading.')
|
||||
|
||||
@@ -78,7 +78,7 @@ export function MapLayerSwitcher({ active, onToggle }: { active: BaseLayer; onTo
|
||||
|
||||
const TOUR_LAYERS = [
|
||||
{ id: 'default', labelKey: 'map.baseLayer.default', Icon: MapIcon },
|
||||
{ id: 'topo', labelKey: null, Icon: Mountain },
|
||||
{ id: 'topo', labelKey: 'map.baseLayer.topo', Icon: Mountain },
|
||||
{ id: 'hiking', labelKey: 'map.baseLayer.hiking', Icon: Footprints },
|
||||
{ id: 'cycle', labelKey: 'map.baseLayer.cycle', Icon: Bike },
|
||||
{ id: 'satellite', labelKey: 'map.baseLayer.satellite', Icon: Satellite },
|
||||
@@ -220,7 +220,7 @@ function DownBadge() {
|
||||
* planning go on without it. Switched on further out than its first tiles, it
|
||||
* stays pressed in the soft accent and its tooltip says to zoom in, so an empty
|
||||
* map does not read as broken. An overlay with a key shows the key's button
|
||||
* beside the switch while it is on and answering.
|
||||
* beside the switch while it is on, also when the source is down, so the colours stay readable.
|
||||
*/
|
||||
function OverlayToggle({ overlay, compact }: { overlay: ToggleableRasterOverlay; compact: boolean }) {
|
||||
const { t } = useTranslation()
|
||||
@@ -251,7 +251,7 @@ function OverlayToggle({ overlay, compact }: { overlay: ToggleableRasterOverlay;
|
||||
{down && <DownBadge />}
|
||||
</button>
|
||||
</Tooltip>
|
||||
{look.Key && overlay.status === 'on' && <look.Key belowMinZoom={!!zoomIn} />}
|
||||
{look.Key && on && <look.Key belowMinZoom={!!zoomIn} />}
|
||||
<span role="status" aria-live="polite" className="sr-only">{notice ?? ''}</span>
|
||||
</>
|
||||
)
|
||||
@@ -296,7 +296,7 @@ export function TourMapLayerSwitcher({
|
||||
<div style={{ ...FROSTED_SHELL, gap: 2 }} role="group" aria-label={t('settings.mapStyle')}>
|
||||
{TOUR_LAYERS.filter(({ id }) => !bases || bases.includes(id)).map(({ id, labelKey, Icon }) => {
|
||||
const selected = active === id
|
||||
const label = labelKey ? t(labelKey) : 'Topo'
|
||||
const label = t(labelKey)
|
||||
const down = !!health?.down && health.base === id && active === id
|
||||
const downLabel = id === 'cycle' ? t('map.baseLayer.cycleDown') : t('map.baseLayer.hikingDown')
|
||||
return (
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import { fireEvent, render, screen } from '@testing-library/react';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { RouteHitBand } from './RouteHitBand';
|
||||
|
||||
// jsdom cannot reproduce Leaflet's event propagation, so the mock surfaces the
|
||||
// option that governs it and hands the click on with a position.
|
||||
vi.mock('react-leaflet', () => ({
|
||||
Polyline: ({
|
||||
eventHandlers,
|
||||
bubblingMouseEvents,
|
||||
}: {
|
||||
eventHandlers?: { click?: (e: unknown) => void };
|
||||
bubblingMouseEvents?: boolean;
|
||||
}) => (
|
||||
<div
|
||||
data-testid="band"
|
||||
data-bubbling={String(bubblingMouseEvents)}
|
||||
onClick={() =>
|
||||
eventHandlers?.click?.({ latlng: { lat: 46.58, lng: 11.75 }, originalEvent: new MouseEvent('click') })
|
||||
}
|
||||
/>
|
||||
),
|
||||
}));
|
||||
|
||||
describe('RouteHitBand', () => {
|
||||
it('keeps its click from the map, which would add a point at the end of the tour', () => {
|
||||
render(
|
||||
<RouteHitBand
|
||||
positions={[
|
||||
[46.5, 11.7],
|
||||
[46.6, 11.8],
|
||||
]}
|
||||
onRouteClick={vi.fn()}
|
||||
/>
|
||||
);
|
||||
expect(screen.getByTestId('band')).toHaveAttribute('data-bubbling', 'false');
|
||||
});
|
||||
|
||||
it('hands the clicked position to the route', () => {
|
||||
const onRouteClick = vi.fn();
|
||||
render(
|
||||
<RouteHitBand
|
||||
positions={[
|
||||
[46.5, 11.7],
|
||||
[46.6, 11.8],
|
||||
]}
|
||||
onRouteClick={onRouteClick}
|
||||
/>
|
||||
);
|
||||
fireEvent.click(screen.getByTestId('band'));
|
||||
expect(onRouteClick).toHaveBeenCalledWith(46.58, 11.75);
|
||||
});
|
||||
});
|
||||
@@ -15,6 +15,10 @@ export function RouteHitBand({
|
||||
return (
|
||||
<Polyline
|
||||
positions={positions}
|
||||
// Leaflet hands a path's click to the map as well unless the path says not to;
|
||||
// stopping the DOM event does not reach that, and the map's click would add a
|
||||
// point at the end of the tour under the shaping point (as TrackLines does).
|
||||
bubblingMouseEvents={false}
|
||||
pathOptions={{
|
||||
color: 'transparent',
|
||||
weight: 20,
|
||||
|
||||
Reference in New Issue
Block a user