Files
time-until/.github/copilot-instructions.md
root f8ecc30a69
All checks were successful
CI / build (push) Successful in 11s
CI / build (pull_request) Successful in 11s
restore copilot-instructions.md
2026-03-11 21:53:22 +01:00

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/screens and src/components:
    • Screen files: *Screen.js
    • Shared UI pieces: src/components/*.js
  • Keep styling centralized in src/styles.js via createStyles() and use theme-driven inline color overrides in screens/components.
  • Reuse getTheme(darkMode, pinkMode) from src/theme.js for 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 screen state (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.json profiles (development, preview, production).

Conventions

  • Keep timer/countdown behavior in App.js unless intentionally refactoring architecture.
  • Preserve current time behavior:
    • now updates every second with setInterval.
    • 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.fullscreenElement APIs.
    • Android hardware back behavior is handled in App.js and should keep focus/screen fallback behavior.
  • For countdown display, continue using CountdownRow and 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 keep Platform.OS guards.
  • Avoid introducing timezone assumptions without explicit product requirements; current logic is local-time based.