Versión 1.0

This commit is contained in:
Antoni Nuñez Romeu
2026-04-09 23:42:49 +02:00
parent 72bf48f7f8
commit b3f7d6bf98
24 changed files with 4335 additions and 48 deletions

144
README.md
View File

@@ -1,4 +1,144 @@
# Getting Started with Create React App
# 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).
@@ -67,4 +207,4 @@ This section has moved here: [https://facebook.github.io/create-react-app/docs/d
### `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)
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)