feat: add theme provider and control components for light/dark mode

- Implemented ThemeProvider to manage theme state and preferences.
- Added ThemeControl component for users to switch between system, light, and dark themes.
- Integrated localStorage for theme preference persistence.
- Updated document styles based on theme changes.

test: add tests for permanent deletion of habits and related records

- Created tests to ensure permanent deletion of habits removes all dependent records.
- Verified that deletion requires ownership, authentication, and checks for archived habits.
- Added tests to confirm rollback behavior on deletion failures.

test: add tests for habit palette and progress card functionality

- Implemented tests for habit color progression and theme-based color shading.
- Added tests for progress card calculations and calendar display logic.

feat: define theme types and preferences

- Introduced Theme and ThemePreference types for better type safety.
- Created utility functions for resolving theme based on user preference and system settings.
- Defined theme palettes for light and dark modes to ensure adequate contrast.
This commit is contained in:
syntaxbullet
2026-09-05 10:07:28 +02:00
parent 9e9871c08a
commit 00729096bf
47 changed files with 780 additions and 337 deletions

View File

@@ -1,4 +1,4 @@
# Minabot
# Mina Habits
Bun + Hono habit-tracking REST API with Drizzle ORM and local SQLite. The React Router
client includes a homepage for signed-out visitors and a personal habit dashboard.
@@ -67,7 +67,9 @@ its own recurrence. Both habit and task schedules support daily, selected weekda
day intervals, and week intervals with an editable start date and weekday.
Archive asks for confirmation in a modal and preserves earlier history.
**Archived habits** opens the archive modal, with history inspection and restoration
starting today. Task deletion uses the same modal confirmation. Tasks
starting today. **Delete permanently** removes an archived habit and all its history
after confirmation; it also removes the habit from combined charts and deletes
charts left empty. Task deletion uses the same modal confirmation. Tasks
remain manageable on days off, while their checkboxes stay disabled.
Settings, sharing, new habits, and historical check-ins also open in native dialogs.
Dialogs keep the background inactive, contain keyboard focus, support Escape and
@@ -85,16 +87,18 @@ Combined-chart management is not exposed on this homepage.
The dashboard opens with a compact greeting and a Today filter. All habits includes
routines on days off; creating a habit or editing one out of todays schedule keeps
it reachable in All habits. Saved calendars expand through **View history**, with
historical corrections available inside the expanded view. Selecting a square
it reachable in All habits. Every habit shows its calendar immediately, starting with three months and offering
longer ranges. Historical corrections are available by selecting a day. Selecting a square
only changes the inspected day; it preserves the date range and number of weeks,
including on untracked, unscheduled, and future dates. An external editor date
outside a preset window can still bring that date into view.
Each saved habit uses its own action layout: count goals have a prominent counter
and unit inside a tinted panel, simple check-ins use a compact checkbox-and-heading
row, and routines use a bordered checklist with a progress header. Daily schedule labels and
duplicate progress copy are omitted; days off stay explicit.
Each saved habit shares a serif heading, type label, color marker, schedule, and
explicit completion status. A visible graph sits beside a neutral completion panel:
count goals show their target, unit, and editable counter; check-ins show a labeled
checkbox; routines show an open task list and progress. On narrow screens, completion
controls stack above the graph. Spacing, typography, and neutral surfaces use the
shared design-system tokens; habit color marks identity and progress.
Count totals can be typed directly and saved with **Save** or Enter. Escape restores
the recorded total; plus and minus remain available. Counts may exceed the target.