fix(tours): the lint the paddle work grew, back to the baseline

The region load and obstacle helpers move out of their component files (paddleRegionLoad.ts, paddleObstaclePlace.ts), so those files export components only (react-refresh). TourPlannerMapStage takes the take-from-card rule out into paddlePlaceFromCard and works out the cards' end inset once (complexity 24, back under 20). The tour tests reach list items through at() and must() instead of non-null assertions, a position change in the shaping test is voided rather than left floating, and PLOAD-004 seeds its regions with Promise.all.
This commit is contained in:
Maurice
2026-10-18 23:16:41 +02:00
parent 7e9297d867
commit dcc1c18fa9
12 changed files with 128 additions and 83 deletions
@@ -5,37 +5,6 @@ import { fs } from '../../shared/DialogShell';
type Translate = ReturnType<typeof useTranslation>['t'];
/** The states in which the data is on its way: the leg waits rather than fails. */
export function isRegionLoadPending(
state: PaddleRegionLoadState | undefined
): state is Extract<PaddleRegionLoadState, { state: 'loading' | 'ready' | 'requested' }> {
return state?.state === 'loading' || state?.state === 'ready' || state?.state === 'requested';
}
/**
* Why a leg stays unplanned once the data cannot come: declined, failed, no
* water near the place, nothing to load. Null where the leg's own reason says
* it best (loading is off, or nothing was asked yet).
*/
export function regionLoadFailure(state: PaddleRegionLoadState | undefined, t: Translate): string | null {
if (!state) return null;
const region = state.region?.name ?? '';
switch (state.state) {
case 'declined':
return t('tours.paddle.load.declined', { region });
case 'failed':
return t('tours.paddle.load.failed', { region });
case 'no_water':
return t('tours.paddle.load.noWater', { region });
case 'unavailable':
if (state.reason === 'no_extract') return t('tours.paddle.load.noExtract');
if (state.reason === 'catalog_unavailable') return t('tours.paddle.load.catalogUnavailable');
return null;
default:
return null;
}
}
function headline(state: Extract<PaddleRegionLoadState, { state: 'loading' | 'ready' | 'requested' }>, t: Translate) {
const region = state.region.name;
if (state.state === 'ready') return t('tours.paddle.load.ready', { region });