Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(mobile): the rail fades where its entries scroll on a short window; the watch capture says why it retries

Maurice3b7cdf516a73
diff --git a/client/ios/scripts/watch-screens.sh b/client/ios/scripts/watch-screens.sh
index 48c17a880..19bff0666 100644
--- a/client/ios/scripts/watch-screens.sh
+++ b/client/ios/scripts/watch-screens.sh
@@ -66,12 +66,12 @@ wait_ready() {
TOKEN=0
# shot <udid> <file> <screen> <scenario> <time or -> <language>: one launch, retried
-# after 2, 5 and 10 seconds when the simulator refuses it.
+# after 2, 5, 10 and 20 seconds when the simulator refuses it, saying which step failed.
shot() {
local udid=$1 file=$2 screen=$3 scenario=$4 clock=$5 lang=$6
- local locale=${lang//-/_} attempt
- for attempt in 0 2 5 10; do
- [ "$attempt" -gt 0 ] && { echo "retrying $(basename "$file") in ${attempt}s"; sleep "$attempt"; }
+ local locale=${lang//-/_} attempt failed=
+ for attempt in 0 2 5 10 20; do
+ [ "$attempt" -gt 0 ] && { echo "retrying $(basename "$file") in ${attempt}s ($failed)"; sleep "$attempt"; }
TOKEN=$((TOKEN + 1))
xcrun simctl terminate "$udid" "$BUNDLE" >/dev/null 2>&1 || true
sleep 0.5
@@ -79,11 +79,12 @@ shot() {
[ "$clock" = - ] || extra=(-TrekNow "$clock")
xcrun simctl launch "$udid" "$BUNDLE" \
-AppleLanguages "($lang)" -AppleLocale "$locale" -TrekDemo "$screen" -TrekScenario "$scenario" \
- -TrekReady "$TOKEN" ${extra[@]+"${extra[@]}"} >/dev/null 2>&1 || continue
- wait_ready "$udid" "$TOKEN" || continue
+ -TrekReady "$TOKEN" ${extra[@]+"${extra[@]}"} >/dev/null 2>&1 || { failed=launch; continue; }
+ wait_ready "$udid" "$TOKEN" || { failed='not ready'; continue; }
# The map's tiles come over the network after the screen is up.
[ "$screen" = place ] && sleep 6
xcrun simctl io "$udid" screenshot --type=png "$file" >/dev/null 2>&1 && return 0
+ failed=screenshot
done
echo "gave up on $(basename "$file")"
}
diff --git a/client/src/mobile/components/MRail.tsx b/client/src/mobile/components/MRail.tsx
index ea85db8bb..c80ac4733 100644
--- a/client/src/mobile/components/MRail.tsx
+++ b/client/src/mobile/components/MRail.tsx
@@ -1,4 +1,5 @@
-import { useLayoutEffect, useRef, type ReactNode, type RefObject } from 'react';
+import { useLayoutEffect, useRef, useState, type ReactNode, type RefObject } from 'react';
+import { edgeFadeClass, useEdgeFade } from './useEdgeFade';
/**
* The rail on the leading edge that takes the dock's place on a wide window
@@ -27,6 +28,9 @@ export function MRail({
}) {
const listRef = useRef<HTMLDivElement>(null);
useEvenLines(listRef);
+ // On a short window the entries scroll; the cut edge fades, so the foot's entries read as more below.
+ const [list, setList] = useState<HTMLDivElement | null>(null);
+ const fade = useEdgeFade(list, 'y');
return (
<nav
aria-label={label}
@@ -34,8 +38,11 @@ export function MRail({
>
{head && <div className="mb-2 flex flex-none justify-center">{head}</div>}
<div
- ref={listRef}
- className="flex min-h-0 w-full flex-1 flex-col items-center gap-1 overflow-y-auto px-1 [scrollbar-width:none]"
+ ref={(node) => {
+ listRef.current = node;
+ setList(node);
+ }}
+ className={`flex min-h-0 w-full flex-1 flex-col items-center gap-1 overflow-y-auto px-1 [scrollbar-width:none] ${edgeFadeClass(fade, 'y')}`}
>
{children}
</div>
diff --git a/client/tests/unit/mobile/MNavRail.test.tsx b/client/tests/unit/mobile/MNavRail.test.tsx
index 776910337..5146863f0 100644
--- a/client/tests/unit/mobile/MNavRail.test.tsx
+++ b/client/tests/unit/mobile/MNavRail.test.tsx
@@ -9,7 +9,7 @@ import { useAddonStore } from '../../../src/store/addonStore';
import { useAuthStore } from '../../../src/store/authStore';
import { usePluginStore } from '../../../src/store/pluginStore';
import { buildUser } from '../../helpers/factories';
-import { fireEvent, render, screen, within } from '../../helpers/render';
+import { act, fireEvent, render, screen, within } from '../../helpers/render';
import { setSizeClass } from '../../helpers/sizeClass';
// FE-MOB-RAIL-001 onwards
@@ -84,6 +84,24 @@ describe('MNavRail', () => {
expect(within(rail()).getByRole('button', { name: 'My Trips' })).not.toHaveAttribute('aria-current');
});
+ it('FE-MOB-RAIL-013: on a window too short for every entry the list fades at the edge that has more behind it', () => {
+ useAuthStore.setState({ user: buildUser({ role: 'admin' }) });
+ render(<MNavRail />, { initialEntries: ['/dashboard'] });
+ const list = rail().querySelector('.overflow-y-auto') as HTMLElement;
+ expect(list.className).not.toMatch(/m-fade-/);
+ Object.defineProperty(list, 'scrollHeight', { configurable: true, value: 800 });
+ Object.defineProperty(list, 'clientHeight', { configurable: true, value: 400 });
+ act(() => {
+ list.dispatchEvent(new Event('scroll'));
+ });
+ expect(list).toHaveClass('m-fade-b');
+ list.scrollTop = 400;
+ act(() => {
+ list.dispatchEvent(new Event('scroll'));
+ });
+ expect(list).toHaveClass('m-fade-t');
+ });
+
it("FE-MOB-RAIL-004: the create button keeps the dock's meaning and its exceptions", () => {
const { unmount } = render(
<>