2.3 KiB
2.3 KiB
Project Guidelines
Code Style
- Keep components as functional React components and use hooks-based state.
- Follow existing naming and structure in
src/screensandsrc/components:- Screen files:
*Screen.js - Shared UI pieces:
src/components/*.js
- Screen files:
- Keep styling centralized in
src/styles.jsviacreateStyles()and use theme-driven inline color overrides in screens/components. - Reuse
getTheme(darkMode, pinkMode)fromsrc/theme.jsfor color values; do not hardcode alternate palettes in individual screens.
Architecture
- Root orchestration lives in
App.js:- App-level state includes current screen, focus mode, theme toggles, and timer/countdown state.
- Screen switching is controlled by the
screenstate (home,timeuntil,timer).
- Screen responsibilities:
HomeScreen: mode selection and top controls.TimeUntilScreen: target clock-time countdown flow.TimerScreen: duration countdown flow.FocusScreen: minimal fullscreen countdown UI.
- Shared presentational components:
TopControls: dark/pink/fullscreen/focus controls.CountdownRow: reusable HH:MM:SS display.
Build And Run
- Install dependencies:
npm install - Start dev server:
npm start - Run on Android:
npm run android - Run on iOS:
npm run ios - Run on web:
npm run web - EAS builds use
eas.jsonprofiles (development,preview,production).
Conventions
- Keep timer/countdown behavior in
App.jsunless intentionally refactoring architecture. - Preserve current time behavior:
nowupdates every second withsetInterval.- Time-until target is based on local device time and rolls to next day when target time has passed.
- Maintain platform guards:
- Web-only fullscreen uses
document.fullscreenElementAPIs. - Android hardware back behavior is handled in
App.jsand should keep focus/screen fallback behavior.
- Web-only fullscreen uses
- For countdown display, continue using
CountdownRowand 2-digit padded units for consistency.
Pitfalls
- This project has no test scripts configured; do not claim tests were run unless you add and run them.
- Be careful with web-only globals (
document) and keepPlatform.OSguards. - Avoid introducing timezone assumptions without explicit product requirements; current logic is local-time based.