← Back

PROJECT 003 · 2026 · JS · LOCALSTORAGE

Astra

A focus timer: create activities, set daily goals, start, pause and watch live progress.

lines of JavaScript
~420
commits
11
built
May – Jun 2026
libraries
0

00 · Summary

WHAT
Minimal time tracker focused on where your time really goes
MY ROLE
Solo: planning, design, code, deployment
STACK
Vanilla JavaScript, localStorage, HTML, CSS
STATUS
Live. Finished as a portfolio project.

01 · Why I built it

After Journalist I wanted a project with more complex state. Each activity in Astra has its own identity, timer, goal, progress and reset logic. The goal was not more features. It was to understand state: what you store, what you calculate and what you show.

02 · What it does

  • Create and delete activities
  • Daily goal per activity
  • Start, pause, resume
  • Live timer on the card and in the detail view
  • Live progress and progress bar
  • "Goal achieved" modal, once a day
  • Reset with confirmation
  • Automatic daily reset
  • Saved in localStorage

03 · Architecture

STORED{ id, name, goalHours, todaySeconds, isRunning, startedAt,lastResetDate, goalAchievedShown }DERIVEDgetDisplaySeconds() getProgress()RENDEREDactivity cards · detail view · progress bar
FIG. 1 — STATE MODELNTS
StartisRunning = true, startedAt = Date.now()PausetodaySeconds += ⌊(Date.now() − startedAt) / 1000⌋isRunning = false, startedAt = null

progress = round( todaySeconds / (goalHours × 3600) × 100 )

FIG. 2 — TIMERNTS
loadFromStorage()dailyReset()renderActivities()
FIG. 3 — STARTUPNTS

04 · Hard parts

  1. P-01

    Timestamps instead of seconds++.

    Counting seconds would have been easier, but browsers slow down timers in background tabs. Astra saves the start moment and calculates elapsed time from timestamps. It took several sessions to understand, and it was worth it.

  2. P-02

    Stored vs calculated.

    The timer doesn't save every second. It calculates what to display and updates stored time only on pause. Understanding this split was the main goal of the project.

  3. P-03

    Two views, one truth.

    Cards and the detail view update every second from the same state. Each card carries a data-id, so the app updates one element without re-rendering the whole view.

  4. P-04

    Buttons from state.

    startBtn.disabled = isRunning and pauseBtn.disabled = !isRunning, so double clicks on Start can't break the timer.

05 · Known issue

Known issue

lastResetDate comes from toISOString(), which is UTC time. In Poland the daily reset happens at 1:00 at night (2:00 in summer), not at midnight. The fix is to build the date from local time.

06 · What I learned

  • Design the state before the UI. The shape of the data decides how hard the rest will be.
  • Separate stored data from calculated values.
  • Understand before building. Some days I wrote almost no code and only mapped the flow. Those days saved the most time.