setPick({ file, choice: use })} />}
{nowhere && (
{t('native.share.linkUnsupported')}
)}
- {showTrips && (
-
- {trips.map((trip) => (
-
- ))}
- {trips.length === 0 && (
-
- {t('native.share.noTrips')}
-
- )}
-
- )}
+ {showTrips && }
);
}
+function LinkQuestion({ onPick }: { onPick: (choice: LinkChoice) => void }): React.ReactElement {
+ const { t } = useTranslation();
+ return (
+
+ }
+ label={t('native.share.saveLink')}
+ hint={t('native.share.saveLinkHint')}
+ onClick={() => onPick('link')}
+ />
+ }
+ label={t('native.share.readBooking')}
+ hint={t('native.share.readBookingHint')}
+ onClick={() => onPick('booking')}
+ />
+
+ );
+}
+
+function TripPicker({
+ trips,
+ disabled,
+ onPick,
+}: {
+ trips: TripRow[];
+ disabled: boolean;
+ onPick: (id: number) => void;
+}): React.ReactElement {
+ const { t } = useTranslation();
+ return (
+
+ {trips.map((trip) => (
+
+ ))}
+ {trips.length === 0 && (
+
{t('native.share.noTrips')}
+ )}
+
+ );
+}
+
function ChoiceRow({
icon,
label,
diff --git a/client/src/mobile/screens/trip/tours/MTourWorkspace.tsx b/client/src/mobile/screens/trip/tours/MTourWorkspace.tsx
index 54b12b0ec..732ade12b 100644
--- a/client/src/mobile/screens/trip/tours/MTourWorkspace.tsx
+++ b/client/src/mobile/screens/trip/tours/MTourWorkspace.tsx
@@ -1,5 +1,5 @@
import { List, Map as MapIcon } from 'lucide-react';
-import { useEffect, useState } from 'react';
+import { useState } from 'react';
import TourGpxDropZone from '../../../../components/Tours/TourGpxDropZone';
import TourWorkspaceRail from '../../../../components/Tours/TourWorkspaceRail';
import { TourPlannerToursRail } from '../../../../components/Tours/planner/TourPlannerPanels';
@@ -43,7 +43,6 @@ export default function MTourWorkspace({ planner }: Pick('tours');
const [mapShown, setMapShown] = useState(false);
// The waypoint list and the stage rail reorder by HTML5 drag, which a finger cannot start.
useTouchDragBridge(true);
@@ -52,10 +51,15 @@ export default function MTourWorkspace({ planner }: Pick {
+ // change: a tap on the editor half with nothing open stays where it went. Set
+ // while rendering, as React has it for state that follows a prop, not in an effect.
+ const [pane, setPane] = useState(editing ? 'editor' : 'tours');
+ const opened = `${editing}:${mode}`;
+ const [seen, setSeen] = useState(opened);
+ if (seen !== opened) {
+ setSeen(opened);
setPane(editing ? 'editor' : 'tours');
- }, [editing, mode]);
+ }
const showPane = split || !mapShown;
const showMap = split || mapShown;
diff --git a/client/src/pages/tripPlanner/b4a-wiring.test.ts b/client/src/pages/tripPlanner/b4a-wiring.test.ts
index 67bad6a30..98deda047 100644
--- a/client/src/pages/tripPlanner/b4a-wiring.test.ts
+++ b/client/src/pages/tripPlanner/b4a-wiring.test.ts
@@ -91,16 +91,18 @@ test('B4A Core testability debt: verify source without importing the page, hook,
assert.equal(collect(self, node => ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.ImportKeyword).length, 0)
})
-test('B4A Tours tab is readable, desktop-only, and absent with addon OFF', () => {
+test('B4A Tours tab is readable, desktop-only off a large screen, and absent with addon OFF', () => {
const tabs = initializer(hook, 'TRIP_TABS')
const branches = collect(tabs, node => ts.isConditionalExpression(node)
&& node.whenTrue.getText(hook).includes("id: 'tour-planner'"))
assert.equal(branches.length, 1)
const branch = branches[0]
assert.ok(ts.isConditionalExpression(branch))
- assert.equal(branch.condition.getText(hook), 'enabledAddons.tours && !isMobile')
+ // Where the tab exists and whether the touch shell offers it: tourPlannerTabOf (tripPlannerModel.test.ts).
+ assert.equal(branch.condition.getText(hook), 'tourTab')
+ assert.equal(initializer(hook, 'tourTab').getText(hook), 'tourPlannerTabOf(!!enabledAddons.tours, isMobile, largeTouch)')
assert.equal(branch.whenFalse.getText(hook), '[]')
- assert.match(branch.whenTrue.getText(hook), /desktopOnly: true/)
+ assert.match(branch.whenTrue.getText(hook), /desktopOnly: tourTab\.desktopOnly/)
assert.doesNotMatch(tabs.getText(hook), /\bcan\b|canPlaceEdit|canDayEdit/)
assert.match(hookText, /!validTabIds\.includes\(activeTab\)[\s\S]*?setActiveTab\('plan'\)/)
assert.match(pageText, /activeTab === 'tour-planner' && enabledAddons\.tours && !isMobile/)
diff --git a/client/src/pages/tripPlanner/useTripPlanner.ts b/client/src/pages/tripPlanner/useTripPlanner.ts
index 88d5f54a2..7221e0fdf 100644
--- a/client/src/pages/tripPlanner/useTripPlanner.ts
+++ b/client/src/pages/tripPlanner/useTripPlanner.ts
@@ -226,7 +226,7 @@ export function useTripPlanner() {
const tourTab = tourPlannerTabOf(!!enabledAddons.tours, isMobile, largeTouch)
const TRIP_TABS = [
{ id: 'plan', label: t(TRIP_TAB_LABEL_KEYS.plan), icon: Map },
- ...(tourTab ? [{ id: 'tour-planner', label: t(TRIP_TAB_LABEL_KEYS['tour-planner']), icon: Mountain, ...tourTab }] : []),
+ ...(tourTab ? [{ id: 'tour-planner', label: t(TRIP_TAB_LABEL_KEYS['tour-planner']), icon: Mountain, desktopOnly: tourTab.desktopOnly }] : []),
{ id: 'transports', label: t(TRIP_TAB_LABEL_KEYS.transports), icon: Train },
{ id: 'buchungen', label: t(TRIP_TAB_LABEL_KEYS.buchungen), shortLabel: t('trip.tabs.reservationsShort'), icon: Ticket },
// Phone only: the desktop reaches the drive through the mode switch beside the
diff --git a/shared/src/i18n/ca/native.ts b/shared/src/i18n/ca/native.ts
index c17ba4414..bdf9d7256 100644
--- a/shared/src/i18n/ca/native.ts
+++ b/shared/src/i18n/ca/native.ts
@@ -107,7 +107,7 @@ const native: TranslationStrings = {
'native.share.saveLinkHint': 'Tothom al viatge el troba a Enllaços',
'native.share.readBooking': 'Llegeix-ne una reserva',
'native.share.readBookingHint': 'Per a una pàgina de confirmació',
- 'native.share.linkTrip': 'A quin viatge desar l\'enllaç?',
+ 'native.share.linkTrip': "A quin viatge desar l'enllaç?",
'native.share.linkSaved': 'Enllaç desat',
'native.share.linkUnsupported': 'Activa Collab per guardar enllaços en un viatge.',
'native.widget.dayOf': 'Dia {n} de {m}',
diff --git a/shared/src/i18n/en/native.ts b/shared/src/i18n/en/native.ts
index 7620c82ff..ef27bd741 100644
--- a/shared/src/i18n/en/native.ts
+++ b/shared/src/i18n/en/native.ts
@@ -102,7 +102,7 @@ const native: TranslationStrings = {
'native.share.title': 'Import into which trip?',
'native.share.noTrips': 'No trip yet. Create one first, then share the document again.',
'native.share.linkTitle': 'What should TREK do with this link?',
- 'native.share.saveLink': 'Save to the trip\'s links',
+ 'native.share.saveLink': "Save to the trip's links",
'native.share.saveLinkHint': 'Everyone on the trip finds it under Links',
'native.share.readBooking': 'Read a booking from it',
'native.share.readBookingHint': 'For a confirmation page',