stayPin.lookUp(form.title, form.hotel_address)}
+ />
>
)}
diff --git a/client/src/components/Planner/StayPinStatus.test.tsx b/client/src/components/Planner/StayPinStatus.test.tsx
index b63e7affb..2e69f7890 100644
--- a/client/src/components/Planner/StayPinStatus.test.tsx
+++ b/client/src/components/Planner/StayPinStatus.test.tsx
@@ -23,6 +23,17 @@ describe('StayPinStatus', () => {
expect(container.textContent).toBe('');
});
+ it('FE-STAY-PIN-STATUS-001b: a stay already linked to a place of the trip shows nothing', () => {
+ const { container } = render(
+ createElement(
+ TranslationProvider,
+ null,
+ createElement(StayPinStatus, { pin: { status: 'missing' }, hidden: true, onRetry: vi.fn() })
+ )
+ );
+ expect(container.textContent).toBe('');
+ });
+
it('FE-STAY-PIN-STATUS-002: says it is looking, then where it found the stay', () => {
show({ status: 'searching' });
expect(screen.getByRole('status')).toHaveTextContent('Looking for it on the map');
diff --git a/client/src/components/Planner/StayPinStatus.tsx b/client/src/components/Planner/StayPinStatus.tsx
index 2b81fb1e5..bf29c46f8 100644
--- a/client/src/components/Planner/StayPinStatus.tsx
+++ b/client/src/components/Planner/StayPinStatus.tsx
@@ -5,6 +5,8 @@ import type { StayPin } from './useStayPin';
interface StayPinStatusProps {
pin: StayPin;
+ /** A stay already linked to a place of the trip shows on the map through that place. */
+ hidden?: boolean;
/** Asks the map again with what the form now holds. */
onRetry: () => void;
}
@@ -15,9 +17,9 @@ interface StayPinStatusProps {
* found, with a way to search again before it is saved without a pin. Shared by
* the desktop booking dialog and the phone's booking sheet.
*/
-export default function StayPinStatus({ pin, onRetry }: StayPinStatusProps) {
+export default function StayPinStatus({ pin, hidden = false, onRetry }: StayPinStatusProps) {
const { t } = useTranslation();
- if (pin.status === 'idle') return null;
+ if (hidden || pin.status === 'idle') return null;
if (pin.status === 'searching') {
return (
diff --git a/client/src/components/Planner/useStayPin.ts b/client/src/components/Planner/useStayPin.ts
index d310e84fe..d621659ee 100644
--- a/client/src/components/Planner/useStayPin.ts
+++ b/client/src/components/Planner/useStayPin.ts
@@ -29,9 +29,9 @@ export function useStayPin() {
[]
);
- const lookUp = (name: string, address: string | null | undefined) => {
+ const lookUp = (name: string | null | undefined, address: string | null | undefined) => {
const mine = ++ticket.current;
- const queries = stayQueries(name, address);
+ const queries = stayQueries(name ?? '', address);
if (isEffectivelyOffline()) {
setPin({ status: 'idle' });
return;
diff --git a/client/src/mobile/screens/trip/sheets/MReservationSheet.tsx b/client/src/mobile/screens/trip/sheets/MReservationSheet.tsx
index 066cfa8e2..9feaf366e 100644
--- a/client/src/mobile/screens/trip/sheets/MReservationSheet.tsx
+++ b/client/src/mobile/screens/trip/sheets/MReservationSheet.tsx
@@ -339,11 +339,13 @@ export default function MReservationSheet({ planner, onOpenExpense }: MReservati
placeholder={t('reservations.locationPlaceholder')}
className={FIELD_CLS}
/>
- {!form.hotel_place_id && (
-
- stayPin.lookUp(form.title, form.hotel_address)} />
-
- )}
+
+ stayPin.lookUp(form.title, form.hotel_address)}
+ />
+
>
)}