Studynest pro

Hiiiii

Prompt

MASTER PROMPT: BUILD "STUDYNEST PRO" === 1. MISSION === Build StudyNest Pro: a local-first study + handwriting notes + PDF organizer, built first for nursing students, that beats Notewise. It must run 100% on-device with no server, no account and no internet, and work on phones, tablets, laptops and desktops. No paywalls, no watermarks, no note limits, no tracking. My data never leaves my devices unless I turn sync on. === 2. HOW YOU MUST WORK (non-negotiable) === - Plan first. Audit anything that already exists (current app: https://studynest-nqsv81.freebuff.site/), then show the architecture, data model, folder structure and phases before writing code. If existing code is too tangled, rewrite that part cleanly rather than patching. - Earlier fixes failed. For EVERY bug: reproduce it, state the root cause in plain words, fix it, then prove it with a test or an on-device check. Never say "done" without verification. If you can't test on a device, add logs or an on-screen check and tell me exactly what to tap. - Build phase by phase. Don't start a phase until the previous one is verified. No new features while a known bug is open. - Be honest about limits. Don't claim "zero bugs"; show test results instead. === 3. TECH DECISIONS (justify any change in the plan) === - TypeScript + React + Vite. PWA with service worker (offline-first, safe update flow, no stale cache). - Wrappers: Capacitor for Android/iOS; Tauri (or Electron) for Windows/macOS/Linux; plain installable PWA for everything else (ChromeOS etc.). - Storage: IndexedDB (Dexie) for metadata; OPFS/IndexedDB blobs for PDFs and images; versioned schema migrations; navigator.storage.persist(). - Ink engine: canvas + Pointer Events (coalesced + predicted), pressure/tilt, OffscreenCanvas/Web Worker rendering where available, tiled page rendering, stroke smoothing, vector strokes. - PDF: PDF.js with worker, lazy per-page rendering, real text layer. - OCR: on-device WASM (e.g. tesseract.js) in a worker, optional and cancellable. Any cloud AI is off by default and opt-in. === 4. LOOK & FEEL === Calm, premium, Apple-Files-like. Lavender-gray base (#F4F2F7) with true dark mode, subject color-coding, rounded cards, soft shadows, translucent bars, system font (Inter/SF Pro), smooth 60fps animations, haptics, friendly empty states, skeleton loaders, 3-tip onboarding. The document is the hero: bars hide on tap; one floating toolbar; rarely used options live in a "..." menu. A global "+" offers New Notebook, Import PDF, Scan, Quick Note, Add Task, Start Focus. === 5. ADAPTIVE LAYOUTS (every device) === - Phone (<600px): bottom tabs (Home, Library, Focus, Tasks, Search), one pane at a time. - Tablet (600-1024px): collapsible sidebar + content; landscape = library and editor side by side. - Laptop/desktop (>1024px): three resizable panes (subjects, documents, editor) plus an optional right panel (annotations, thumbnails, flashcards, tasks). Pane sizes remembered. - Portrait/landscape, split-screen, foldables and window resizing must never break the canvas, selections, zoom or typed text. Use container queries, dvh, safe-area insets, no fixed pixel layouts. Manifest orientation "any"; remove every orientation lock. - Inputs are all first-class: touch (pinch, two-finger pan), pen/stylus (pressure, tilt, hover, barrel/eraser button, palm rejection; pen draws, fingers pan, with a "finger draws" toggle), mouse/keyboard (right-click menus, Ctrl+wheel zoom, space-drag pan, drag-and-drop files), and trackpad (pinch, smooth scroll). Detect pointer type per event. - Desktop extras: Ctrl/Cmd+K command palette, shortcuts (N new, O import, S save, Z/Shift+Z undo/redo, F find, B/I/U, +/-/0 zoom, tool keys P/H/E/T/V/L, arrows/PgUp/PgDn pages, Del, Esc), customizable and listed in a searchable shortcuts sheet. Tabs, multi-window, side-by-side PDF + notebook with drag-a-highlight-into-notes, native-feeling title bar, recent files, file associations, system notifications, tray quick timer, print/Save as PDF. === 6. UNIFIED EDITOR (notebook = PDF = photo) === One shared Editor and canvas engine for every file. A Document is Pages; each Page has a background (blank, lined, grid, dotted, Cornell, custom color, rendered PDF page, or photo) plus an Elements layer stored as JSON. Originals are never modified. - Tools: pen, highlighter, eraser (stroke + pixel), lasso, shapes with shape-assist, ruler/protractor, text box, image, sticky note, tape (hide/reveal for self-testing), laser pointer, undo/redo, favorite pens, full color picker with saved colors. - Pinch zoom (50-500%) must be perfect: centered on fingers, smooth, double-tap toggle, edge clamping, momentum, crisp re-render, annotations aligned at every zoom. - LIVE TEXT: with the Text tool, tapping the page creates a box at that spot with a blinking cursor and every keystroke appears instantly (contentEditable or synced textarea overlay, onInput on every keystroke, IME/composition safe, auto-grow, keyboard-aware scrolling). 10+ fonts (sans, serif, mono, handwriting), size, bold/italic/underline, alignment, text and highlight colors, heading/body presets. Boxes move, resize, rotate, double-tap to edit. - IMAGES (current bug: only rotate works): every image is an Element { id, type:"image", x, y, w, h, rotation, crop, opacity, zIndex, locked }. Tap selects; box with 4 corner handles, 4 side handles, rotate handle, min 44px touch targets, constant size at any zoom. Drag to move; corners resize with aspect ratio; sides stretch; two-finger pinch scales; non-destructive Crop with Apply/Cancel/Reset; mini toolbar (Duplicate, Delete, Forward/Backward, Lock, Crop, Opacity, Flip, Fit to width); correct math under zoom, pan and rotation; compress big photos on import. - POINTER STATE MACHINE (current bug: can't write after adding an image, glitches): strict states idle/drawing/dragging/resizing/rotating/panning/typing; input routed by active tool; release pointer capture on pointerup/pointercancel/lostpointercapture; images on a layer below strokes unless brought forward; never re-create the canvas on state changes; stress-test a page with 5+ large images and many strokes. - Pages: add/delete/duplicate/reorder/rotate, insert from another PDF or photo, thumbnail sidebar with drag-and-drop, blank/lined/grid pages inside PDFs, convert PDF to an editable notebook copy. - PDF specifics: real text highlight/underline/strike, bookmarks, outline, search, annotations side panel (tap to jump), send highlights to notes or flashcards. - Handwriting: lasso-to-text, OCR search across handwriting, scans and PDFs. - Export: PDF (no watermark), PNG, Markdown, full backup ZIP. Autosave on every change with a write-ahead journal and crash recovery; per-document version history. === 7. STUDY SYSTEM === - Subjects/Projects: the "New Project" subject-name input MUST work (live typing; required, trimmed, no duplicates, clear errors). Color, icon, rename, archive, delete. Each subject holds topics, notebooks, files, tasks. Tags, favorites, pins, recents, "continue where you left off". - Today bar with a visible "+": quick-add sheet (title, type Task/Assignment/Exam/Reminder, subject, due date/time, priority, repeat, notes, attachment; Enter saves and keeps open; natural-language dates). Sections: Overdue (red, pinned, "X days late"), Due Today, Upcoming 7 days, Done; snooze/reschedule. Assignments: status (Not started/In progress/Submitted/Done), grade, subtasks with progress bar, linked files. Never auto-delete old deadlines; searchable Past Deadlines history and archive with restore. Local reminders (1 day, 1 hour, at due time, morning digest) that persist offline. List, calendar and week-planner views with drag-to-reschedule. - Focus mode: big countdown, subject/task picker; Pomodoro, Custom, Stopwatch. The time editor MUST be visible and working: tap the timer to edit (h/m/s or typed), -5/+5/+10 buttons, preset chips (15/25/45/60/90 + saved custom), a pencil icon, Pomodoro settings (focus, short break, long break, sessions before long break, auto-start). Editable while running without losing progress. Timestamp-based so it stays accurate with the screen locked. Editable session history (duration, subject, date, manual add, delete), stats (today, weekly chart, per-subject, streak). Resume/save if the app closes mid-session. Check for duplicate Focus files, hidden CSS, unwired state and stale service-worker cache. - Flashcards from highlights/notes with spaced repetition (SM-2), quiz mode, nursing pack (drug cards, lab values, care-plan and revision templates, Cornell/lecture/summary templates). - Dashboard: exam countdown, today's tasks, streak, weekly focus time, recent notebooks. - Global search across notes, typed text, OCR text, PDF text, tasks, with filters. === 8. NAVIGATION, ROTATION, STARTUP (current bugs) === - Back button currently exits the app. Use real routing with the History API: each screen, editor, modal and popover pushes an entry; handle popstate. Back order: keyboard/popover, crop/select mode, modal/sheet, leave editor (autosave first), previous screen; on Home a double press exits ("Press back again to exit"). In-app back arrow behaves identically; Esc works on desktop; refresh restores the current screen. - Auto-rotate currently doesn't work: add a manifest with orientation "any", display "standalone", remove all orientation locks, re-measure on resize/orientationchange, and keep canvas, strokes, selections and text correct after rotation. Tell me if the PWA must be reinstalled. - Startup currently can hang on a "Opening your notes..." splash. Render the app shell immediately, load data asynchronously, and show a clear retry on failure. === 9. DATA, SYNC, RELIABILITY === - Autosave (debounced), rolling local backups, one-tap full export/import (ZIP with JSON + files), schema migrations, corrupted-data handling, empty states, global error boundary with a "your work is safe" recovery screen. No console errors or warnings. - Sync is optional and off by default: (1) manual backup/QR/local Wi-Fi transfer, (2) a folder I choose (iCloud/Drive/OneDrive/Syncthing) with conflict-safe files, (3) later, encrypted peer-to-peer on the local network. Merge per page/element with version history; never overwrite silently. - Privacy: no analytics, no tracking, no data selling. === 10. QUALITY BARS === - Performance: first paint < 1.5s; pen rendering feels instant (< 20ms per stroke segment); 60fps pan/zoom; stable memory over a 1-hour session; adaptive quality on weak devices; HiDPI handled. - Tests: Vitest unit tests (geometry/transform math, undo/redo, storage, migrations); Playwright end-to-end per viewport and input type (phone, tablet portrait/landscape, laptop mouse/keyboard, touch laptop, 4K, split-screen); stress test with a 300-page PDF, 50 images, 100k strokes. - Accessibility: 44px+ targets, contrast, focus states, ARIA, reduced motion, keyboard navigation. - General sweep: find and fix every dead button, missing handler, stale state, layout overflow, lag and data-loss path; list what you fixed. === 11. BUILD PHASES (verify each on a real device before the next) === 0. Audit, architecture, tooling, test harness, error boundary, responsive layout system, input-type detection, PWA + routing/back handling + manifest/rotation, startup that never hangs, multi-platform build pipeline. 1. Data layer, migrations, backup/export, Subjects/Projects UI (New Project input working), app shell and navigation. 2. Ink engine + unified editor core + pinch zoom + pen/S Pen/mouse/trackpad + undo/redo + pointer state machine. 3. PDF/photo backgrounds, live text typing, fonts and colors, page management. 4. Images (move/resize/crop/rotate), lasso, shapes, tape tool, no-glitch writing after adding images. 5. Annotations panel, search, OCR, export/import. 6. Today bar, tasks/assignments, overdue/history, reminders, calendar. 7. Focus timer + time editor + session history/stats. 8. Flashcards, quizzes, nursing templates. 9. Hardening: stress tests, profiling, accessibility, polish, onboarding. 10. Desktop shell (Tauri/Electron), shortcuts + command palette, tabs, multi-window and split view, device-to-device transfer/sync, installers per platform. === 12. DELIVERABLES === 1. A short written plan first (architecture, data model, files, risks). 2. After each phase: what changed, root causes of bugs fixed, test results, and a manual checklist for me. 3. Exact steps to run it locally on my phone (dev server on same Wi-Fi, PWA install, Capacitor APK that works in airplane mode, updating without data loss) and on laptop/desktop (PWA and Tauri/Electron installers). 4. Final test checklist: create a project and type its name; rotate the device; press back at every level; open a 200-page PDF and a photo and annotate with finger, S Pen and mouse; type live; add an image, then move, resize, crop, rotate it and keep writing on the same page; add and reorder pages; add tasks and check overdue; edit the focus timer; split-view a PDF and a notebook on a laptop; kill the app mid-write and confirm nothing is lost; use everything in airplane mode.

Response not available

Drag to resize

Response not available

Drag to resize

Response not available

Drag to resize
Drag to resize

Response not available

Drag to resize