fix(ci): repair strict types and empty dashboard card

Keep the dashboard card class when it spans all columns. Match the place form payload to the service-stop placement type and make dialog card hints optional. Document the independent receipt copy and format the files flagged by CI.
This commit is contained in:
Maurice
2026-12-02 23:05:12 +01:00
parent 86e98fde65
commit f5a510c78e
9 changed files with 21 additions and 22 deletions
-1
View File
@@ -48,7 +48,6 @@
"src/components/Planner/DayPlanSidebar.tsx": 52,
"src/components/Planner/DayPlanSidebarNoteModal.test.tsx": 1,
"src/components/Planner/PlaceFormModal.test.tsx": 3,
"src/components/Planner/PlaceFormModal.tsx": 1,
"src/components/Planner/PlaceInspector.tsx": 16,
"src/components/Planner/PlacesBulkCategoryModal.test.tsx": 1,
"src/components/Planner/PlacesSidebar.tsx": 1,
@@ -2,8 +2,8 @@ import type { AssistantChangePreview, AssistantPlanEdits } from '@trek/shared';
import { assistantPlanEditsSchema, parsePlaceHours, placeOpeningHoursSchema } from '@trek/shared';
import { useCallback, useEffect, useState } from 'react';
import { useTranslation } from '../../i18n';
import { useIsPhone } from '../../hooks/useIsPhone';
import { useTranslation } from '../../i18n';
import { useAssistantStore } from '../../store/assistantStore';
import { useTripStore } from '../../store/tripStore';
import PlaceFormModal from '../Planner/PlaceFormModal';
@@ -544,9 +544,7 @@ function PlaceSearchFields({ state: S, fieldId }: { state: PlaceFormState; field
onClick={() => {
if (!form.name.trim()) handleChange('name', S.emptySearch!);
S.setEmptySearch(null);
document
.getElementById(`${fieldId}-contact`)
?.scrollIntoView?.({ behavior: 'smooth', block: 'center' });
document.getElementById(`${fieldId}-contact`)?.scrollIntoView?.({ behavior: 'smooth', block: 'center' });
}}
className="flex-none rounded-full bg-accent px-3 py-1.5 font-semibold text-accent-text hover:opacity-90"
style={fs(12, 'body')}
@@ -563,9 +561,7 @@ function PlaceSearchFields({ state: S, fieldId }: { state: PlaceFormState; field
<button
key={idx}
type="button"
onClick={() =>
handleSelectMapsResult(result, { mode: 'search', rank: idx, count: mapsResults.length })
}
onClick={() => handleSelectMapsResult(result, { mode: 'search', rank: idx, count: mapsResults.length })}
className={`${PICK_ROW} hover:bg-surface-hover`}
>
<span className="min-w-0 flex-1">
@@ -10,7 +10,12 @@ import { useSettingsStore } from '../../store/settingsStore';
import { useTripAddonEnabled } from '../../store/tripAddonsStore';
import { useTripStore } from '../../store/tripStore';
import type { Assignment, BudgetItem, Category, Place } from '../../types';
import { DEFAULT_SERVICE_KIND, serviceStopChoice, type ServiceStopMode } from '../Roadtrip/manualStop';
import {
DEFAULT_SERVICE_KIND,
serviceStopChoice,
type ServiceStopMode,
type ServiceStopPlacement,
} from '../Roadtrip/manualStop';
import { STOP_KIND_BY_KEY } from '../Roadtrip/stopKinds';
import { useToast } from '../shared/Toast';
import type { BookingExpenseRequest } from './BookingCostsSection.types';
@@ -25,6 +30,7 @@ import {
prefillForm,
savedCategoryId,
type PlaceFormData,
type PlaceFormPayload,
type PlacePrefill,
} from './PlaceFormModal.helpers';
import { useNewCategory, usePlaceForm } from './usePlaceForm';
@@ -33,19 +39,13 @@ import { usePlaceRefresh } from './usePlaceRefresh';
import { usePlaceSearch } from './usePlaceSearch';
import { usePlaceTags } from './usePlaceTags';
// The submit payload mirrors the form, but lat/lng are parsed to numbers and
// category_id is normalised, plus any files chosen before the place existed.
export interface PlaceSubmitData extends Omit<PlaceFormData, 'lat' | 'lng' | 'category_id'> {
lat: number | null;
lng: number | null;
category_id: string | null;
_pendingFiles?: File[];
export interface PlaceSubmitData extends PlaceFormPayload {
/**
* Where a road-trip service stop belongs on the drive, worked out from the
* coordinates being saved. Travels the same way `_pendingFiles` does: the planner
* reads it, strips it, and assigns the new place at that position.
*/
_serviceStop?: { dayId: number; position: number; offRouteKm: number } | null;
_serviceStop?: ServiceStopPlacement | null;
}
interface PlaceProposal {
+2 -2
View File
@@ -203,13 +203,13 @@ export function AddRowButton({ onClick, disabled, raised = false, children }: {
* The head of a card in a dialog: an icon tile, the card's name and a line on
* what it is for. The trip settings' cards all open with it.
*/
export function CardHead({ icon, title, hint }: { icon: ReactNode; title: string; hint: string }) {
export function CardHead({ icon, title, hint }: { icon: ReactNode; title: string; hint?: string }) {
return (
<div className="flex items-start gap-2.5">
<span className="grid h-8 w-8 flex-none place-items-center rounded-[10px] bg-surface-card text-content-muted shadow-sm">{icon}</span>
<div className="min-w-0">
<h3 className="m-0 font-semibold text-content" style={fs(13, 'body')}>{title}</h3>
<p className="m-0 mt-0.5 leading-normal text-content-faint" style={fs(11.5)}>{hint}</p>
{hint && <p className="m-0 mt-0.5 leading-normal text-content-faint" style={fs(11.5)}>{hint}</p>}
</div>
</div>
)
+1 -1
View File
@@ -1,4 +1,4 @@
import { useState, useEffect } from 'react';
import { useEffect, useState } from 'react';
import { isNativeApp } from '../native/platform';
/**
+1 -1
View File
@@ -1 +1 @@
export { isPhoneViewport, PHONE_QUERY, useIsPhone } from '../hooks/useIsPhone';
export { PHONE_QUERY, isPhoneViewport, useIsPhone } from '../hooks/useIsPhone';
+1 -1
View File
@@ -262,7 +262,7 @@ function DashboardPageDesktop(): React.ReactElement {
)}
{tripFilter === 'planned' && !search.active && !isLoading && (
<button type="button"
className={`add-trip-card${showFirstTripPrompt ? 'col-span-full' : ''}`}
className={showFirstTripPrompt ? 'add-trip-card col-span-full' : 'add-trip-card'}
onClick={openCreate}
>
<div>
@@ -124,6 +124,10 @@ export class AssistantBookingImportService implements AttachedFileReader {
* Creates the booking the user applied, from the arguments the server stored
* when it proposed it. The answer is shaped like a tool's: the created
* reservation, or the reason it was not created.
*
* @txIndependent the booking commits before the optional receipt is copied
* from storage. Receipt permissions and copy failures leave the booking saved
* and are reported separately in the result.
*/
async apply(userId: number, tripId: number, args: Record<string, unknown>, threadId?: number): Promise<ToolRun> {
const parsed = bookingImportPreviewItemSchema.safeParse(args);