# Ofi redesign: developer handoff

The clickable prototype is the reference: https://ofi-maquette.pages.dev (desktop: color panel + phone frame)
and https://ofi-maquette.pages.dev/app (phone). Values below match `app.css` and `tokens.json`.

## 0. For the Flutter app (aligned on the dev team's spec, 22/11)

- The app is **Flutter 3.44, Material 3**, light mode only. The prototype is HTML: rebuild each screen in Flutter on
  `lib/student/ui/tokens.dart` and `theme.dart`. Nothing here depends on a web view.
- **Colors = the app's 9 roles.** The prototype uses only those 9 roles (accent, accentStrong, accentSoft,
  surfaceSunken, line, text1–3, onAccent). Lighter tints are the same role with opacity (`withValues(alpha:)`), and
  the recording screen background is `text1`. Per-theme hex values are in `tokens.json` (`colorRoles.themes`), and
  the desktop link shows them live with a "Copy for tokens.dart" button. **The gradient is the only extra**: it needs
  a 10th role (`gradientEnd`). Without it, buttons are solid `accentStrong`.
- **Icons**: Material Icons, rounded (`Icons.<name>_rounded`). Map: mic, pause, stop, play_arrow, chevron_left,
  expand_more, chevron_right, close, upload_file, translate, groups, person, calendar_today, schedule,
  notifications, search, ios_share, link, more_vert, edit, style (flashcards), quiz, forum (Ask Ofi), fact_check
  (Exercise check), auto_fix_high (Fix with Ofi), star, bookmark_add (mark a moment), check, content_copy,
  arrow_upward (send), add, photo_camera, shield, lock, workspace_premium, home, menu_book, auto_awesome,
  smartphone, description, refresh, delete, campaign, explore, info, logout, lightbulb, graphic_eq, login,
  person_add, tune, history, picture_as_pdf. Full map by prototype name: `icones.js`, `const MATERIAL`.
- **Type**: Assistant 300–800; Varela Round only for the Ofi wordmark. **Radii**: 10, 14, 20, 28.
  **Spacing**: 4, 8, 12, 16, 20 (prototype values round to the nearest step). **Reference screen**: iPhone 6.9",
  440 × 956 pt (the desktop link draws that phone).
- **RTL**: every screen must work in Hebrew. Use `EdgeInsetsDirectional`, `AlignmentDirectional`, start/end
  instead of left/right; flip chevrons and swipe directions; keep timers, prices and the waveform left-to-right.
  The prototype now runs in Hebrew too (section 5); every string is in `textes-he.json`.
- **Motion in Flutter**: curves in `tokens.json` (`motion.flutter`), e.g. screens and sheets `Cubic(0.32, 0.72, 0, 1)`
  over 420/460 ms. Reduce Motion = `MediaQuery.disableAnimationsOf(context)`. Haptics: `HapticFeedback.lightImpact`
  (tab, plan), `mediumImpact` (Record, Finish), `selectionClick` (flashcard swipe, quiz answer).
- **Not designed yet**: the wide web layout with the side menu. A new brand color also means a new app icon,
  store screenshots and website.

Items marked **NEW** need backend or platform work. Everything else redesigns a feature that exists today.

## 1. Global changes

- **Bottom tab bar** with five slots: Home, Courses, Record (raised, center), Groups, Me. Replaces the three round
  header buttons (groups, folder, person), whose meaning was unclear. The Record button is 66 pt, `blue500`,
  lifted 14 pt, with a 6 pt white ring and a slow halo (2.6 s loop, stops when Reduce Motion is on).
  While recording it turns `danger` red and shows a waveform glyph.
- **One icon set**, 1.8 pt stroke, rounded caps (see `icones.js`). Same weight everywhere.
- **Course colors** (purple, blue, teal, orange, from the existing calendar) tag lectures, the recording screen and
  the timetable. They are the only accent besides brand blue.
- **Large titles** collapse into a centered nav title after 46 pt of scroll, with a hairline separator.
- **Sheets** (bottom) for every choice: language, course, upload type, rename, share, sort, rules, invite.
  Drag down 110 pt to dismiss. Use native sheets (`.presentationDetents` / `@gorhom/bottom-sheet` / `showModalBottomSheet`).

## 2. Screens

| Screen | What changes | Key states |
|---|---|---|
| Sign in | Two-line headline, second line in brand blue. "Send me a code" disabled until the 18+ box is checked **and** the number has 9+ digits. Number auto-formats `050-123-4567`. | disabled, enabled |
| SMS code | Six boxes; `textContentType = .oneTimeCode` so iOS offers "From Messages". Auto-submit at 6 digits, boxes turn green with a 40 ms stagger. Resend countdown kept. | empty, typing, success |
| Name | Same fields, opt-in and source chips (single select). TikTok added to sources. | |
| Tour | Four slides, swipe or Next; the mini phone content animates in. Last slide shows the price note and "Let's start". | |
| Home, new student | Three animated steps (Record, Summary, Study), "Start recording", "Or upload a file", language chip, "Snap your timetable" card, study group banner. | free 2/2 |
| Home, returning | Greeting + date. Plan line with a 2-segment meter. **Up next** card from the timetable: course, time, room, live countdown, "Record it" (starts a recording already filed under that course). Today's classes as chips, the past one struck through. Two tiles: hours this month (ring), days to next exam. Recent lectures with date sort and course filter chips. Upload card. Dismissible group banner. | free 1/2, free 0/2 (amber line), recording minimized |
| Recording | Dark screen (`surface.recording`). Course chip (tap to change) and language button in the header. Center: voice-reactive glow + 132 pt mic disc, 64 pt light timer, live waveform, marked moments as chips. Buttons: Pause/Resume, Mark moment **NEW**, Finish. Chevron minimizes to a **mini bar** above the tab bar (timer, mini waveform, pause). "Matched to your timetable" **NEW**. | recording, paused, minimized |
| Finish | Confirmation sheet: duration, course, number of moments. "Finish and summarize", "Keep recording", "Discard this recording" (second confirmation). | |
| Notification ask | Shown once, right after the first Finish (the moment the value is obvious), not at launch. | |
| Processing | Four steps with a vertical line: Uploading (progress bar), Transcribing, Writing your summary, Making flashcards and a quiz. Skeleton preview, rotating study tip. At the end: green summary line and "Open your summary". | per step |
| Lecture | Course chip, title with rename, meta. Tabs Summary/Transcript with a sliding underline. Four tool tiles (Flashcards, Quiz, Ask Ofi, Exercise check) with counts. Daily limits line + See plans (free). Short/Detailed/Full segmented control with a sliding thumb. Fix with Ofi (sheet with quick requests). Summary opens with a "Key takeaways" card; key terms highlighted. Ask Ofi bar pinned at the bottom. Header: link, share (PDF, Word, link, study group), more (move, language, delete). | Short, Detailed, Full, Transcript |
| Transcript | Timestamped lines; moments marked during recording are highlighted amber **NEW**. | |
| Flashcards | Card stack, tap to flip (3D, 560 ms spring), swipe right Got it / left Still learning, buttons for the same. Progress bar and count. End: "Deck done", review the missed ones. | front, back, done |
| Quiz | One question per screen, four options. Wrong answer shakes; right answer always shown green with an explanation. Score ring at the end. | unanswered, right, wrong, score |
| Ask Ofi | Three suggested questions. Typing dots, then the answer streams word by word. "From your lecture" source line **NEW** (citations to timestamps). | |
| Paywall | Order changed: limit banner (if any), compact headline with the Ofi logo, **plans first** (Yearly preselected, "Save 45%" badge, per-month price), then "What you get", then the legal text (follows the selected plan), Terms, Privacy, Manage subscriptions, Restore. Sticky CTA shows the selected price. | yearly, monthly, after free limit |
| Courses | Next class and next exam lines, month calendar with course dots and the exam circled, course list with schedule and room, "Upload or snap your timetable", "New course". | |
| Groups | Empty state with classmates orbiting the group icon. Join with a code, New group → rules sheet (once) → name → invite sheet (code appears letter by letter, Copy turns into Copied). Group page: chat card with unread count, shared summaries, share one of my lectures. Chat: history note, tag a lecture in a message. | empty, new group, active group |
| Me | Profile with photo and Edit, hours ring, My plan, My courses, App language, Notifications, Tips toggle, Quick tour, Terms, Privacy, Sign out, Delete account. | free, premium |

### Added after the owner's 12 screenshots

| Screen | What it does |
|---|---|
| Exercise check | Full screen, not a sheet. Dark viewfinder with breathing corner brackets, shutter (white flash 260 ms). Analysis: the photo settles in, a scan line sweeps it, three steps appear (650 ms apart). Result: red verdict card, the exercise, "Your steps" checked one by one (420 ms stagger, check pops with `spring`, the wrong step is struck through and shakes), "The right way" in green, the correct solution, the lecture where it is explained, "Check another exercise". |
| Course page | From My courses. Course-color hero card (gradient to the theme's second color), schedule chip, exam countdown ring with Start (whole-course quiz), Flashcards (to review), Whole-course quiz, Ask Ofi about the whole course, the course's lectures, sticky "Add lectures". |
| Home: cards to review | "12 cards to review" card under the tiles; a mini card stack where the top card slides away every 3.2 s. |
| Flashcards | Buttons "Didn't know" / "Knew it", and the spaced-repetition note under the stack. |
| Ask Ofi | Notice at the top ("Ofi answers only from your lecture…"). Each answer ends with timestamp chips; a tap goes back to the lecture, opens Transcript and highlights the line. |

### Color themes

The owner is testing other colors than blue. Every color derives from two inputs: color 1 (brand) and color 2
(gradient end), plus a gradient on/off switch. Presets in the prototype: Violet `#7B5CFA → #C056F0` (default),
Sunrise `#F2546B → #E8673A`, Mint `#0E9F8E → #2FA572`, Lagoon `#4F46E5 → #0891B2`, Current blue `#2A6DB8` (no
gradient). Derived from color 1: the app's 9 color roles (section 0, `rolesTheme` in `app.js`). A color too light for white text is darkened until
it reaches 3:1. The gradient fills primary buttons, the Record button (slow 5 s shift), progress bars and the mic
disc; the recording glow layers use both colors. `tokens.json` still holds the blue values until a theme is chosen.

## 3. Motion

| Moment | Spec |
|---|---|
| Screen push / pop | 420 ms, `ios` curve, previous screen moves −28 % (iOS default parallax). |
| Modal (recording, paywall, flashcards, quiz) | Slide up 460 ms `ios`, down 360 ms `in`. |
| Sheet | Up 460 ms `ios`; out 300 ms `in`; scrim fades 300 ms. |
| Tap feedback | Scale 0.975 and 1 pt down, 120 ms. |
| Tab change | Icon pops 0.82 → 1 with the `spring` curve, 380 ms. |
| Recording glow | Three soft color layers rotate slowly (9 s, 13 s, 17 s) and scale with the input level (0.82 → ~1.4). The mic disc scales 1 → 1.16. Level = RMS of the mic buffer, smoothed (0.72 old / 0.28 new), sampled every 55 ms for the waveform. Pause dims everything. |
| Waveform | Rounded bars, newest on the right, older bars fade. 90 bars on the recording screen, 14 in the mini bar. |
| Dynamic Island / Live Activity **NEW** | While recording: red dot + timer in the compact Live Activity; lock screen shows course and timer. ActivityKit on iOS. |
| Processing | Current step: spinning ring; done: green check pops (380 ms spring); line turns green. |
| Summary | Blocks fade up 10 pt, 45 ms stagger, only on first open. |
| Segmented controls and tabs | Thumb or underline slides 340–360 ms `ios`. |
| Flashcard | Flip 560 ms `spring`; fly-out 420 ms `in` with 18° rotation. |
| Quiz | Wrong: 380 ms shake; explanation fades up. |
| Paywall | Plan radio dot scales in with `spring`; CTA label crossfades up 8 pt. |
| Invite code | Characters pop in with a 40 ms stagger; Copy → Copied for 1.8 s. |
| Toasts | Drop in from the top with `spring`, leave after 2.2 s. |

**Reduce Motion:** no glow rotation, no halos, no flips or fly-outs; states change instantly or with a 150 ms
crossfade. Nothing loops.

**Haptics (iOS):** light impact on tab change and plan selection; medium on Record start and Finish; success
notification when the summary is ready; selection feedback on each flashcard swipe and quiz answer.

## 4. Accessibility

- Support Dynamic Type up to at least XXL: let cards grow, never truncate status chips.
- VoiceOver labels on every icon button (the prototype's `aria-label`s are the wording).
- Contrast: body text on white and on `card` passes 4.5:1; amber and green chips use their dark foreground.
- Minimum touch target 44 × 44 pt.
- The recording screen must stay usable with the screen locked (existing behavior) and announce state changes.

## 5. Right-to-left

The prototype runs in English and in Hebrew. Like the app, it follows the phone's language; the desktop link has an
English / עברית switch, and Me > App language changes it inside the app (Automatic, עברית, English).

- **Strings**: `textes-he.json` lists every UI string, English and Hebrew (470). Tone: buttons are action
  nouns ("שמירה", "התחלת הקלטה"), instructions use the plural ("הקישו", "צלמו"), Ofi speaks to Maya in the feminine
  singular. Brand names stay Latin (Ofi, App Store, Apple, Google). Prices: `29.90 ₪` with a no-break space.
  The sample content (courses, summary, transcript, flashcards, quiz) is also in Hebrew in the prototype.
- **Mirrored** (Flutter does most of it with `Directionality`): layout order, `EdgeInsetsDirectional`, the push
  direction of screens (a new screen enters from the left), chevrons and back arrows (`matchTextDirection: true`;
  in the prototype: chevron_left, chevron_right, login, logout), the onboarding carousel (first slide on the right,
  swipe right for next), the summary level segment and the Summary/Transcript tab indicator (start from the right),
  switches (on = knob on the left), chat bubbles (mine on the left), quiz letters א ב ג ד, calendar weeks starting
  with א׳ on the right, avatar initials in Hebrew.
- **Not mirrored**: the iOS status bar, the logo lockup, the record timer and waveform, time stamps, math in
  Exercise check (`z = (82 − 70) / 8` stays left to right, isolated), phone numbers (+972), the SMS code boxes,
  the group invite code and link. Flashcards keep "swipe right = knew it", as in most Hebrew apps.
- **Bidi**: wrap numbers, times and Latin words inside Hebrew lines in an isolate (`Text.rich` with
  `TextDirection.ltr` spans, or Unicode FSI/PDI). A one-letter Hebrew prefix before a number or a Latin word takes
  a maqaf: "ב־12:04", "מ־Ofi", "ייצוא ל־PDF". Hebrew is never letter-spaced or uppercased.
- **Font**: Assistant draws both scripts. Caveat (the handwritten copy in Exercise check) has no Hebrew; the
  handwriting there is math, which stays Latin.

## 6. Open questions for the product owner

1. Mark moment, timetable matching, transcript citations in Ask Ofi, Live Activity and search are proposals
   (**NEW**). Which ones go into this release?
2. Does the backend expose upload progress? The processing screen shows a real percentage for the upload step.
3. Search across transcripts (magnifier on Home) needs an index. Keep or drop for now?
