aeharding / aeharding/wingover

Logbook: re-tapping the Logbook tab should scroll the list to top

Đang mở
#97 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
TypeScript
Star
0
Fork
0
Merge trung bình
4 giờ 2 phút
Pull request đã merge (30 ngày)
6

Mô tả

## What
Re-tapping the **Logbook** tab button while already on the Logbook page should scroll the flight list back to top (smooth) if it's scrolled down. Standard iOS tab convention, and it complements the status-bar-tap fix.

Today the Logbook `IonTabButton` (`src/ui/App.tsx:149-152`) has no re-tap handling, and nothing scrolls the virtualized list to top.

## Depends on #96
This shares the exact primitive built there: "scroll the active Logbook `virtua` list to top." Voyager keeps these two paths deliberately parallel — a `statusTap` listener and a separate `scrollUpIfNeeded` for tab re-tap — and even flags them as semi-duplicated:
- `src/helpers/scrollUpIfNeeded.ts` — https://github.com/aeharding/voyager/blob/main/src/helpers/scrollUpIfNeeded.ts (reads the virtua handle's `scrollOffset` to decide whether a scroll is needed, then scrolls the `.virtual-scroller` node / calls `scrollToIndex(0, { smooth })`).

So: land #96 first, extract the shared helper, then this issue just wires it to the tab re-tap.

## Implementation notes
- **Detect the re-tap.** Ionic React's `onIonTabsWillChange` does not fire when the active tab is tapped again, so this needs handling on the Logbook `IonTabButton` itself (intercept its click / router event when the current route is already `/logbook`). Worth checking how Voyager's tab bar detects re-selection.
- **Scroll only if needed.** Read the `virtua` `VirtualizerHandle.scrollOffset` (exposed via the `FlightList` `virtualizer` ref, `src/ui/logbook/FlightList.tsx`) — if `> 0`, call the shared scroll-to-top helper (`scrollTo(0)` / `scrollToIndex(0, { smooth: true })`, or scroll the `IonContent` inner element).
- Unlike the status-bar tap (second-tap-restores-position), a tab re-tap should just go to top; no need to restore.

## Acceptance criteria
- On the Logbook page, scroll down, tap the Logbook tab again → list smooth-scrolls to top.
- Tapping the Logbook tab from another tab still just navigates (no unexpected scroll jump).
- When already at top, a re-tap is a no-op (no jitter).

## References
- Wingover: `src/ui/App.tsx:149-152` (Logbook `IonTabButton`), `src/ui/logbook/FlightList.tsx` (`virtualizer` handle)
- Voyager `scrollUpIfNeeded.ts`: https://github.com/aeharding/voyager/blob/main/src/helpers/scrollUpIfNeeded.ts
- Voyager `useGetAppScrollable.ts`: https://github.com/aeharding/voyager/blob/main/src/helpers/useGetAppScrollable.ts
- virtua `VirtualizerHandle` (`scrollOffset`, `scrollTo`, `scrollToIndex`): https://github.com/inokawa/virtua/blob/main/src/react/Virtualizer.tsx

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.