feat(templates): add category-based organization
- Added 'category' column to routine_templates table - Categorized all 12 templates into: Daily Routines, Getting Things Done, Health & Body, Errands - Added /api/templates/categories endpoint to list unique categories - Updated /api/templates to support filtering by category query param - Redesigned templates page with collapsible accordion sections by category - Categories are sorted in logical order (Daily → Work → Health → Errands) - All categories expanded by default for easy browsing
This commit is contained in:
@@ -90,6 +90,7 @@ CREATE TABLE IF NOT EXISTS routine_templates (
|
||||
name VARCHAR(255) NOT NULL,
|
||||
description TEXT,
|
||||
icon VARCHAR(100),
|
||||
category VARCHAR(50) DEFAULT 'Other',
|
||||
created_by_admin BOOLEAN DEFAULT FALSE
|
||||
);
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@ DELETE FROM routine_templates;
|
||||
-- The hardest transition of the day. First step is literally just
|
||||
-- sitting up — two-minute rule. Each step cues the next physically.
|
||||
|
||||
INSERT INTO routine_templates (id, name, description, icon, created_by_admin) VALUES
|
||||
INSERT INTO routine_templates (id, name, description, icon, category, created_by_admin) VALUES
|
||||
('a1b2c3d4-0001-0001-0001-000000000001',
|
||||
'Morning Launch',
|
||||
'Get from bed to ready. Starts small — just sit up.',
|
||||
'☀️', true);
|
||||
'☀️', 'Daily Routines', true);
|
||||
|
||||
INSERT INTO routine_template_steps (id, template_id, name, instructions, step_type, duration_minutes, position) VALUES
|
||||
('b2c3d4e5-0001-0001-0001-000000000001', 'a1b2c3d4-0001-0001-0001-000000000001',
|
||||
@@ -39,11 +39,11 @@ INSERT INTO routine_template_steps (id, template_id, name, instructions, step_ty
|
||||
-- The "where are my keys" routine. Externalizes the checklist
|
||||
-- so working memory doesn't have to hold it.
|
||||
|
||||
INSERT INTO routine_templates (id, name, description, icon, created_by_admin) VALUES
|
||||
INSERT INTO routine_templates (id, name, description, icon, category, created_by_admin) VALUES
|
||||
('a1b2c3d4-0002-0001-0001-000000000002',
|
||||
'Leaving the House',
|
||||
'Everything you need before you walk out the door.',
|
||||
'🚪', true);
|
||||
'🚪', 'Daily Routines', true);
|
||||
|
||||
INSERT INTO routine_template_steps (id, template_id, name, instructions, step_type, duration_minutes, position) VALUES
|
||||
('b2c3d4e5-0002-0001-0001-000000000002', 'a1b2c3d4-0002-0001-0001-000000000002',
|
||||
@@ -65,11 +65,11 @@ INSERT INTO routine_template_steps (id, template_id, name, instructions, step_ty
|
||||
-- "at point of performance"). Work block is shorter than classic
|
||||
-- pomodoro because ADHD sustained attention is shorter.
|
||||
|
||||
INSERT INTO routine_templates (id, name, description, icon, created_by_admin) VALUES
|
||||
INSERT INTO routine_templates (id, name, description, icon, category, created_by_admin) VALUES
|
||||
('a1b2c3d4-0003-0001-0001-000000000003',
|
||||
'Focus Sprint',
|
||||
'One focused work block. Set up your space first.',
|
||||
'🎯', true);
|
||||
'🎯', 'Getting Things Done', true);
|
||||
|
||||
INSERT INTO routine_template_steps (id, template_id, name, instructions, step_type, duration_minutes, position) VALUES
|
||||
('b2c3d4e5-0003-0001-0001-000000000003', 'a1b2c3d4-0003-0001-0001-000000000003',
|
||||
@@ -89,11 +89,11 @@ INSERT INTO routine_template_steps (id, template_id, name, instructions, step_ty
|
||||
-- stimulating, the brain won't stop, and the bed isn't "sleepy"
|
||||
-- enough without a transition.
|
||||
|
||||
INSERT INTO routine_templates (id, name, description, icon, created_by_admin) VALUES
|
||||
INSERT INTO routine_templates (id, name, description, icon, category, created_by_admin) VALUES
|
||||
('a1b2c3d4-0004-0001-0001-000000000004',
|
||||
'Wind Down',
|
||||
'Transition from awake-brain to sleep-brain.',
|
||||
'🌙', true);
|
||||
'🌙', 'Daily Routines', true);
|
||||
|
||||
INSERT INTO routine_template_steps (id, template_id, name, instructions, step_type, duration_minutes, position) VALUES
|
||||
('b2c3d4e5-0004-0001-0001-000000000004', 'a1b2c3d4-0004-0001-0001-000000000004',
|
||||
@@ -114,11 +114,11 @@ INSERT INTO routine_template_steps (id, template_id, name, instructions, step_ty
|
||||
-- Not a full cleaning session. Designed to be completable even on
|
||||
-- a bad executive function day. Each step is one area, one action.
|
||||
|
||||
INSERT INTO routine_templates (id, name, description, icon, created_by_admin) VALUES
|
||||
INSERT INTO routine_templates (id, name, description, icon, category, created_by_admin) VALUES
|
||||
('a1b2c3d4-0005-0001-0001-000000000005',
|
||||
'Quick Tidy',
|
||||
'A fast sweep through the house. Not deep cleaning — just enough.',
|
||||
'✨', true);
|
||||
'✨', 'Getting Things Done', true);
|
||||
|
||||
INSERT INTO routine_template_steps (id, template_id, name, instructions, step_type, duration_minutes, position) VALUES
|
||||
('b2c3d4e5-0005-0001-0001-000000000005', 'a1b2c3d4-0005-0001-0001-000000000005',
|
||||
@@ -137,11 +137,11 @@ INSERT INTO routine_template_steps (id, template_id, name, instructions, step_ty
|
||||
-- For when basic hygiene feels hard. No judgment. Every step is
|
||||
-- the minimum viable version — just enough to feel a little better.
|
||||
|
||||
INSERT INTO routine_templates (id, name, description, icon, created_by_admin) VALUES
|
||||
INSERT INTO routine_templates (id, name, description, icon, category, created_by_admin) VALUES
|
||||
('a1b2c3d4-0006-0001-0001-000000000006',
|
||||
'Body Reset',
|
||||
'Basic care for your body. Even partial counts.',
|
||||
'🚿', true);
|
||||
'🚿', 'Health & Body', true);
|
||||
|
||||
INSERT INTO routine_template_steps (id, template_id, name, instructions, step_type, duration_minutes, position) VALUES
|
||||
('b2c3d4e5-0006-0001-0001-000000000006', 'a1b2c3d4-0006-0001-0001-000000000006',
|
||||
@@ -162,11 +162,11 @@ INSERT INTO routine_template_steps (id, template_id, name, instructions, step_ty
|
||||
-- For when you're paralyzed and can't start anything. Pure
|
||||
-- two-minute-rule: the smallest possible actions to build momentum.
|
||||
|
||||
INSERT INTO routine_templates (id, name, description, icon, created_by_admin) VALUES
|
||||
INSERT INTO routine_templates (id, name, description, icon, category, created_by_admin) VALUES
|
||||
('a1b2c3d4-0007-0001-0001-000000000007',
|
||||
'Unstuck',
|
||||
'Can''t start anything? Start here. Tiny steps, real momentum.',
|
||||
'🔓', true);
|
||||
'🔓', 'Getting Things Done', true);
|
||||
|
||||
INSERT INTO routine_template_steps (id, template_id, name, instructions, step_type, duration_minutes, position) VALUES
|
||||
('b2c3d4e5-0007-0001-0001-000000000007', 'a1b2c3d4-0007-0001-0001-000000000007',
|
||||
@@ -187,11 +187,11 @@ INSERT INTO routine_template_steps (id, template_id, name, instructions, step_ty
|
||||
-- End-of-day prep so tomorrow morning isn't harder than it needs
|
||||
-- to be. Externalizes "things to remember" before sleep.
|
||||
|
||||
INSERT INTO routine_templates (id, name, description, icon, created_by_admin) VALUES
|
||||
INSERT INTO routine_templates (id, name, description, icon, category, created_by_admin) VALUES
|
||||
('a1b2c3d4-0008-0001-0001-000000000008',
|
||||
'Evening Reset',
|
||||
'Set tomorrow up to be a little easier.',
|
||||
'🌆', true);
|
||||
'🌆', 'Daily Routines', true);
|
||||
|
||||
INSERT INTO routine_template_steps (id, template_id, name, instructions, step_type, duration_minutes, position) VALUES
|
||||
('b2c3d4e5-0008-0001-0001-000000000008', 'a1b2c3d4-0008-0001-0001-000000000008',
|
||||
@@ -212,11 +212,11 @@ INSERT INTO routine_template_steps (id, template_id, name, instructions, step_ty
|
||||
-- Not "exercise." Movement. The entry point is putting shoes on,
|
||||
-- not "work out for 30 minutes." Anything beyond standing counts.
|
||||
|
||||
INSERT INTO routine_templates (id, name, description, icon, created_by_admin) VALUES
|
||||
INSERT INTO routine_templates (id, name, description, icon, category, created_by_admin) VALUES
|
||||
('a1b2c3d4-0009-0001-0001-000000000009',
|
||||
'Move Your Body',
|
||||
'Not a workout plan. Just movement. Any amount counts.',
|
||||
'🏃', true);
|
||||
'🏃', 'Health & Body', true);
|
||||
|
||||
INSERT INTO routine_template_steps (id, template_id, name, instructions, step_type, duration_minutes, position) VALUES
|
||||
('b2c3d4e5-0009-0001-0001-000000000009', 'a1b2c3d4-0009-0001-0001-000000000009',
|
||||
@@ -237,11 +237,11 @@ INSERT INTO routine_template_steps (id, template_id, name, instructions, step_ty
|
||||
-- Weekly prep. Slightly longer, but broken into small concrete
|
||||
-- chunks. Prevents the "where did the week go" spiral.
|
||||
|
||||
INSERT INTO routine_templates (id, name, description, icon, created_by_admin) VALUES
|
||||
INSERT INTO routine_templates (id, name, description, icon, category, created_by_admin) VALUES
|
||||
('a1b2c3d4-0010-0001-0001-000000000010',
|
||||
'Sunday Reset',
|
||||
'Set up the week ahead so Monday doesn''t ambush you.',
|
||||
'📋', true);
|
||||
'📋', 'Getting Things Done', true);
|
||||
|
||||
INSERT INTO routine_template_steps (id, template_id, name, instructions, step_type, duration_minutes, position) VALUES
|
||||
('b2c3d4e5-0010-0001-0001-000000000010', 'a1b2c3d4-0010-0001-0001-000000000010',
|
||||
@@ -264,11 +264,11 @@ INSERT INTO routine_template_steps (id, template_id, name, instructions, step_ty
|
||||
-- Not "meal prep for the week." One meal. Broken down so the
|
||||
-- activation energy is low and the sequence is externalized.
|
||||
|
||||
INSERT INTO routine_templates (id, name, description, icon, created_by_admin) VALUES
|
||||
INSERT INTO routine_templates (id, name, description, icon, category, created_by_admin) VALUES
|
||||
('a1b2c3d4-0011-0001-0001-000000000011',
|
||||
'Cook a Meal',
|
||||
'One meal, start to finish. Just follow the steps.',
|
||||
'🍳', true);
|
||||
'🍳', 'Health & Body', true);
|
||||
|
||||
INSERT INTO routine_template_steps (id, template_id, name, instructions, step_type, duration_minutes, position) VALUES
|
||||
('b2c3d4e5-0011-0001-0001-000000000011', 'a1b2c3d4-0011-0001-0001-000000000011',
|
||||
@@ -291,11 +291,11 @@ INSERT INTO routine_template_steps (id, template_id, name, instructions, step_ty
|
||||
-- Externalizes the "I have errands but I keep not doing them"
|
||||
-- problem. Forces the plan into concrete sequential steps.
|
||||
|
||||
INSERT INTO routine_templates (id, name, description, icon, created_by_admin) VALUES
|
||||
INSERT INTO routine_templates (id, name, description, icon, category, created_by_admin) VALUES
|
||||
('a1b2c3d4-0012-0001-0001-000000000012',
|
||||
'Errand Run',
|
||||
'Get out, do the things, come home. One trip.',
|
||||
'🛒', true);
|
||||
'🛒', 'Errands', true);
|
||||
|
||||
INSERT INTO routine_template_steps (id, template_id, name, instructions, step_type, duration_minutes, position) VALUES
|
||||
('b2c3d4e5-0012-0001-0001-000000000012', 'a1b2c3d4-0012-0001-0001-000000000012',
|
||||
|
||||
Reference in New Issue
Block a user