# Smaage Frontend Prototype
## Install Requirements
```bash
uv sync
```
## Run
```bash
uv run -m frontend
```
## Navigation
- L: left press
- LL: left long press
- R: right press
- RL: right long press
- LB: long left and right press
```mermaid
stateDiagram-v2
[*] --> Main
state "Main View
(timer + weight)" as Main
state "Menu
(carousel)" as Menu
state "Bluetooth Pairing
(waiting for connection)" as BTPairing
state "Recipe Selection
(carousel)" as RecipeSelection
state "Do Recipe
(step-by-step)" as DoRecipe
state "Edit Recipe
(step list)" as EditRecipe
state "Edit Recipe – Move Mode
(reorder steps)" as MoveMode
state "Edit Step – Type Selection
(list view)" as TypeSelect
state "Edit Step – Value Entry
(morse input)" as ValueEntry
state "Edit Step – Goal Time Entry
(morse input)" as GoalTime
Main --> Menu : LB
Main --> RecipeSelection : RL
Menu --> Main : LL [back]
Menu --> BTPairing : RL [BT Pair]
BTPairing --> Menu : LL [cancel]
RecipeSelection --> Main : LL
RecipeSelection --> DoRecipe : RL [on recipe → run]
RecipeSelection --> EditRecipe : LB [on recipe → edit]
or RL [on + → add]
DoRecipe --> Main : LL [back]
or R [last step → done]
EditRecipe --> RecipeSelection : LL [back]
or RL [on save]
EditRecipe --> TypeSelect : RL [on step]
or RL [on + → add step]
EditRecipe --> ValueEntry : RL [on name]
EditRecipe --> MoveMode : LB [on step]
MoveMode --> EditRecipe : LB [confirm]
or LL [cancel]
TypeSelect --> ValueEntry : RL [type with value]
TypeSelect --> EditRecipe : RL [type w/o value → saved]
or RL [delete → deleted]
or LL [back]
ValueEntry --> EditRecipe : LL [save]
or L [cancel]
ValueEntry --> GoalTime : LL [WEIGH_WITH_TIMER]
GoalTime --> EditRecipe : LL [save]
or L [cancel]
```
## Tools
### `export_loading_frames.py`
Renders the loading screen animation and exports every unique frame as both PNG files and a NumPy array.
**Usage**
```bash
uv run export_loading_frames.py [--out-dir ]
```
| Argument | Default | Description |
|---|---|---|
| `--out-dir` | `frames/` | Directory to write output files into |
**Outputs**
| File | Description |
|---|---|
| `frames/frame_XXXX.png` | One PNG per unique frame, zero-padded index |
| `frames/frames.npy` | NumPy array of shape `(N, H, W)`, dtype `bool` |
Consecutive duplicate frames are collapsed so only visually distinct frames are exported. The script prints the total number of frames rendered and the number of unique frames kept.