Skip to content

A modern React timer app with Pomodoro technique, ambient sounds, statistics tracking, and dark/light themes. Built with TypeScript and Vite.

License

Notifications You must be signed in to change notification settings

stevenmoraleszeta/timer-chill-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

38 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Timer & Chill

React TypeScript Vite License

A modern, responsive, and professional React timer application with ambient sounds for focus, study, and relaxation.

Features โ€ข Installation โ€ข Documentation โ€ข Development


โœจ Introduction

Timer & Chill is a modern, fully-featured React application designed to help users maintain focus and productivity through customizable timers and ambient soundscapes. Built with React 18, TypeScript, and Vite, this project demonstrates professional front-end development practices including:

  • โšก Fast Development - Vite for lightning-fast HMR
  • ๐Ÿ—๏ธ Scalable Architecture - Modular components, custom hooks, and context providers
  • ๐ŸŽจ Modern Styling - CSS Modules with CSS Custom Properties
  • โ™ฟ Accessibility First - ARIA labels, keyboard navigation, and semantic HTML
  • ๐Ÿ“ฑ Fully Responsive - Mobile-first design with breakpoints
  • ๐Ÿ”’ Type Safety - Full TypeScript support
  • ๐Ÿงช Production Ready - Error boundaries, error handling, and optimizations

๐Ÿš€ Technologies Used

Core Technologies

  • React 18 - Modern React with hooks
  • TypeScript - Type-safe development
  • Vite - Next-generation frontend tooling
  • CSS Modules - Scoped styling

Key Libraries

  • react-icons - Icon library (Bootstrap Icons) for UI elements
  • Typed.js - Animated typing effect for activity display
  • Web Audio API - For ambient sound playback
  • Notifications API - Browser notifications for timer completion

Development Tools

  • ESLint - Code linting and quality
  • TypeScript Compiler - Type checking

โš™๏ธ Installation

Prerequisites

  • Node.js 18+ (LTS recommended)
  • npm or yarn or pnpm

Quick Start

  1. Clone the repository

    git clone https://github.com/yourusername/timer-and-chill-prototype.git
    cd timer-and-chill-prototype
  2. Install dependencies

    npm install
    # or
    yarn install
    # or
    pnpm install
  3. Start development server

    npm run dev
    # or
    yarn dev
    # or
    pnpm dev
  4. Open your browser

    • Navigate to http://localhost:3000
    • The app will automatically reload on file changes

Build for Production

npm run build
# or
yarn build
# or
pnpm build

The production build will be in the dist folder. You can preview it with:

npm run preview
# or
yarn preview
# or
pnpm preview

๐Ÿงฉ Project Structure

timer-and-chill-prototype/
โ”‚
โ”œโ”€โ”€ public/                  # Static assets served directly
โ”‚   โ”œโ”€โ”€ audio/              # Ambient sound files (served at /audio/)
โ”‚   โ”œโ”€โ”€ images/             # Static images (e.g., notification icons)
โ”‚   โ””โ”€โ”€ favicon.png         # Site favicon
โ”‚
โ”œโ”€โ”€ src/                     # Source code
โ”‚   โ”œโ”€โ”€ assets/             # Assets processed by bundler
โ”‚   โ”‚   โ””โ”€โ”€ images/        # Component images (icons, UI elements)
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ components/         # React components (with CSS Modules)
โ”‚   โ”‚   โ”œโ”€โ”€ AnimatedText.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ ErrorBoundary.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ LanguageToggle.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ Layout.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ SoundControls.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ SoundPlayer.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ Statistics.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ ThemeToggle.tsx
โ”‚   โ”‚   โ””โ”€โ”€ Timer.tsx
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ contexts/           # React context providers
โ”‚   โ”‚   โ”œโ”€โ”€ LanguageContext.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ SoundContext.tsx
โ”‚   โ”‚   โ””โ”€โ”€ ThemeContext.tsx
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ constants/          # Constants and configuration
โ”‚   โ”‚   โ”œโ”€โ”€ index.ts
โ”‚   โ”‚   โ””โ”€โ”€ translations.ts
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ hooks/              # Custom React hooks
โ”‚   โ”‚   โ”œโ”€โ”€ useAudio.ts
โ”‚   โ”‚   โ””โ”€โ”€ useTimer.ts
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ types/              # TypeScript type definitions
โ”‚   โ”‚   โ””โ”€โ”€ index.ts
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ utils/              # Utility functions
โ”‚   โ”‚   โ””โ”€โ”€ index.ts
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ App.tsx             # Root component
โ”‚   โ”œโ”€โ”€ App.module.css      # Root component styles
โ”‚   โ”œโ”€โ”€ main.tsx            # Application entry point
โ”‚   โ”œโ”€โ”€ index.css           # Global styles and CSS variables
โ”‚   โ””โ”€โ”€ vite-env.d.ts      # Vite type declarations
โ”‚
โ”œโ”€โ”€ index.html              # HTML template
โ”œโ”€โ”€ package.json            # Dependencies and scripts
โ”œโ”€โ”€ tsconfig.json           # TypeScript configuration
โ”œโ”€โ”€ tsconfig.node.json      # TypeScript config for Node.js tools
โ”œโ”€โ”€ vercel.json             # Vercel deployment configuration
โ”œโ”€โ”€ vite.config.ts          # Vite configuration
โ””โ”€โ”€ README.md               # This file

Note: This project follows React best practices with a clean, modular structure. All legacy folders (JS/, CSS/, IMG/, AUDIO/) have been removed in favor of the modern React/Vite architecture.

๐Ÿ“‹ Features

โฑ๏ธ Timer Functionality

  • โœ… Customizable countdown timer (hours, minutes, seconds)
  • โœ… Intuitive edit mode with +/- controls
  • โœ… Play/pause functionality
  • โœ… Reset button with proper state management
  • โœ… Browser notifications on timer completion
  • โœ… Real-time countdown with accurate timing
  • โœ… Timer Presets: Quick access buttons for 5, 10, 15, 25, 30, 45, 60, and 90 minutes
  • โœ… Visual Progress Ring: Circular progress indicator showing timer completion
  • โœ… State Persistence: Timer state saved to localStorage (survives page refresh)
  • โœ… Keyboard Shortcuts: Space/Enter (play/pause), R (reset), E (edit), Ctrl+P (Pomodoro)

๐Ÿ… Pomodoro Technique

  • โœ… Full Pomodoro Mode: 25-minute work sessions with automatic breaks
  • โœ… Smart Break System: 5-minute short breaks, 15-minute long breaks after 4 sessions
  • โœ… Session Tracking: Automatic session counting and progress tracking
  • โœ… Auto-transition: Seamless transitions between work and break periods
  • โœ… Notifications: Custom notifications for work/break transitions
  • โœ… Visual Indicators: Clear display of current session type and number
  • โœ… State Persistence: Pomodoro state saved across page refreshes

๐ŸŽต Ambient Sounds

  • โœ… 6 Different Soundscapes: Rain, Forest, Cafe, Garden, Farm, Restaurant
  • โœ… Individual volume controls for each sound
  • โœ… Play/pause controls for each sound independently
  • โœ… Multiple sounds can play simultaneously
  • โœ… Optimized audio playback with error handling
  • โœ… Smooth volume transitions
  • โœ… Sound Presets: Pre-configured sound mixes (Focus, Coffee Shop, Nature, Restaurant)
  • โœ… Volume Persistence: Individual sound volumes saved to localStorage
  • โœ… Sound Context API: Centralized sound management with preset support

๐Ÿ“Š Statistics & Tracking

  • โœ… Session Statistics: Track completed timer sessions
  • โœ… Total Time: Cumulative time spent using the timer
  • โœ… Average Duration: Calculate average session length
  • โœ… Last Session Date: Track when you last completed a session
  • โœ… Persistent Storage: Statistics saved to localStorage
  • โœ… Collapsible Panel: Clean, accessible statistics interface

๐ŸŒ™ Theme System

  • โœ… Day/Night mode toggle
  • โœ… Smooth color transitions
  • โœ… CSS Custom Properties for dynamic theming
  • โœ… Persistent theme preference in localStorage
  • โœ… Context-based theme management

๐ŸŒ Internationalization (i18n)

  • โœ… Full Bilingual Support: English and Spanish
  • โœ… System Language Detection: Automatically detects browser language
  • โœ… Language Toggle: Easy switch between languages via UI button
  • โœ… Complete Translations: All UI text, notifications, and labels translated
  • โœ… Language Persistence: Selected language saved to localStorage
  • โœ… Dynamic Language Switching: Instant UI updates without page reload
  • โœ… Accessible Language Selector: ARIA labels and keyboard support

โ™ฟ Accessibility Features

  • โœ… ARIA labels and roles for screen readers
  • โœ… Keyboard navigation support
  • โœ… Focus states for all interactive elements
  • โœ… Semantic HTML structure
  • โœ… Alt text for all images
  • โœ… Reduced motion support
  • โœ… Keyboard shortcuts for all major functions

๐Ÿ“ฑ Responsive Design

  • โœ… Mobile-first approach
  • โœ… Adaptive layouts for different screen sizes
  • โœ… Touch-friendly controls
  • โœ… Optimized for desktop, tablet, and mobile devices
  • โœ… Breakpoints: 815px, 500px

๐ŸŽฏ Usage

Setting a Timer

Quick Preset Method

  1. Click any preset button (5 min, 10 min, 15 min, etc.) to instantly set the timer
  2. Click the play button to start

Manual Method

  1. Click the edit button (pencil icon) to enter edit mode
  2. Use the +/- buttons to adjust hours, minutes, and seconds
  3. Click the save button (checkmark icon) to confirm
  4. Click the play button to start the countdown
  5. Click pause to stop the timer
  6. Use the reset button (0:00) to clear the timer

Keyboard Shortcuts

  • Space or Enter: Play/Pause timer
  • R: Reset timer
  • E: Toggle edit mode
  • Ctrl+P (or Cmd+P on Mac): Toggle Pomodoro mode

Using Pomodoro Technique

  1. Click the ๐Ÿ… Pomodoro button to start Pomodoro mode
  2. The timer will automatically set to 25 minutes for work
  3. When the work session completes, a break timer will automatically start
  4. After 4 work sessions, you'll get a 15-minute long break (otherwise 5 minutes)
  5. The timer automatically transitions between work and break periods
  6. Click Stop to exit Pomodoro mode at any time
  7. Your session count and state are preserved across page refreshes

Using Ambient Sounds

Individual Sounds

  1. Click the play button next to any sound to start playback
  2. Adjust the volume slider to control the sound level
  3. Click stop to pause the sound
  4. Multiple sounds can be played simultaneously
  5. Volume settings are automatically saved

Sound Presets

  1. Click any preset button (Focus, Coffee Shop, Nature, Restaurant)
  2. The preset will automatically start the configured sounds at optimal volumes
  3. You can still adjust individual volumes after applying a preset
  4. Presets respect your saved volume preferences when available

Viewing Statistics

  1. Click the ๐Ÿ“Š Statistics button to open the statistics panel
  2. View your:
    • Total completed sessions
    • Total time tracked
    • Average session duration
    • Last session date
  3. Statistics are automatically updated when you complete a timer

Switching Themes

  • Click the sun/moon button in the header to toggle between day and night modes
  • The interface will smoothly transition between themes

Changing Language

  • Click the globe button (๐ŸŒ) in the header to switch between English and Spanish
  • The app automatically detects your browser's language on first visit
  • Your language preference is saved and will be remembered

๐Ÿš€ Deployment

Recommended Platforms

Vercel (Recommended)

# Install Vercel CLI
npm i -g vercel

# Deploy
vercel
  • Pros: Zero configuration, automatic HTTPS, global CDN, Git integration
  • Best for: Quick deployment, personal projects
  • Note: This project includes vercel.json for optimal configuration

Netlify

# Install Netlify CLI
npm i -g netlify-cli

# Build and deploy
npm run build
netlify deploy --prod
  • Pros: Drag-and-drop deployment, form handling, serverless functions
  • Best for: Static sites with forms or serverless needs

GitHub Pages

  1. Build the project: npm run build
  2. Push code to GitHub repository
  3. Go to Settings โ†’ Pages
  4. Select branch and folder (dist)
  5. Site will be available at username.github.io/repository-name

Render

  • Connect GitHub repository
  • Select "Static Site"
  • Build command: npm run build
  • Publish directory: dist

AWS S3 + CloudFront

  • Build the project: npm run build
  • Upload dist folder to S3 bucket
  • Configure static website hosting
  • Set up CloudFront distribution for CDN
  • Best for: Enterprise deployments, custom domains

๐Ÿ› ๏ธ Development

Available Scripts

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm run preview - Preview production build
  • npm run lint - Run ESLint

Code Quality Standards

  • โœ… TypeScript with strict mode
  • โœ… ESLint for code linting
  • โœ… Modular architecture with separated concerns
  • โœ… Custom hooks for reusable logic
  • โœ… Context providers for state management
  • โœ… Error boundaries for error handling
  • โœ… CSS Modules for scoped styling
  • โœ… Performance optimization (efficient hooks, memoization)

Architecture Decisions

Component Structure

  • Layout Components - Structure and layout
  • Feature Components - Timer, Sound controls
  • UI Components - Theme toggle, Animated text
  • Utility Components - Error boundary

State Management

  • React Hooks - useState, useEffect, useCallback, useRef, useMemo
  • Context API - Theme management, Sound management, Language management
  • Custom Hooks - Timer logic, Audio logic
  • localStorage - Persistent state for timer, Pomodoro, statistics, sound preferences, theme, and language

Styling Approach

  • CSS Modules - Scoped component styles
  • CSS Custom Properties - Dynamic theming
  • Mobile-First - Responsive design

๐Ÿ“Š Performance

  • โšก Fast Build - Vite for instant HMR
  • ๐ŸŽฏ Optimized Bundle - Code splitting and tree shaking
  • ๐Ÿš€ Efficient Rendering - React hooks optimization
  • ๐Ÿ“ฆ Asset Optimization - Public assets for audio files
  • ๐ŸŽจ CSS Optimization - Scoped styles, minimal re-renders

๐Ÿ”ง Configuration

Environment Variables

This project does not require environment variables as it runs entirely client-side.

TypeScript Configuration

TypeScript is configured with strict mode enabled. See tsconfig.json for details.

Vite Configuration

Vite is configured with:

  • React plugin for JSX/TSX support
  • Path aliases (@ for src directory)
  • Development server on port 3000 with auto-open
  • Production build with source maps
  • Code splitting (vendor chunk for React)

See vite.config.ts for details.

๐Ÿค Contributing

This is a personal project. For collaboration inquiries, please contact the repository owner.

๐Ÿ“œ License

Proprietary License

Copyright (c) 2024 Steven Morales Fallas

All rights reserved. Redistribution, modification, reproduction, sublicensing, or any form of transaction (including commercial, educational, or promotional use) involving this repository, its source code, or derived works is strictly prohibited without the explicit and personal written authorization of the Lead Developer, Steven Morales Fallas.

Unauthorized commercial use, resale, or licensing of this repository or its contents is strictly forbidden and will be subject to applicable legal action.

See LICENSE file for full details.

๐Ÿ‘จโ€๐Ÿ’ป Author

Steven Morales Fallas

  • Full Stack Developer
  • Portfolio: [Your Portfolio URL]
  • LinkedIn: [Your LinkedIn URL]
  • Email: [Your Email]

๐Ÿ”ฎ Future Enhancements

  • Save timer presets to localStorage
  • Sound mixing presets
  • Timer history and statistics
  • Pomodoro technique integration
  • Internationalization (i18n) - English and Spanish
  • Multiple timer sessions
  • PWA support for offline use
  • Custom sound uploads
  • Export timer data
  • Dark mode based on system preferences
  • Additional language support (French, German, etc.)
  • Unit and integration tests
  • E2E testing with Playwright/Cypress
  • Timer history with detailed logs
  • Custom Pomodoro durations
  • Sound fade in/out effects
  • Timer sounds/alarms customization

๐Ÿ“ Changelog

Version 2.0.0 (Current)

  • ๐ŸŽ‰ Complete React rewrite
  • โœจ TypeScript integration
  • ๐Ÿ—๏ธ Modern component architecture
  • ๐ŸŽจ CSS Modules implementation
  • ๐Ÿช Custom hooks for timer and audio
  • ๐ŸŽญ Context API for theme and sound management
  • โ™ฟ Enhanced accessibility features
  • ๐Ÿ“ฑ Improved responsive design
  • ๐Ÿš€ Performance optimizations
  • ๐Ÿ›ก๏ธ Error boundaries and error handling
  • ๐Ÿงน Project structure cleanup (removed legacy folders)
  • ๐Ÿ“ Reorganized assets following React best practices
  • ๐Ÿ… Pomodoro Technique: Full Pomodoro mode with work/break cycles
  • ๐Ÿ“Š Statistics Tracking: Session statistics with localStorage persistence
  • ๐ŸŽต Sound Presets: Pre-configured sound mixes for different activities
  • โฑ๏ธ Timer Presets: Quick access buttons for common durations
  • โŒจ๏ธ Keyboard Shortcuts: Full keyboard navigation support
  • ๐Ÿ’พ State Persistence: All settings and state saved to localStorage
  • ๐Ÿ“ˆ Progress Visualization: Circular progress ring for timer completion
  • ๐ŸŽฏ Smart Notifications: Context-aware browser notifications
  • ๐ŸŒ Internationalization: Full English/Spanish support with system language detection
  • ๐ŸŽจ Modern Icons: react-icons library for consistent, accessible iconography

Version 1.0.0

  • Initial vanilla JavaScript release
  • Timer functionality
  • Ambient sounds player
  • Day/Night theme switching
  • Basic accessibility improvements

Made with โค๏ธ by Steven Morales Fallas

โญ Star this repo if you find it helpful!

About

A modern React timer app with Pomodoro technique, ambient sounds, statistics tracking, and dark/light themes. Built with TypeScript and Vite.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages