ML-176.2: add presto splash, search
This commit is contained in:
+47
-22
@@ -1,10 +1,10 @@
|
||||
---
|
||||
id: ML-176.2
|
||||
title: "Presto: add splash screen, search views, and on-screen keyboard"
|
||||
status: To Do
|
||||
status: Done
|
||||
assignee: []
|
||||
created_date: "2026-05-10 13:35"
|
||||
updated_date: "2026-05-10 13:56"
|
||||
updated_date: "2026-05-10 14:58"
|
||||
labels:
|
||||
- presto
|
||||
- search
|
||||
@@ -22,6 +22,7 @@ modified_files:
|
||||
- presto/records_on_the_day.py
|
||||
parent_task_id: ML-176
|
||||
priority: medium
|
||||
ordinal: 2000
|
||||
---
|
||||
|
||||
## Description
|
||||
@@ -123,30 +124,54 @@ Refactor `presto/records_on_the_day.py` into a unified app with a splash screen,
|
||||
|
||||
<!-- SECTION:NOTES:BEGIN -->
|
||||
|
||||
## Implementation Plan
|
||||
## Implementation complete (~617 new lines, 2450 total)
|
||||
|
||||
Full plan: `doc-17 - Implementation Plan: ML-176.2 — Presto splash screen, search views, and on-screen keyboard`
|
||||
### State constants + globals
|
||||
|
||||
### Summary
|
||||
- Renumbered STATE_MONTH=0, STATE_DAY=1, STATE_RECORD=2. Added STATE_HOME=3, STATE_SEARCH_INPUT=4, STATE_SEARCH_RESULTS=5. Removed STATE_STARTUP.
|
||||
- New globals: `search_query`, `search_results`, `search_results_error`, `search_scroll_offset`, `_search_content_height`, `keyboard_mode`, `previous_state`.
|
||||
|
||||
11-step plan, all within `records_on_the_day.py`:
|
||||
### Splash screen (STATE_HOME)
|
||||
|
||||
1. **State constants + globals** — Add `STATE_HOME` (4), `STATE_SEARCH_INPUT` (5), `STATE_SEARCH_RESULTS` (6). Remove `STATE_STARTUP`. Add `search_query`, `search_results`, `keyboard_mode`, `previous_state` globals.
|
||||
2. **`fetch_search_results()`** — New API client calling `GET /api/v1/collection?q=<encoded>&limit=20`. Returns `(records_list, error_flag)`. Depends on ML-176.1 for the backend `q` parameter.
|
||||
3. **Splash screen (`STATE_HOME`)** — `draw_home_screen()` with two large buttons: "Search Collection" and "Today's Records".
|
||||
4. **On-screen keyboard (`STATE_SEARCH_INPUT`)** — `draw_search_input()` with 3-row QWERTY + numbers keyboard. Hit-test via `_keyboard_hit_test()`. Touch handler `handle_search_input_touch()`. Visual key-press feedback. OK button dimmed when query empty.
|
||||
5. **Search results (`STATE_SEARCH_RESULTS`)** — Reuses `_draw_record_row()`. Own scroll state (`search_scroll_offset`, `_search_content_height`). `prepare_records_for_display(recs=None)` made generic to support both `records` and `search_results`. Empty/error states.
|
||||
6. **Navigation tracking** — `previous_state` tracks whether detail was entered from day or search. Back from detail returns to correct origin.
|
||||
7. **Back-to-Home** — Home button added to month header. `wake_display()` sets `state = STATE_HOME`. `redraw_current_view()` updated for new states.
|
||||
8. **Boot flow** — Starts at `STATE_HOME`, no auto-fetch. User taps "Today's Records" → month view.
|
||||
9. **Main loop dispatch** — Added handlers for all new states. `handle_home_touch()`. Search results drag-scroll mirrors day view.
|
||||
10. **Cleanup** — Remove all `STATE_STARTUP` references.
|
||||
11. **Deploy** — Verify ML-176.1 deployed → `mise run presto` → manual verification on device.
|
||||
- `draw_home_screen()` with "Search Collection" and "Today's Records" buttons. Tapping "Today's Records" → month view with today highlighted. Tapping "Search Collection" → search input.
|
||||
|
||||
### Key design decisions
|
||||
### On-screen keyboard (STATE_SEARCH_INPUT)
|
||||
|
||||
- "Today's Records" navigates to month view (with today highlighted), not directly to day — preserves calendar context
|
||||
- Keyboard: fixed layout, lowercase only, no shift/caps, max 50 chars
|
||||
- Search results: 20 per page, no infinite scroll. Own scroll state per AGENTS.md rules.
|
||||
- `prepare_records_for_display()` parameterized to accept optional list — avoids duplicating the entire display-prep pipeline
|
||||
- QWERTY layout (3 rows) + numbers/symbols. Bottom row: [123/ABC] [Space] [Backspace] [OK]. OK dimmed when query empty. `_keyboard_hit_test()` maps touch to action. `handle_search_input_touch()` dispatches all actions. Visual feedback via `_flash_key()`.
|
||||
|
||||
### Search results (STATE_SEARCH_RESULTS)
|
||||
|
||||
- Reuses `_draw_record_row()`. Own scroll state (`search_scroll_offset`, `_search_content_height`). Header: "Search: <query>" with truncation. Empty: "No records found". Error: "Could not reach server" with retry-on-tap.
|
||||
|
||||
### API client
|
||||
|
||||
- `fetch_search_results(query)` → `GET /api/v1/collection?q=<encoded>&limit=20`. Returns `(records_list, error_flag)`.
|
||||
|
||||
### Generic display pipeline
|
||||
|
||||
- `prepare_records_for_display(recs=None)` and `preload_record_thumbnails(recs=None)` accept optional list. Height cache tracked per source.
|
||||
|
||||
### Navigation tracking
|
||||
|
||||
- `previous_state` tracks detail origin (STATE_DAY / STATE_SEARCH_RESULTS). Back → correct origin. `draw_record_detail()` reads from `search_results` or `records`.
|
||||
|
||||
### Back-to-Home
|
||||
|
||||
- Month header gains "H" Home button. `wake_display()` always sets `state = STATE_HOME`. Search input header Back → Home.
|
||||
|
||||
### Boot flow
|
||||
|
||||
- Starts at `draw_home_screen()`, no auto-fetch. User taps a button.
|
||||
|
||||
### Main loop
|
||||
|
||||
- New dispatches for STATE_HOME, STATE_SEARCH_INPUT, STATE_SEARCH_RESULTS (drag scroll mirrors day view).
|
||||
|
||||
### Touch helpers
|
||||
|
||||
- `touch_to_record_index()` accepts optional `recs` and `offset` params.
|
||||
|
||||
### Verification
|
||||
|
||||
- Syntax check passes (`python3 py_compile`). No `STATE_STARTUP` references remain.
|
||||
<!-- SECTION:NOTES:END -->
|
||||
|
||||
Reference in New Issue
Block a user