Implement tasks 25, 26 + completion visibility setting
Task 25: Multiple dashboards — dashboards table + migration, /d/[slug] route, root redirect, dashboard tabs in nav with create/rename/delete/ set-default. Task 26: Editable dashboard — react-grid-layout drag/resize editor, widget picker modal with per-widget configurator auto-generated from default config, save/reset server actions with Zod validation. Completion visibility: server-side per-user setting (hours) replaces localStorage timer; queries filter completed items by updatedAt cutoff; Settings page dropdown persists preference via server action. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
2ad9521ef9
commit
d5a8bf9d95
@@ -0,0 +1 @@
|
||||
ALTER TABLE "users" ADD COLUMN "completion_visibility_hours" integer NOT NULL DEFAULT 24;
|
||||
@@ -0,0 +1,28 @@
|
||||
CREATE TABLE "dashboards" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user_id" uuid NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
|
||||
"name" text NOT NULL,
|
||||
"slug" text NOT NULL,
|
||||
"is_default" boolean NOT NULL DEFAULT false,
|
||||
"position" integer NOT NULL DEFAULT 0,
|
||||
"layout" jsonb NOT NULL DEFAULT '{"version":1,"widgets":[]}',
|
||||
"created_at" timestamp with time zone NOT NULL DEFAULT now(),
|
||||
"updated_at" timestamp with time zone NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX "dashboards_user_slug_uq" ON "dashboards" ("user_id", "slug");
|
||||
|
||||
-- Migrate each existing user's default_dashboard_layout into a "Home" dashboard.
|
||||
-- Idempotent: ON CONFLICT DO NOTHING.
|
||||
INSERT INTO "dashboards" ("user_id", "name", "slug", "is_default", "position", "layout")
|
||||
SELECT
|
||||
"id",
|
||||
'Home',
|
||||
'home',
|
||||
true,
|
||||
0,
|
||||
COALESCE("default_dashboard_layout", '{"version":1,"widgets":[]}')
|
||||
FROM "users"
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
ALTER TABLE "users" DROP COLUMN IF EXISTS "default_dashboard_layout";
|
||||
Reference in New Issue
Block a user