mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 09:38:54 +00:00
fix(tours): give an actual track its own mark and a winter tile its label's icon
Footprints stood for a snowshoe hike, an actual track and a walk's moving time at once, with the snowshoe pill and the track pill side by side in a tour's head. An actual track now goes by the done mark on the list row, in the head and on a recording's tile, and a winter tile's corner takes the icon its head pill shows.
This commit is contained in:
@@ -4,7 +4,7 @@ import { TourDayRowAvatar } from '../TourDayRowFacts';
|
||||
import { TourGradeTile } from '../tourParts';
|
||||
import { WinterActivityPill, WinterCornerMark } from './winterMarks';
|
||||
|
||||
// FE-TOUR-WINTER-MARK-001 to FE-TOUR-WINTER-MARK-004
|
||||
// FE-TOUR-WINTER-MARK-001 to FE-TOUR-WINTER-MARK-005
|
||||
|
||||
const hike = { tour_type: 'hike' as const, max_hiking_difficulty: 2, wanderer_ref: null, has_waypoints: true };
|
||||
|
||||
@@ -40,4 +40,16 @@ describe('winter marks (HIK-01)', () => {
|
||||
expect(screen.getByTestId('plan-tour-icon')).toHaveTextContent('T2');
|
||||
expect(screen.getByTestId('tour-winter-mark')).toHaveStyle({ width: '22px' });
|
||||
});
|
||||
|
||||
it('FE-TOUR-WINTER-MARK-005: the corner mark goes by the same icon as the head pill of its label', () => {
|
||||
for (const activity of ['winter_hike', 'snowshoe'] as const) {
|
||||
const icon = activity === 'snowshoe' ? 'lucide-footprints' : 'lucide-snowflake';
|
||||
const mark = render(<WinterCornerMark activity={activity} />);
|
||||
expect(mark.container.querySelector(`svg.${icon}`)).not.toBeNull();
|
||||
mark.unmount();
|
||||
const pill = render(<WinterActivityPill activity={activity} className="head-pill" />);
|
||||
expect(pill.container.querySelector(`svg.${icon}`)).not.toBeNull();
|
||||
pill.unmount();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,9 +12,10 @@ export const WINTER_ACTIVITY_ICON: Record<WinterActivity, LucideIcon> = {
|
||||
};
|
||||
|
||||
/**
|
||||
* HIK-01: a hike's winter label on its round tile, a frosted snowflake badge
|
||||
* at the tile's top corner, the way the tile carries where a tour came from at
|
||||
* its foot. Its tooltip names the label; nothing is drawn for a hike without one.
|
||||
* HIK-01: a hike's winter label on its round tile, a frosted badge at the
|
||||
* tile's top corner with the label's own icon, the one its head pill shows,
|
||||
* the way the tile carries where a tour came from at its foot. Its tooltip
|
||||
* names the label; nothing is drawn for a hike without one.
|
||||
*/
|
||||
export function WinterCornerMark({
|
||||
activity,
|
||||
@@ -28,7 +29,7 @@ export function WinterCornerMark({
|
||||
if (!activity) return null;
|
||||
return (
|
||||
<TourCornerMark
|
||||
icon={Snowflake}
|
||||
icon={WINTER_ACTIVITY_ICON[activity]}
|
||||
label={t(`tours.winter.activity.${activity}`)}
|
||||
size={size}
|
||||
testId="tour-winter-mark"
|
||||
|
||||
Reference in New Issue
Block a user