ui update and some backend functionality adding in accordance with research on adhd and ux design

This commit is contained in:
2026-02-14 17:21:37 -06:00
parent 4d3a9fbd54
commit fb480eacb2
32 changed files with 9549 additions and 248 deletions

View File

@@ -39,6 +39,9 @@ CREATE TABLE IF NOT EXISTS routines (
name VARCHAR(255) NOT NULL,
description TEXT,
icon VARCHAR(100),
location VARCHAR(255),
environment_prompts JSON DEFAULT '[]',
habit_stack_after VARCHAR(255),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
@@ -122,6 +125,49 @@ CREATE TABLE IF NOT EXISTS routine_streaks (
last_completed_date DATE
);
-- ── Rewards ───────────────────────────────────────────────
CREATE TABLE IF NOT EXISTS reward_pool (
id UUID PRIMARY KEY,
category VARCHAR(50) NOT NULL,
content TEXT NOT NULL,
emoji VARCHAR(10),
rarity VARCHAR(20) DEFAULT 'common'
);
CREATE TABLE IF NOT EXISTS user_rewards (
id UUID PRIMARY KEY,
user_uuid UUID REFERENCES users(id) ON DELETE CASCADE,
reward_id UUID REFERENCES reward_pool(id) ON DELETE CASCADE,
earned_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
context VARCHAR(50)
);
-- ── User Preferences ──────────────────────────────────────
CREATE TABLE IF NOT EXISTS user_preferences (
id UUID PRIMARY KEY,
user_uuid UUID REFERENCES users(id) ON DELETE CASCADE UNIQUE,
sound_enabled BOOLEAN DEFAULT FALSE,
haptic_enabled BOOLEAN DEFAULT TRUE,
show_launch_screen BOOLEAN DEFAULT TRUE,
celebration_style VARCHAR(50) DEFAULT 'standard',
timezone_offset INTEGER DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- ── Step Results (per-step tracking within sessions) ───────
CREATE TABLE IF NOT EXISTS routine_step_results (
id UUID PRIMARY KEY,
session_id UUID REFERENCES routine_sessions(id) ON DELETE CASCADE,
step_id UUID REFERENCES routine_steps(id) ON DELETE CASCADE,
step_index INTEGER NOT NULL,
result VARCHAR(20) NOT NULL,
duration_seconds INTEGER,
completed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- ── Medications ─────────────────────────────────────────────
CREATE TABLE IF NOT EXISTS medications (