Spaces:
Build error
Build error
fix: clarify card data structure and button visibility in two-phase spec
Browse files- Mock data uses front=English, back=translation (not Latvian→English)
- Explicit button visibility per state (both hidden after media complete)
docs/superpowers/specs/2026-06-09-two-phase-card-generation-design.md
CHANGED
|
@@ -59,6 +59,11 @@ Three states control button visibility, toggle interactivity, and card content:
|
|
| 59 |
| **Text Generated** | Hidden or disabled | Disabled | Active, clickable | English text + dashed placeholder back |
|
| 60 |
| **Media Complete** | Hidden | Enabled (based on user choice) | Hidden | Full cards with EN, translations, images, audio |
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
### State Transitions
|
| 63 |
|
| 64 |
1. **Idle → Text Generated:** User clicks "Generate Text"
|
|
@@ -99,11 +104,13 @@ generate_cards_btn.click(
|
|
| 99 |
```python
|
| 100 |
def render_card_html(card_data, include_image=False, include_audio=False, rotation=0.0, placeholder_back=True):
|
| 101 |
# When placeholder_back=True: renders dashed line instead of translation text
|
| 102 |
-
# When placeholder_back=False: renders actual back-text from card_data["
|
| 103 |
```
|
| 104 |
|
| 105 |
**Update `generate_cards_html()` to accept and pass through `placeholder_back`.**
|
| 106 |
|
|
|
|
|
|
|
| 107 |
### 3. `frontend/ui/widgets.py` — Toggle Helper
|
| 108 |
|
| 109 |
**Add optional `interactive` parameter:**
|
|
|
|
| 59 |
| **Text Generated** | Hidden or disabled | Disabled | Active, clickable | English text + dashed placeholder back |
|
| 60 |
| **Media Complete** | Hidden | Enabled (based on user choice) | Hidden | Full cards with EN, translations, images, audio |
|
| 61 |
|
| 62 |
+
**Button visibility per state:**
|
| 63 |
+
- Idle: "Generate Text" visible, "Generate Cards" disabled (greyed out)
|
| 64 |
+
- Text Generated: "Generate Text" hidden, "Generate Cards" visible and active
|
| 65 |
+
- Media Complete: Both buttons hidden. Only export buttons (.apkg, .csv, Sync to Anki) remain.
|
| 66 |
+
|
| 67 |
### State Transitions
|
| 68 |
|
| 69 |
1. **Idle → Text Generated:** User clicks "Generate Text"
|
|
|
|
| 104 |
```python
|
| 105 |
def render_card_html(card_data, include_image=False, include_audio=False, rotation=0.0, placeholder_back=True):
|
| 106 |
# When placeholder_back=True: renders dashed line instead of translation text
|
| 107 |
+
# When placeholder_back=False: renders actual back-text from card_data["translation"]
|
| 108 |
```
|
| 109 |
|
| 110 |
**Update `generate_cards_html()` to accept and pass through `placeholder_back`.**
|
| 111 |
|
| 112 |
+
**Mock data note:** Current mock data uses `{"front": <Latvian>, "back": <English>}`. For the two-phase flow, we invert: cards show English text on front (`card_data["text"]`), with placeholder or actual translation on back (`card_data["translation"]`). The `generate_media_async()` function populates `card_data["translation"]` during media generation.
|
| 113 |
+
|
| 114 |
### 3. `frontend/ui/widgets.py` — Toggle Helper
|
| 115 |
|
| 116 |
**Add optional `interactive` parameter:**
|