Skip to content

Repository files navigation

Time Tracker

This project is aimed at challenging and enhancing my Next.js skills, and it involves developing a personalized time tracker, akin to commercial tools like Clockify.

Overview

The current state of the application serves as a debugger for the underlying structure. It primarily deals with times and dates, which can be error-prone.

Time Tracker Debugger

Core Model Prototyping

At this stage, the focus is on prototyping the core model for the timer. The approach is centered around the belief that the truth lies in the stamps, and the rest of the information generates accordingly. The database specifically stores activities, user profiles, and stamps.

Database Schema

Keywords

  • Activities: Each activity has an associated icon and color, e.g., Sleep, etc.
  • Stamp: Signifying the start and stop, each stamp has an associated activity and timestamp.
  • Interval: Defined by a starting stamp and ending with a stop or a new start.

Client-Side Processing

Given the diverse client-side processing requirements, a context-based approach is adopted, leveraging Zustand. However, there are challenges with dependencies between stores, currently hindering the app's functionality.

Client Context

Index Context

The Index context is introduced to bring order among the dedicated contexts.

  • Stamps and Activity Context: Simple contexts that hold arrays.

    Stamps and Activity Context

  • Intervals Context: A more complex context that filters stamps, eliminates redundancy, removes quickly updated stamps, and crucially, creates the interval array based on the stamps.

    Intervals Context

Backend

The backend, implemented using Next.js, follows a straightforward structure. The API routes are defined in route.js.

Backend Structure

The API endpoint fetch("/api/activities") performs a GET request. Notably, Prisma is used to retrieve user activities.

API Endpoint

Frontend

The current frontend may lack visual appeal, but it successfully updates counters every second.

Frontend

Regular components were initially responsible for data generation, but this responsibility has been shifted to the Index context.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages