# Time Tracker App A React-based time tracking application with user authentication and session management. ## Features - User authentication system with Supabase Auth - Start/stop time tracking functionality - Pause/resume functionality for breaks - Session history management - Edit current and past sessions - Create new sessions with simplified time input - Integration with Supabase for data persistence - Responsive design for desktop and mobile ## Pages 1. **Login/Register Page** - Secure authentication entry point 2. **Dashboard** - Main page with timer controls 3. **Session History** - View, edit, and create sessions ## Setup Instructions 1. Clone the repository (if applicable) 2. Install dependencies: ``` npm install ``` 3. Set up environment variables: - Copy `.env.example` to `.env` - Update the values in `.env` with your Supabase credentials: ``` REACT_APP_SUPABASE_URL=your_supabase_project_url_here REACT_APP_SUPABASE_ANON_KEY=your_supabase_anon_key_here ``` 4. Start the development server: ``` npm start ``` ## Database Setup ### Supabase Tables Create these tables in your Supabase project: #### Users Table ```sql -- Users table (handled by Supabase Auth) -- Supabase automatically creates auth.users table ``` #### Timers Table ```sql -- Create timers table create table if not exists timers ( id uuid primary key default gen_random_uuid(), user_id uuid references auth.users(id) not null, start_time timestamptz not null, end_time timestamptz, duration_ms integer, pauses json, created_at timestamptz default now() ); -- Enable RLS (Row Level Security) alter table timers enable row level security; -- Create policy to allow users to access their own timers only create policy "Users can access their own timers" on timers for all using (auth.uid() = user_id); -- Grant permissions grant usage on schema public to anon, authenticated; grant all on table timers to anon, authenticated; ``` ## Session Management Features ### Creating New Sessions - Click "Create New Session" in Session History - Select date and enter start/end times (HH:MM format) - Add pauses with start/end times as needed - Save to store in Supabase database ### Editing Sessions - Edit current active session - Edit past sessions from history - Modify start/end times and pause periods - Changes automatically saved to database ### Timer Controls - Start/Stop schedule tracking - Take breaks with Pause/Resume functionality - Real-time work time calculation (excluding pause time) ## Security - Environment variables are stored in `.env` (excluded from git) - Sensitive data never stored in browser localStorage or sessionStorage - All session data persists only in user session and external database - Review `.gitignore` to ensure sensitive files are not committed - Supabase Auth handles user authentication securely ## Implementation Details - Built with React and React Router for navigation - Uses Context API for state management - Implements a clean, responsive UI with CSS - Session data persists in user session and Supabase database - Integrates with Supabase API for data persistence and authentication ## File Structure ``` src/ ├── components/ # Reusable UI components ├── context/ # Authentication and state context ├── pages/ # Page components (Login, Dashboard, Sessions) ├── services/ # API integration services └── App.js # Main app component with routing ``` ## Database Integration The app includes a service layer for Supabase integration: - Sessions are saved to the database when stopped - Session history is loaded from the database on login - All database operations are handled through the sessionService - User authentication is managed by Supabase Auth To connect to your own Supabase project: 1. Create a Supabase account at https://supabase.io 2. Create a new project 3. Get your project URL and anon key from project settings 4. Create the required tables using the SQL provided above 5. Update the environment variables with your credentials --- # Original Create React App Documentation This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `npm start` Runs the app in the development mode.\ Open [http://localhost:3000](http://localhost:3000) to view it in your browser. The page will reload when you make changes.\ You may also see any lint errors in the console. ### `npm test` Launches the test runner in the interactive watch mode.\ See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `npm run build` Builds the app for production to the `build` folder.\ It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.\ Your app is ready to be deployed! See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `npm run eject` **Note: this is a one-way operation. Once you `eject`, you can't go back!** If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). ### Code Splitting This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) ### Analyzing the Bundle Size This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) ### Making a Progressive Web App This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) ### Advanced Configuration This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) ### Deployment This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) ### `npm run build` fails to minify This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)