aeharding / aeharding/wingover

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

Abierto
#97 0 comentarios 0 reacciones 0 asignados Ver en GitHub
enhancement
Lenguaje dominante
TypeScript
Estrellas
0
Forks
0
Merge medio
4 h 2 min
PR fusionados (30 d)
6

Descripción

## 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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.