mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-23 15:36:33 +00:00
fix(assistant): green CI round, trip notes the assistant can keep, calmer change cards
- the assistant keeps facts for a trip (remember_for_trip) as a change card, applied into the user's trip notes; existing expenses can be changed - change card fields as a few icon chips with the rest folded under Details, the day band marks only what changes, the week grid as compact tiles - no map button on receipts of things that have no place on the map - tests follow the composer's accessible name, the receipt's status icon and the GL map's container; the hanging stream helper honours an early abort - Postgres probe: qualified columns in the upsert updates; entities restored to the generator's output; strict ratchet reads the SDK client as untyped
This commit is contained in:
@@ -47,6 +47,8 @@ const glMap = vi.hoisted(() => ({
|
||||
getStyle: vi.fn().mockReturnValue({ layers: [] }),
|
||||
isStyleLoaded: vi.fn().mockReturnValue(true),
|
||||
getCanvasContainer: vi.fn(() => glCanvasContainer),
|
||||
// The assistant's camera listens on the map's container for the user's own moves.
|
||||
getContainer: vi.fn(() => glCanvasContainer),
|
||||
getLayer: vi.fn().mockReturnValue(null),
|
||||
queryRenderedFeatures: vi.fn().mockReturnValue([]),
|
||||
querySourceFeatures: vi.fn().mockReturnValue([]),
|
||||
|
||||
@@ -16,22 +16,26 @@ function setup(hoveredId: string | null = null) {
|
||||
const attached: { el: HTMLElement; lng: number; lat: number; remove: ReturnType<typeof vi.fn> }[] = [];
|
||||
const pinsRef = { current: [] as { remove: () => void }[] };
|
||||
const onHover = vi.fn();
|
||||
const onClick = vi.fn();
|
||||
// Stable across renders, as the map view hands them over: only `hovered` changes.
|
||||
const mapRef = { current: map };
|
||||
const attachPin = (el: HTMLElement, lng: number, lat: number) => {
|
||||
container.appendChild(el);
|
||||
const pin = { el, lng, lat, remove: vi.fn(() => el.remove()) };
|
||||
attached.push(pin);
|
||||
return pin;
|
||||
};
|
||||
const hook = renderHook(
|
||||
({ hovered }) =>
|
||||
useAssistantGhostMarkersGL({
|
||||
mapRef: { current: map },
|
||||
mapRef,
|
||||
mapReady: true,
|
||||
pinsRef,
|
||||
attachPin: (el, lng, lat) => {
|
||||
container.appendChild(el);
|
||||
const pin = { el, lng, lat, remove: vi.fn(() => el.remove()) };
|
||||
attached.push(pin);
|
||||
return pin;
|
||||
},
|
||||
attachPin,
|
||||
ghosts: GHOSTS,
|
||||
hoveredId: hovered,
|
||||
onHover,
|
||||
onClick: vi.fn(),
|
||||
onClick,
|
||||
}),
|
||||
{ initialProps: { hovered: hoveredId } }
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user