Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

style: use a consistent design system (#363)

Andrej6c98ef8fdf04
diff --git a/apps/api/drizzle/0002_easy_miek.sql b/apps/api/drizzle/0002_easy_miek.sql
new file mode 100644
index 000000000..92eb905e8
--- /dev/null
+++ b/apps/api/drizzle/0002_easy_miek.sql
@@ -0,0 +1,2 @@
+ALTER TABLE "notification" ALTER COLUMN "created_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
+ALTER TABLE "notification" ALTER COLUMN "created_at" SET DEFAULT now();
\ No newline at end of file
diff --git a/apps/api/drizzle/meta/0002_snapshot.json b/apps/api/drizzle/meta/0002_snapshot.json
new file mode 100644
index 000000000..e7dcc6752
--- /dev/null
+++ b/apps/api/drizzle/meta/0002_snapshot.json
@@ -0,0 +1,768 @@
+{
+ "id": "594c9f8c-e00f-4ab1-b4b0-725728bc40eb",
+ "prevId": "d516f340-217e-4840-8e91-65c778e344d1",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.activity": {
+ "name": "activity",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "user_email": {
+ "name": "user_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "activity_task_id_task_id_fk": {
+ "name": "activity_task_id_task_id_fk",
+ "tableFrom": "activity",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "activity_user_email_user_email_fk": {
+ "name": "activity_user_email_user_email_fk",
+ "tableFrom": "activity",
+ "tableTo": "user",
+ "columnsFrom": ["user_email"],
+ "columnsTo": ["email"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.github_integration": {
+ "name": "github_integration",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository_owner": {
+ "name": "repository_owner",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository_name": {
+ "name": "repository_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "installation_id": {
+ "name": "installation_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "github_integration_project_id_project_id_fk": {
+ "name": "github_integration_project_id_project_id_fk",
+ "tableFrom": "github_integration",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "github_integration_project_id_unique": {
+ "name": "github_integration_project_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["project_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.label": {
+ "name": "label",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "label_task_id_task_id_fk": {
+ "name": "label_task_id_task_id_fk",
+ "tableFrom": "label",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.notification": {
+ "name": "notification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_email": {
+ "name": "user_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'info'"
+ },
+ "is_read": {
+ "name": "is_read",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resource_type": {
+ "name": "resource_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "notification_user_email_user_email_fk": {
+ "name": "notification_user_email_user_email_fk",
+ "tableFrom": "notification",
+ "tableTo": "user",
+ "columnsFrom": ["user_email"],
+ "columnsTo": ["email"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project": {
+ "name": "project",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'Layout'"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "is_public": {
+ "name": "is_public",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_workspace_id_workspace_id_fk": {
+ "name": "project_workspace_id_workspace_id_fk",
+ "tableFrom": "project",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.task": {
+ "name": "task",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "number": {
+ "name": "number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "assignee_email": {
+ "name": "assignee_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'to-do'"
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'low'"
+ },
+ "due_date": {
+ "name": "due_date",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "task_project_id_project_id_fk": {
+ "name": "task_project_id_project_id_fk",
+ "tableFrom": "task",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "task_assignee_email_user_email_fk": {
+ "name": "task_assignee_email_user_email_fk",
+ "tableFrom": "task",
+ "tableTo": "user",
+ "columnsFrom": ["assignee_email"],
+ "columnsTo": ["email"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.time_entry": {
+ "name": "time_entry",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_email": {
+ "name": "user_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start_time": {
+ "name": "start_time",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "end_time": {
+ "name": "end_time",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "duration": {
+ "name": "duration",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "time_entry_task_id_task_id_fk": {
+ "name": "time_entry_task_id_task_id_fk",
+ "tableFrom": "time_entry",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "time_entry_user_email_user_email_fk": {
+ "name": "time_entry_user_email_user_email_fk",
+ "tableFrom": "time_entry",
+ "tableTo": "user",
+ "columnsFrom": ["user_email"],
+ "columnsTo": ["email"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "nullsNotDistinct": false,
+ "columns": ["email"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace": {
+ "name": "workspace",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_email": {
+ "name": "owner_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_owner_email_user_email_fk": {
+ "name": "workspace_owner_email_user_email_fk",
+ "tableFrom": "workspace",
+ "tableTo": "user",
+ "columnsFrom": ["owner_email"],
+ "columnsTo": ["email"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_member": {
+ "name": "workspace_member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_email": {
+ "name": "user_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "joined_at": {
+ "name": "joined_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_member_workspace_id_workspace_id_fk": {
+ "name": "workspace_member_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_member",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {},
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
diff --git a/apps/api/drizzle/meta/_journal.json b/apps/api/drizzle/meta/_journal.json
index 2526b3658..06bbe6d7c 100644
--- a/apps/api/drizzle/meta/_journal.json
+++ b/apps/api/drizzle/meta/_journal.json
@@ -15,6 +15,13 @@
"when": 1750504871903,
"tag": "0001_natural_robin_chapel",
"breakpoints": true
+ },
+ {
+ "idx": 2,
+ "version": "7",
+ "when": 1752666410349,
+ "tag": "0002_easy_miek",
+ "breakpoints": true
}
]
}
diff --git a/apps/api/src/database/index.ts b/apps/api/src/database/index.ts
index cdfaa2e8b..dbb6fea36 100644
--- a/apps/api/src/database/index.ts
+++ b/apps/api/src/database/index.ts
@@ -1,6 +1,19 @@
import dotenv from "dotenv";
import { drizzle } from "drizzle-orm/node-postgres";
import { Pool } from "pg";
+import {
+ activityTableRelations,
+ githubIntegrationTableRelations,
+ labelTableRelations,
+ notificationTableRelations,
+ projectTableRelations,
+ sessionTableRelations,
+ taskTableRelations,
+ timeEntryTableRelations,
+ userTableRelations,
+ workspaceTableRelations,
+ workspaceUserTableRelations,
+} from "./relations";
import * as schema from "./schema";
dotenv.config();
@@ -11,6 +24,21 @@ const pool = new Pool({
"postgresql://kaneo_user:kaneo_password@localhost:5432/kaneo",
});
-const db = drizzle(pool, { schema });
+const db = drizzle(pool, {
+ schema: {
+ ...schema,
+ userTableRelations,
+ sessionTableRelations,
+ workspaceTableRelations,
+ workspaceUserTableRelations,
+ projectTableRelations,
+ taskTableRelations,
+ timeEntryTableRelations,
+ activityTableRelations,
+ labelTableRelations,
+ notificationTableRelations,
+ githubIntegrationTableRelations,
+ },
+});
export default db;
diff --git a/apps/api/src/database/relations.ts b/apps/api/src/database/relations.ts
new file mode 100644
index 000000000..a97c0570b
--- /dev/null
+++ b/apps/api/src/database/relations.ts
@@ -0,0 +1,128 @@
+import { relations } from "drizzle-orm";
+import {
+ activityTable,
+ githubIntegrationTable,
+ labelTable,
+ notificationTable,
+ projectTable,
+ sessionTable,
+ taskTable,
+ timeEntryTable,
+ userTable,
+ workspaceTable,
+ workspaceUserTable,
+} from "./schema";
+
+export const userTableRelations = relations(userTable, ({ many }) => ({
+ sessions: many(sessionTable),
+ workspaces: many(workspaceTable),
+ workspaceMemberships: many(workspaceUserTable),
+ assignedTasks: many(taskTable),
+ timeEntries: many(timeEntryTable),
+ activities: many(activityTable),
+ notifications: many(notificationTable),
+}));
+
+export const sessionTableRelations = relations(sessionTable, ({ one }) => ({
+ user: one(userTable, {
+ fields: [sessionTable.userId],
+ references: [userTable.id],
+ }),
+}));
+
+export const workspaceTableRelations = relations(
+ workspaceTable,
+ ({ one, many }) => ({
+ owner: one(userTable, {
+ fields: [workspaceTable.ownerEmail],
+ references: [userTable.email],
+ }),
+ members: many(workspaceUserTable),
+ projects: many(projectTable),
+ }),
+);
+
+export const workspaceUserTableRelations = relations(
+ workspaceUserTable,
+ ({ one }) => ({
+ workspace: one(workspaceTable, {
+ fields: [workspaceUserTable.workspaceId],
+ references: [workspaceTable.id],
+ }),
+ }),
+);
+
+export const projectTableRelations = relations(
+ projectTable,
+ ({ one, many }) => ({
+ workspace: one(workspaceTable, {
+ fields: [projectTable.workspaceId],
+ references: [workspaceTable.id],
+ }),
+ tasks: many(taskTable),
+ githubIntegration: many(githubIntegrationTable),
+ }),
+);
+
+export const taskTableRelations = relations(taskTable, ({ one, many }) => ({
+ project: one(projectTable, {
+ fields: [taskTable.projectId],
+ references: [projectTable.id],
+ }),
+ assignee: one(userTable, {
+ fields: [taskTable.userEmail],
+ references: [userTable.email],
+ }),
+ timeEntries: many(timeEntryTable),
+ activities: many(activityTable),
+ labels: many(labelTable),
+}));
+
+export const timeEntryTableRelations = relations(timeEntryTable, ({ one }) => ({
+ task: one(taskTable, {
+ fields: [timeEntryTable.taskId],
+ references: [taskTable.id],
+ }),
+ user: one(userTable, {
+ fields: [timeEntryTable.userEmail],
+ references: [userTable.email],
+ }),
+}));
+
+export const activityTableRelations = relations(activityTable, ({ one }) => ({
+ task: one(taskTable, {
+ fields: [activityTable.taskId],
+ references: [taskTable.id],
+ }),
+ user: one(userTable, {
+ fields: [activityTable.userEmail],
+ references: [userTable.email],
+ }),
+}));
+
+export const labelTableRelations = relations(labelTable, ({ one }) => ({
+ task: one(taskTable, {
+ fields: [labelTable.taskId],
+ references: [taskTable.id],
+ }),
+}));
+
+export const notificationTableRelations = relations(
+ notificationTable,
+ ({ one }) => ({
+ user: one(userTable, {
+ fields: [notificationTable.userEmail],
+ references: [userTable.email],
+ }),
+ }),
+);
+
+export const githubIntegrationTableRelations = relations(
+ githubIntegrationTable,
+ ({ one }) => ({
+ project: one(projectTable, {
+ fields: [githubIntegrationTable.projectId],
+ references: [projectTable.id],
+ }),
+ }),
+);
diff --git a/apps/api/src/database/schema.ts b/apps/api/src/database/schema.ts
index 3aedab2ea..03509bf93 100644
--- a/apps/api/src/database/schema.ts
+++ b/apps/api/src/database/schema.ts
@@ -116,7 +116,7 @@ export const timeEntryTable = pgTable("time_entry", {
description: text("description"),
startTime: timestamp("start_time", { mode: "date" }).notNull(),
endTime: timestamp("end_time", { mode: "date" }),
- duration: integer("duration").default(0), // Duration in seconds
+ duration: integer("duration").default(0),
createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull(),
});
@@ -172,7 +172,9 @@ export const notificationTable = pgTable("notification", {
isRead: boolean("is_read").default(false),
resourceId: text("resource_id"),
resourceType: text("resource_type"),
- createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull(),
+ createdAt: timestamp("created_at", { mode: "date", withTimezone: true })
+ .defaultNow()
+ .notNull(),
});
export const githubIntegrationTable = pgTable("github_integration", {
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index 633197308..ded6c736b 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -18,7 +18,6 @@ import timeEntry from "./time-entry";
import user from "./user";
import { validateSessionToken } from "./user/utils/validate-session-token";
import getSettings from "./utils/get-settings";
-import setDemoUser from "./utils/set-demo-user";
import workspace from "./workspace";
import workspaceUser from "./workspace-user";
@@ -53,27 +52,28 @@ if (!isDemoMode) {
app.use("*", auth);
}
-app.use("*", async (c, next) => {
- if (isDemoMode) {
- const session = getCookie(c, "session");
+// TODO: Fix this
+// app.use("*", async (c, next) => {
+// if (isDemoMode) {
+// const session = getCookie(c, "session");
- if (!session) {
- await setDemoUser(c);
- }
+// if (!session) {
+// await setDemoUser(c);
+// }
- const { user, session: validatedSession } = await validateSessionToken(
- session ?? "",
- );
+// const { user, session: validatedSession } = await validateSessionToken(
+// session ?? "",
+// );
- if (!user || !validatedSession) {
- await setDemoUser(c);
- }
+// if (!user || !validatedSession) {
+// await setDemoUser(c);
+// }
- c.set("userEmail", user?.email ?? "");
- }
+// c.set("userEmail", user?.email ?? "");
+// }
- await next();
-});
+// await next();
+// });
const meRoute = app.get("/me", async (c) => {
const session = getCookie(c, "session");
diff --git a/apps/api/src/notification/index.ts b/apps/api/src/notification/index.ts
index b118fa224..b7a9f3d46 100644
--- a/apps/api/src/notification/index.ts
+++ b/apps/api/src/notification/index.ts
@@ -103,15 +103,15 @@ subscribeToEvent(
async ({
workspaceId,
ownerEmail,
- }: { workspaceId: string; ownerEmail: string }) => {
+ workspaceName,
+ }: { workspaceId: string; ownerEmail: string; workspaceName: string }) => {
if (!workspaceId || !ownerEmail) {
return;
}
await createNotification({
userEmail: ownerEmail,
- title: "Workspace Created",
- content: "Your new workspace is ready",
+ title: `Workspace "${workspaceName}" created`,
type: "workspace",
resourceId: workspaceId,
resourceType: "workspace",
@@ -140,8 +140,7 @@ subscribeToEvent(
await createNotification({
userEmail,
- title: "Task Status Updated",
- content: `Task "${title}" moved from ${oldStatus.replace(/-/g, " ")} to ${newStatus.replace(/-/g, " ")}`,
+ title: `Task "${title}" moved from ${oldStatus.replace(/-/g, " ")} to ${newStatus.replace(/-/g, " ")}`,
type: "task",
resourceId: taskId,
resourceType: "task",
diff --git a/apps/api/src/project/controllers/get-project.ts b/apps/api/src/project/controllers/get-project.ts
index 26cfad3f6..59bb207b9 100644
--- a/apps/api/src/project/controllers/get-project.ts
+++ b/apps/api/src/project/controllers/get-project.ts
@@ -1,24 +1,18 @@
import { and, eq } from "drizzle-orm";
import { HTTPException } from "hono/http-exception";
import db from "../../database";
-import { projectTable, workspaceTable } from "../../database/schema";
+import { projectTable } from "../../database/schema";
async function getProject(id: string, workspaceId: string) {
- const [project] = await db
- .select({
- id: projectTable.id,
- name: projectTable.name,
- slug: projectTable.slug,
- description: projectTable.description,
- workspaceId: projectTable.workspaceId,
- workspace: workspaceTable,
- icon: projectTable.icon,
- })
- .from(projectTable)
- .leftJoin(workspaceTable, eq(projectTable.workspaceId, workspaceTable.id))
- .where(
- and(eq(projectTable.id, id), eq(projectTable.workspaceId, workspaceId)),
- );
+ const project = await db.query.projectTable.findFirst({
+ where: and(
+ eq(projectTable.id, id),
+ eq(projectTable.workspaceId, workspaceId),
+ ),
+ with: {
+ tasks: true,
+ },
+ });
if (!project) {
throw new HTTPException(404, {
diff --git a/apps/api/src/project/controllers/get-projects.ts b/apps/api/src/project/controllers/get-projects.ts
index 4e8623414..d53f43ebc 100644
--- a/apps/api/src/project/controllers/get-projects.ts
+++ b/apps/api/src/project/controllers/get-projects.ts
@@ -1,33 +1,43 @@
-import { and, eq } from "drizzle-orm";
+import { eq } from "drizzle-orm";
import db from "../../database";
-import { projectTable, workspaceTable } from "../../database/schema";
+import { projectTable } from "../../database/schema";
async function getProjects(workspaceId: string) {
- const projects = await db
- .select({
- id: projectTable.id,
- name: projectTable.name,
- description: projectTable.description,
- workspaceId: projectTable.workspaceId,
- createdAt: projectTable.createdAt,
- icon: projectTable.icon,
- slug: projectTable.slug,
- isPublic: projectTable.isPublic,
- workspace: {
- id: workspaceTable.id,
- name: workspaceTable.name,
+ const projects = await db.query.projectTable.findMany({
+ where: eq(projectTable.workspaceId, workspaceId),
+ with: {
+ tasks: true,
+ },
+ });
+
+ const projectsWithStatistics = projects.map((project) => {
+ const totalTasks = project.tasks.length;
+ const completedTasks = project.tasks.filter(
+ (task) => task.status === "done",
+ ).length;
+ const completionPercentage =
+ totalTasks > 0 ? Math.round((completedTasks / totalTasks) * 100) : 0;
+
+ const dueDate = project.tasks.reduce((earliest: Date | null, task) => {
+ if (!earliest || (task.dueDate && task.dueDate < earliest))
+ return task.dueDate;
+ return earliest;
+ }, null);
+
+ return {
+ ...project,
+ statistics: {
+ completionPercentage,
+ totalTasks,
+ dueDate,
},
- })
- .from(projectTable)
- .leftJoin(workspaceTable, eq(projectTable.workspaceId, workspaceTable.id))
- .where(and(eq(projectTable.workspaceId, workspaceId)));
+ archivedTasks: [],
+ plannedTasks: [],
+ columns: [],
+ };
+ });
- return projects.map((project) => ({
- ...project,
- columns: [],
- plannedTasks: [],
- archivedTasks: [],
- }));
+ return projectsWithStatistics;
}
export default getProjects;
diff --git a/apps/api/src/task/controllers/create-task.ts b/apps/api/src/task/controllers/create-task.ts
index f6be287f8..d261907f0 100644
--- a/apps/api/src/task/controllers/create-task.ts
+++ b/apps/api/src/task/controllers/create-task.ts
@@ -53,7 +53,7 @@ async function createTask({
...createdTask,
taskId: createdTask.id,
userEmail: createdTask.userEmail ?? "",
- type: "create",
+ type: "task",
content: "created the task",
});
diff --git a/apps/api/src/utils/set-demo-user.ts b/apps/api/src/utils/set-demo-user.ts
deleted file mode 100644
index 2ff34295d..000000000
--- a/apps/api/src/utils/set-demo-user.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-// @ts-ignore - This is used by Elysia
-import type { ElysiaCookie } from "elysia/dist/cookies";
-import type { Context } from "hono";
-import { setCookie } from "hono/cookie";
-import isInSecureMode from "../user/utils/is-in-secure-mode";
-import { createDemoUser } from "./create-demo-user";
-
-async function setDemoUser(c: Context) {
- const demoExpiresAt = new Date(Date.now() + 15 * 60 * 1000);
- const { session: demoSession, expiresAt = demoExpiresAt } =
- await createDemoUser();
-
- setCookie(c, "session", demoSession, {
- httpOnly: isInSecureMode(c.req),
- path: "/",
- secure: true,
- sameSite: "lax",
- expires: expiresAt,
- });
-}
-
-export default setDemoUser;
diff --git a/apps/api/src/workspace/controllers/create-workspace.ts b/apps/api/src/workspace/controllers/create-workspace.ts
index 83acac061..12d9ba948 100644
--- a/apps/api/src/workspace/controllers/create-workspace.ts
+++ b/apps/api/src/workspace/controllers/create-workspace.ts
@@ -19,6 +19,7 @@ async function createWorkspace(name: string, ownerEmail: string) {
publishEvent("workspace.created", {
workspaceId: workspace.id,
+ workspaceName: workspace.name,
ownerEmail,
});
diff --git a/apps/api/src/workspace/index.ts b/apps/api/src/workspace/index.ts
index 20ab27c79..0c766ac1a 100644
--- a/apps/api/src/workspace/index.ts
+++ b/apps/api/src/workspace/index.ts
@@ -28,15 +28,19 @@ const workspace = new Hono<{
return c.json(workspace);
})
- .post("/", zValidator("json", z.object({ name: z.string() })), async (c) => {
- const { name } = c.req.valid("json");
+ .post(
+ "/",
+ zValidator("json", z.object({ name: z.string(), description: z.string() })),
+ async (c) => {
+ const { name } = c.req.valid("json");
- const userEmail = c.get("userEmail");
+ const userEmail = c.get("userEmail");
- const workspace = await createWorkspace(name, userEmail);
+ const workspace = await createWorkspace(name, userEmail);
- return c.json(workspace);
- })
+ return c.json(workspace);
+ },
+ )
.put(
"/:id",
zValidator("json", z.object({ name: z.string(), description: z.string() })),
diff --git a/apps/docs/app/api/search/route.ts b/apps/docs/app/api/search/route.ts
index 2d1cb460f..ba030707e 100644
--- a/apps/docs/app/api/search/route.ts
+++ b/apps/docs/app/api/search/route.ts
@@ -1,7 +1,6 @@
import { source } from "@/lib/source";
import { createFromSource } from "fumadocs-core/search/server";
-// it should be cached forever
export const revalidate = false;
export const { staticGET: GET } = createFromSource(source);
diff --git a/apps/docs/components/footer.tsx b/apps/docs/components/footer.tsx
index 28c8779fe..359447aed 100644
--- a/apps/docs/components/footer.tsx
+++ b/apps/docs/components/footer.tsx
@@ -13,7 +13,6 @@ export default function Footer() {
<footer className="bg-zinc-100 dark:bg-zinc-950 border-t border-zinc-200 dark:border-zinc-900">
<div className="max-w-7xl mx-auto py-12 px-4 sm:px-6 lg:px-8">
<div className="grid grid-cols-1 md:grid-cols-3 gap-8 mb-12">
- {/* Logo and tagline */}
<div className="flex flex-col">
<div className="flex items-center">
<div className="flex items-center justify-center bg-indigo-500/10 rounded p-1 mr-2">
@@ -57,7 +56,6 @@ export default function Footer() {
</p>
</div>
- {/* Product links */}
<div>
<h3 className="text-zinc-900 dark:text-white font-medium mb-4">
Product
@@ -97,7 +95,6 @@ export default function Footer() {
</ul>
</div>
- {/* Community links */}
<div>
<h3 className="text-zinc-900 dark:text-white font-medium mb-4">
Community
diff --git a/apps/docs/components/laptop-animation.tsx b/apps/docs/components/laptop-animation.tsx
index e3845fcab..a893351f5 100644
--- a/apps/docs/components/laptop-animation.tsx
+++ b/apps/docs/components/laptop-animation.tsx
@@ -12,7 +12,6 @@ export default function LaptopAnimation() {
offset: ["start end", "end start"],
});
- // Transform values based on scroll position
const rotateX = useTransform(scrollYProgress, [0, 0.5], [20, 0]);
const scale = useTransform(scrollYProgress, [0, 0.5], [1.05, 1]);
const y = useTransform(scrollYProgress, [0, 0.5], [50, 0]);
@@ -28,7 +27,6 @@ export default function LaptopAnimation() {
className="max-w-5xl mx-auto h-[450px] sm:h-[600px] w-full border-4 border-zinc-700 dark:border-zinc-600 p-2 sm:p-6 bg-zinc-800 dark:bg-zinc-900 rounded-[30px] shadow-2xl"
>
<div className="h-full w-full overflow-hidden rounded-2xl bg-white dark:bg-zinc-900">
- {/* Desktop Images */}
<Image
src="https://assets.kaneo.app/board-light.png"
alt="Kaneo board interface - Light mode"
@@ -44,7 +42,6 @@ export default function LaptopAnimation() {
className="object-cover h-full w-full object-left-top rounded-lg transition-transform duration-200 hover:scale-[1.02] hidden sm:dark:block"
/>
- {/* Mobile Images */}
<div className="relative h-full block sm:hidden">
<Image
src="https://assets.kaneo.app/board-light-mobile.png"
diff --git a/apps/docs/lib/og.tsx b/apps/docs/lib/og.tsx
index dfb3d2745..67227a895 100644
--- a/apps/docs/lib/og.tsx
+++ b/apps/docs/lib/og.tsx
@@ -62,7 +62,6 @@ function generate(options: GenerateProps): ReactElement {
overflow: "hidden",
}}
>
- {/* Gradient Background */}
<div
style={{
position: "absolute",
@@ -78,7 +77,6 @@ function generate(options: GenerateProps): ReactElement {
}}
/>
- {/* Content */}
<div
style={{
zIndex: 10,
@@ -118,7 +116,6 @@ function generate(options: GenerateProps): ReactElement {
)}
</div>
- {/* Logo */}
<div
style={{
display: "flex",
diff --git a/apps/web/index.html b/apps/web/index.html
index 1c2b749e5..f5a9a232b 100644
--- a/apps/web/index.html
+++ b/apps/web/index.html
@@ -41,7 +41,7 @@
<meta name="msapplication-TileColor" content="#4F46E5">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="application-name" content="Kaneo">
- <meta name="apple-mobile-web-app-title" content="Kaneo">
+ <meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="canonical" href="https://kaneo.app">
diff --git a/apps/web/package.json b/apps/web/package.json
index c8c815683..a418f73af 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -11,20 +11,25 @@
},
"dependencies": {
"@dnd-kit/core": "^6.3.1",
+ "@dnd-kit/modifiers": "^9.0.0",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@hookform/resolvers": "^5.1.1",
"@radix-ui/react-accordion": "^1.2.10",
- "@radix-ui/react-avatar": "^1.1.9",
- "@radix-ui/react-context-menu": "^2.2.12",
- "@radix-ui/react-dialog": "^1.1.13",
- "@radix-ui/react-dropdown-menu": "^2.1.14",
+ "@radix-ui/react-alert-dialog": "^1.1.14",
+ "@radix-ui/react-avatar": "^1.1.10",
+ "@radix-ui/react-collapsible": "^1.1.11",
+ "@radix-ui/react-context-menu": "^2.2.15",
+ "@radix-ui/react-dialog": "^1.1.14",
+ "@radix-ui/react-dropdown-menu": "^2.1.15",
"@radix-ui/react-label": "^2.1.6",
- "@radix-ui/react-popover": "^1.1.13",
+ "@radix-ui/react-popover": "^1.1.14",
+ "@radix-ui/react-progress": "^1.1.7",
"@radix-ui/react-select": "^2.2.2",
+ "@radix-ui/react-separator": "^1.1.7",
"@radix-ui/react-slot": "^1.2.3",
"@radix-ui/react-switch": "^1.2.4",
- "@radix-ui/react-tooltip": "^1.2.3",
+ "@radix-ui/react-tooltip": "^1.2.7",
"@tanstack/react-query": "^5.75.5",
"@tanstack/react-query-devtools": "^5.75.7",
"@tanstack/react-router": "^1.123.0",
@@ -51,7 +56,7 @@
"immer": "^10.1.1",
"lucide-react": "^0.513.0",
"react": "^19.0.0",
- "react-day-picker": "9.7.0",
+ "react-day-picker": "9.8.0",
"react-dom": "^19.0.0",
"react-hook-form": "^7.58.0",
"react-use-websocket": "^4.11.1",
diff --git a/apps/web/src/components/app-sidebar.tsx b/apps/web/src/components/app-sidebar.tsx
new file mode 100644
index 000000000..7569bbd99
--- /dev/null
+++ b/apps/web/src/components/app-sidebar.tsx
@@ -0,0 +1,42 @@
+import type * as React from "react";
+
+import { NavMain } from "@/components/nav-main";
+import { NavProjects } from "@/components/nav-projects";
+import { NavUser } from "@/components/nav-user";
+import {
+ Sidebar,
+ SidebarContent,
+ SidebarFooter,
+ SidebarHeader,
+ useSidebar,
+} from "@/components/ui/sidebar";
+import { WorkspaceSwitcher } from "@/components/workspace-switcher";
+import { shortcuts } from "@/constants/shortcuts";
+import { useRegisterShortcuts } from "@/hooks/use-keyboard-shortcuts";
+
+export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
+ const { toggleSidebar } = useSidebar();
+
+ useRegisterShortcuts({
+ modifierShortcuts: {
+ [shortcuts.sidebar.prefix]: {
+ [shortcuts.sidebar.toggle]: toggleSidebar,
+ },
+ },
+ });
+
+ return (
+ <Sidebar collapsible="offcanvas" className="border-none pt-3" {...props}>
+ <SidebarHeader>
+ <WorkspaceSwitcher />
+ </SidebarHeader>
+ <SidebarContent>
+ <NavMain />
+ <NavProjects />
+ </SidebarContent>
+ <SidebarFooter>
+ <NavUser />
+ </SidebarFooter>
+ </Sidebar>
+ );
+}
diff --git a/apps/web/src/components/backlog-list-view/backlog-task-row.tsx b/apps/web/src/components/backlog-list-view/backlog-task-row.tsx
index 229ac7bec..3665bdf76 100644
--- a/apps/web/src/components/backlog-list-view/backlog-task-row.tsx
+++ b/apps/web/src/components/backlog-list-view/backlog-task-row.tsx
@@ -1,24 +1,17 @@
import { priorityColorsTaskCard } from "@/constants/priority-colors";
-import useUpdateTask from "@/hooks/mutations/task/use-update-task";
import { cn } from "@/lib/cn";
+import { dueDateStatusColors, getDueDateStatus } from "@/lib/due-date-status";
import useProjectStore from "@/store/project";
-import type { ProjectWithTasks } from "@/types/project";
+import { useUserPreferencesStore } from "@/store/user-preferences";
import type Task from "@/types/task";
import { useSortable } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
-import * as Popover from "@radix-ui/react-popover";
import { useNavigate } from "@tanstack/react-router";
import { format } from "date-fns";
-import { produce } from "immer";
-import {
- Flag,
- GripVertical,
- MoreHorizontal,
- MoveRight,
- User as UserIcon,
-} from "lucide-react";
-import { useState } from "react";
-import { toast } from "sonner";
+import { Calendar, CalendarClock, CalendarX, Flag, User } from "lucide-react";
+import TaskCardContextMenuContent from "../kanban-board/task-card-context-menu/task-card-context-menu-content";
+import TaskCardLabels from "../kanban-board/task-labels";
+import { ContextMenu, ContextMenuTrigger } from "../ui/context-menu";
interface BacklogTaskRowProps {
task: Task;
@@ -26,10 +19,6 @@ interface BacklogTaskRowProps {
export default function BacklogTaskRow({ task }: BacklogTaskRowProps) {
const navigate = useNavigate();
- const { project, setProject } = useProjectStore();
- const { mutate: updateTask } = useUpdateTask();
- const [isMenuOpen, setIsMenuOpen] = useState(false);
-
const {
attributes,
listeners,
@@ -37,67 +26,27 @@ export default function BacklogTaskRow({ task }: BacklogTaskRowProps) {
transform,
transition,
isDragging,
- } = useSortable({
- id: task.id,
- data: {
- type: "task",
- task,
- },
- });
+ } = useSortable({ id: task.id });
+
+ const { project } = useProjectStore();
+ const {
+ showAssignees,
+ showPriority,
+ showDueDates,
+ showLabels,
+ showTaskNumbers,
+ } = useUserPreferencesStore();
const style = {
transform: CSS.Transform.toString(transform),
- transition,
- opacity: isDragging ? 0.5 : 1,
- };
-
- const handleMoveToColumn = (columnId: string) => {
- if (!project) return;
-
- updateTask({
- ...task,
- status: columnId,
- });
-
- const updatedProject = produce(project, (draft: ProjectWithTasks) => {
- if (draft.archivedTasks) {
- const index = draft.archivedTasks.findIndex(
- (t: Task) => t.id === task.id,
- );
- if (index !== -1) {
- draft.archivedTasks.splice(index, 1);
- }
- }
-
- if (draft.plannedTasks) {
- const index = draft.plannedTasks.findIndex(
- (t: Task) => t.id === task.id,
- );
- if (index !== -1) {
- draft.plannedTasks.splice(index, 1);
- }
- }
-
- const targetColumn = draft.columns?.find(
- (col: ProjectWithTasks["columns"][number]) => col.id === columnId,
- );
- if (targetColumn) {
- targetColumn.tasks.push({
- ...task,
- status: columnId,
- assigneeName: task.userEmail,
- assigneeEmail: task.userEmail,
- });
- }
- });
-
- setProject(updatedProject);
- toast.success(`Task moved to ${columnId.replace(/-/g, " ")}`);
- setIsMenuOpen(false);
+ transition:
+ transition || "transform 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94)",
+ touchAction: "none",
};
- const handleClick = () => {
+ const handleClick = (e: React.MouseEvent) => {
if (!project || !task) return;
+ if (e.defaultPrevented) return;
navigate({
to: "/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId",
@@ -109,108 +58,110 @@ export default function BacklogTaskRow({ task }: BacklogTaskRowProps) {
});
};
+ const handleKeyDown = (e: React.KeyboardEvent) => {
+ if (e.key === "Enter") {
+ handleClick(e as unknown as React.MouseEvent);
+ }
+ };
+
return (
<div
ref={setNodeRef}
style={style}
- {...attributes}
className={cn(
- "flex items-center gap-2 p-2 bg-white dark:bg-zinc-900 rounded-lg border border-zinc-200 dark:border-zinc-800 shadow-sm",
+ "border-b border-zinc-200/50 dark:border-zinc-800/50 transition-all duration-200",
isDragging && "opacity-50",
)}
>
- <div
- {...listeners}
- className="cursor-grab p-1 text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300"
- >
- <GripVertical className="w-4 h-4" />
- </div>
+ <ContextMenu>
+ <ContextMenuTrigger asChild>
+ <div
+ onClick={handleClick}
+ onKeyDown={handleKeyDown}
+ className="group relative flex items-center gap-3 px-4 py-1.5 hover:bg-zinc-100/60 dark:hover:bg-zinc-800/20 transition-colors cursor-pointer"
+ {...attributes}
+ {...listeners}
+ >
+ {/* Task ID */}
+ {showTaskNumbers && (
+ <div className="text-xs font-mono text-zinc-400 dark:text-zinc-500 w-16 flex-shrink-0">
+ {project?.slug}-{task.number}
+ </div>
+ )}
- <div className="flex-1 min-w-0">
- <button
- type="button"
- onClick={handleClick}
- className="w-full text-left"
- >
- <div className="flex items-center gap-2">
- <span className="text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate">
- {task.title}
- </span>
- <span className="text-xs px-1.5 py-0.5 bg-zinc-100 dark:bg-zinc-800 text-zinc-500 dark:text-zinc-400 rounded">
- {task.status === "archived" ? "Archived" : "Planned"}
- </span>
- </div>
- <div className="flex items-center gap-2 mt-1">
- {task.priority && (
- <div className="flex items-center gap-1 text-xs text-zinc-500 dark:text-zinc-400">
+ {showPriority && (
+ <div className="flex-shrink-0">
<Flag
- className="w-3 h-3"
- style={{
- color:
- priorityColorsTaskCard[
- task.priority as keyof typeof priorityColorsTaskCard
- ],
- }}
+ className={cn(
+ "w-3 h-3",
+ priorityColorsTaskCard[
+ task.priority as keyof typeof priorityColorsTaskCard
+ ],
+ )}
/>
- <span className="capitalize">{task.priority}</span>
</div>
)}
- {task.assigneeName && (
- <div className="flex items-center gap-1 text-xs text-zinc-500 dark:text-zinc-400">
- <UserIcon className="w-3 h-3" />
- <span>{task.assigneeName}</span>
+
+ {/* Task Title and Labels */}
+ <div className="flex-1 min-w-0 flex items-center gap-2">
+ <div className="flex items-center gap-2 justify-between w-full">
+ <span className="text-sm text-zinc-900 dark:text-zinc-100 truncate">
+ {task.title}
+ </span>
+ {showLabels && (
+ <div className="flex items-center gap-1">
+ <TaskCardLabels taskId={task.id} />
+ </div>
+ )}
</div>
- )}
- {task.dueDate && (
- <div className="flex items-center gap-1 text-xs text-zinc-500 dark:text-zinc-400">
- <UserIcon className="w-3 h-3" />
+ </div>
+
+ {/* Due Date */}
+ {showDueDates && task.dueDate && (
+ <div
+ className={cn(
+ "flex items-center gap-1 text-xs px-1.5 py-0.5 rounded flex-shrink-0",
+ dueDateStatusColors[getDueDateStatus(task.dueDate)],
+ )}
+ >
+ {getDueDateStatus(task.dueDate) === "overdue" && (
+ <CalendarX className="w-3 h-3" />
+ )}
+ {getDueDateStatus(task.dueDate) === "due-soon" && (
+ <CalendarClock className="w-3 h-3" />
+ )}
+ {(getDueDateStatus(task.dueDate) === "far-future" ||
+ getDueDateStatus(task.dueDate) === "no-due-date") && (
+ <Calendar className="w-3 h-3" />
+ )}
<span>{format(new Date(task.dueDate), "MMM d")}</span>
</div>
)}
- </div>
- </button>
- </div>
- <Popover.Root open={isMenuOpen} onOpenChange={setIsMenuOpen}>
- <Popover.Trigger asChild>
- <button
- type="button"
- className="p-1.5 text-zinc-500 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-100 hover:bg-zinc-100 dark:hover:bg-zinc-800 rounded-md transition-colors"
- onClick={(e) => {
- e.stopPropagation();
- setIsMenuOpen(true);
- }}
- >
- <MoreHorizontal className="w-4 h-4" />
- </button>
- </Popover.Trigger>
- <Popover.Content
- className="bg-white dark:bg-zinc-900 rounded-md shadow-md border border-zinc-200 dark:border-zinc-700 p-1 z-50"
- align="end"
- sideOffset={5}
- >
- <div className="bg-zinc-50 dark:bg-zinc-900 px-3 py-2 border-b border-zinc-200 dark:border-zinc-800">
- <div className="text-xs font-medium text-zinc-500 dark:text-zinc-400">
- Move to column
- </div>
- </div>
- <div className="p-1 max-h-60 overflow-y-auto">
- {project?.columns?.map(
- (column: ProjectWithTasks["columns"][number]) => (
- <button
- key={column.id}
- type="button"
- className="w-full text-left px-2 py-1.5 text-sm text-zinc-700 dark:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800 rounded-md flex items-center gap-2 transition-colors"
- onClick={() => handleMoveToColumn(column.id)}
- >
- <MoveRight className="w-3.5 h-3.5 text-zinc-500 dark:text-zinc-400" />
- <span>{column.name}</span>
- </button>
- ),
+ {/* Assignee */}
+ {showAssignees && (
+ <div className="flex items-center gap-1.5 text-xs text-zinc-500 dark:text-zinc-400 flex-shrink-0">
+ <User className="w-3 h-3" />
+ <span className="truncate max-w-[100px]">
+ {task.assigneeName ||
+ task.userEmail?.split("@")[0] ||
+ "Unassigned"}
+ </span>
+ </div>
)}
</div>
- </Popover.Content>
- </Popover.Root>
+ </ContextMenuTrigger>
+
+ {project && (
+ <TaskCardContextMenuContent
+ task={task}
+ taskCardContext={{
+ projectId: project.id,
+ worskpaceId: project.workspaceId,
+ }}
+ />
+ )}
+ </ContextMenu>
</div>
);
}
diff --git a/apps/web/src/components/backlog-list-view/index.tsx b/apps/web/src/components/backlog-list-view/index.tsx
index 674c803b4..c3f1dfff0 100644
--- a/apps/web/src/components/backlog-list-view/index.tsx
+++ b/apps/web/src/components/backlog-list-view/index.tsx
@@ -1,31 +1,32 @@
+import { priorityColorsTaskCard } from "@/constants/priority-colors";
import useUpdateTask from "@/hooks/mutations/task/use-update-task";
import { cn } from "@/lib/cn";
import toKebabCase from "@/lib/to-kebab-case";
-import useProjectStore from "@/store/project";
import type { ProjectWithTasks } from "@/types/project";
import type Task from "@/types/task";
import {
DndContext,
type DragEndEvent,
+ type DragOverEvent,
DragOverlay,
type DragStartEvent,
KeyboardSensor,
MouseSensor,
TouchSensor,
+ type UniqueIdentifier,
+ closestCorners,
useDroppable,
useSensor,
useSensors,
} from "@dnd-kit/core";
+import { snapCenterToCursor } from "@dnd-kit/modifiers";
import {
SortableContext,
verticalListSortingStrategy,
} from "@dnd-kit/sortable";
-import { motion } from "framer-motion";
-import { produce } from "immer";
-import { ChevronDown, Plus } from "lucide-react";
-import { useEffect, useState } from "react";
+import { Archive, ChevronRight, Clock, Flag, Plus } from "lucide-react";
+import { useState } from "react";
import { toast } from "sonner";
-import TaskRowOverlay from "../list-view/task-row-overlay";
import CreateTaskModal from "../shared/modals/create-task-modal";
import BacklogTaskRow from "./backlog-task-row";
@@ -34,245 +35,270 @@ interface BacklogListViewProps {
}
function BacklogListView({ project }: BacklogListViewProps) {
- const { setProject } = useProjectStore();
const { mutate: updateTask } = useUpdateTask();
- const [activeTask, setActiveTask] = useState<Task | null>(null);
- const [activeColumn, setActiveColumn] = useState<string | null>(null);
- const [isTaskModalOpen, setIsTaskModalOpen] = useState(false);
+ const [activeId, setActiveId] = useState<UniqueIdentifier | null>(null);
+ const [overColumnId, setOverColumnId] = useState<string | null>(null);
const [expandedSections, setExpandedSections] = useState<
Record<string, boolean>
- >({});
-
- useEffect(() => {
- if (project?.columns) {
- const initialExpandedState: Record<string, boolean> = {};
- for (const column of project.columns) {
- initialExpandedState[column.id] = true;
- }
- setExpandedSections(initialExpandedState);
- }
- }, [project?.columns]);
+ >({
+ planned: true,
+ archived: true,
+ });
+ const [isTaskModalOpen, setIsTaskModalOpen] = useState(false);
+ const [activeColumn, setActiveColumn] = useState<string | null>(null);
const sensors = useSensors(
- useSensor(MouseSensor),
- useSensor(TouchSensor),
+ useSensor(MouseSensor, {
+ activationConstraint: { distance: 8 },
+ }),
+ useSensor(TouchSensor, {
+ activationConstraint: {
+ delay: 200,
+ tolerance: 8,
+ },
+ }),
useSensor(KeyboardSensor),
);
const handleDragStart = (event: DragStartEvent) => {
- if (event.active.data.current?.type === "task") {
- setActiveTask(event.active.data.current.task);
+ setActiveId(event.active.id);
+ };
+
+ const handleDragOver = (event: DragOverEvent) => {
+ const { over } = event;
+ if (!over || !activeId) {
+ setOverColumnId(null);
+ return;
+ }
+
+ if (over.id === "planned" || over.id === "archived") {
+ setOverColumnId(over.id.toString());
+ return;
+ }
+
+ const taskId = over.id.toString();
+ const plannedTasks = project?.plannedTasks || [];
+ const archivedTasks = project?.archivedTasks || [];
+
+ if (plannedTasks.some((task) => task.id === taskId)) {
+ setOverColumnId("planned");
+ } else if (archivedTasks.some((task) => task.id === taskId)) {
+ setOverColumnId("archived");
+ } else {
+ setOverColumnId(null);
}
};
const handleDragEnd = (event: DragEndEvent) => {
const { active, over } = event;
+ setActiveId(null);
+ setOverColumnId(null);
+
+ if (!over || !project) return;
- if (!over || !active.data.current || !project) return;
+ const activeTaskId = active.id.toString();
+ const overId = over.id.toString();
- if (
- active.data.current.type === "task" &&
- over.data.current?.type === "column"
- ) {
- const task = active.data.current.task as Task;
- const targetColumnId = over.data.current.column.id;
+ const plannedTasks = project.plannedTasks || [];
+ const archivedTasks = project.archivedTasks || [];
+ const activeTask = [...plannedTasks, ...archivedTasks].find(
+ (task) => task.id === activeTaskId,
+ );
+
+ if (!activeTask) return;
- if (task.status === targetColumnId) {
- setActiveTask(null);
+ let targetSection = overId;
+ if (overId !== "planned" && overId !== "archived") {
+ if (plannedTasks.some((task) => task.id === overId)) {
+ targetSection = "planned";
+ } else if (archivedTasks.some((task) => task.id === overId)) {
+ targetSection = "archived";
+ } else {
return;
}
-
- updateTask({
- ...task,
- status: targetColumnId,
- });
-
- const updatedProject = produce(project, (draft: ProjectWithTasks) => {
- if (task.status === "planned" && targetColumnId === "archived") {
- if (draft.plannedTasks) {
- const index = draft.plannedTasks.findIndex(
- (t: Task) => t.id === task.id,
- );
- if (index !== -1) {
- const [removedTask] = draft.plannedTasks.splice(index, 1);
- if (draft.archivedTasks) {
- draft.archivedTasks.push({
- ...removedTask,
- status: "archived",
- });
- }
- }
- }
- } else if (task.status === "archived" && targetColumnId === "planned") {
- if (draft.archivedTasks) {
- const index = draft.archivedTasks.findIndex(
- (t: Task) => t.id === task.id,
- );
- if (index !== -1) {
- const [removedTask] = draft.archivedTasks.splice(index, 1);
- if (draft.plannedTasks) {
- draft.plannedTasks.push({
- ...removedTask,
- status: "planned",
- });
- }
- }
- }
- } else if (
- (task.status === "planned" || task.status === "archived") &&
- (targetColumnId === "to-do" ||
- targetColumnId === "in-progress" ||
- targetColumnId === "in-review" ||
- targetColumnId === "done")
- ) {
- if (task.status === "planned" && draft.plannedTasks) {
- const index = draft.plannedTasks.findIndex(
- (t: Task) => t.id === task.id,
- );
- if (index !== -1) {
- draft.plannedTasks.splice(index, 1);
- }
- } else if (task.status === "archived" && draft.archivedTasks) {
- const index = draft.archivedTasks.findIndex(
- (t: Task) => t.id === task.id,
- );
- if (index !== -1) {
- draft.archivedTasks.splice(index, 1);
- }
- }
-
- const targetColumn = draft.columns?.find(
- (col: ProjectWithTasks["columns"][number]) =>
- col.id === targetColumnId,
- );
- if (targetColumn) {
- targetColumn.tasks.push({
- ...task,
- status: targetColumnId,
- assigneeName: task.assigneeName,
- assigneeEmail: task.assigneeEmail,
- });
- }
- }
- });
-
- setProject(updatedProject);
- toast.success(`Task moved to ${toKebabCase(targetColumnId)}`);
}
- setActiveTask(null);
+ if (activeTask.status === targetSection) return;
+
+ updateTask({
+ ...activeTask,
+ status: targetSection,
+ });
+
+ toast.success(`Task moved to ${targetSection}`);
};
- const toggleSection = (columnId: string) => {
+ const toggleSection = (sectionId: string) => {
setExpandedSections((prev) => ({
...prev,
- [columnId]: !prev[columnId],
+ [sectionId]: !prev[sectionId],
}));
};
- function ColumnSection({
- column,
+ function BacklogSection({
+ sectionId,
+ title,
+ icon: IconComponent,
+ tasks,
+ showAddButton = false,
}: {
- column: ProjectWithTasks["columns"][number];
+ sectionId: string;
+ title: string;
+ icon: typeof Clock;
+ tasks: Task[];
+ showAddButton?: boolean;
}) {
const { setNodeRef } = useDroppable({
- id: column.id,
+ id: sectionId,
data: {
type: "column",
- column,
+ column: { id: sectionId, name: title },
},
});
- return (
- <div className="rounded-lg border border-zinc-200 dark:border-zinc-800 overflow-hidden">
- <button
- type="button"
- onClick={() => toggleSection(column.id)}
- className={cn(
- "w-full flex items-center justify-between p-3 text-left bg-zinc-50 dark:bg-zinc-900 border-b border-zinc-200 dark:border-zinc-800",
- !expandedSections[column.id] && "border-b-0",
- )}
- >
- <div className="flex items-center gap-2">
- <h3 className="font-medium text-zinc-900 dark:text-zinc-100">
- {column.name}
- </h3>
- <span className="text-sm text-zinc-500 dark:text-zinc-500">
- {column.tasks.length}
- </span>
- </div>
- <ChevronDown
- className={cn(
- "w-4 h-4 text-zinc-500 dark:text-zinc-400 transition-transform",
- expandedSections[column.id] ? "transform rotate-180" : "",
- )}
- />
- </button>
+ const showDropIndicator = activeId && overColumnId === sectionId;
- {expandedSections[column.id] && (
- <div ref={setNodeRef} className="min-h-[60px] rounded-lg">
- <SortableContext
- items={column.tasks}
- strategy={verticalListSortingStrategy}
- >
- <motion.div
- initial={false}
- animate={{ opacity: 1 }}
- className="space-y-1 p-2"
- >
- {column.tasks.length > 0 ? (
- column.tasks.map((task: Task) => (
- <BacklogTaskRow key={task.id} task={task} />
- ))
- ) : (
- <div className="p-4 text-center text-sm text-zinc-500 dark:text-zinc-400">
- {/* @ts-expect-error */}
- No {column.id === "planned" ? "planned" : "archived"} tasks
- </div>
- )}
- </motion.div>
- </SortableContext>
+ return (
+ <div
+ className={cn(
+ "border-b border-zinc-200 dark:border-zinc-800/50 transition-all duration-200 overflow-auto",
+ showDropIndicator &&
+ "border-l-4 border-l-indigo-500 dark:border-l-indigo-400 bg-indigo-50/30 dark:bg-indigo-950/10",
+ )}
+ >
+ {/* Header */}
+ <div className="flex items-center justify-between py-2 px-4 bg-zinc-100/60 dark:bg-zinc-800/20 border-b border-zinc-200/50 dark:border-zinc-800/30">
+ <button
+ type="button"
+ onClick={() => toggleSection(sectionId)}
+ className="flex items-center gap-2 text-sm font-medium text-zinc-800 dark:text-zinc-300 hover:text-zinc-900 dark:hover:text-zinc-100 transition-colors"
+ >
+ <ChevronRight
+ className={cn(
+ "w-3 h-3 transition-transform",
+ expandedSections[sectionId] && "rotate-90",
+ )}
+ />
+ <div className="flex items-center gap-2 h-4">
+ <IconComponent className="w-4 h-4 flex-shrink-0 text-zinc-500 dark:text-zinc-400" />
+ <div className="flex items-center gap-1">
+ <span className="mt-1 mr-1">{title}</span>
+ <span className="text-xs text-zinc-400 dark:text-zinc-500 mt-0.5">
+ {tasks.length}
+ </span>
+ </div>
+ </div>
+ </button>
- {/* @ts-expect-error */}
- {column.id === "planned" && (
+ <div className="flex items-center gap-1">
+ {showAddButton && (
<button
type="button"
onClick={() => {
setIsTaskModalOpen(true);
setActiveColumn("planned");
}}
- className="w-full mt-2 text-left px-3 py-2 text-sm text-zinc-600 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800/50 rounded-md flex items-center gap-2 transition-all"
+ className="p-1 hover:bg-zinc-200/70 dark:hover:bg-zinc-700 rounded text-zinc-600 hover:text-zinc-800 dark:text-zinc-500 dark:hover:text-zinc-300 transition-colors"
+ title="Add task"
>
- <Plus className="w-4 h-4 text-zinc-500 dark:text-zinc-400" />
- <span>Add planned task</span>
+ <Plus className="w-3 h-3" />
</button>
)}
</div>
+ </div>
+
+ {/* Tasks */}
+ {expandedSections[sectionId] && (
+ <div ref={setNodeRef} className="bg-white dark:bg-transparent">
+ <SortableContext
+ items={tasks}
+ strategy={verticalListSortingStrategy}
+ >
+ {tasks.map((task) => (
+ <BacklogTaskRow key={task.id} task={task} />
+ ))}
+ </SortableContext>
+
+ {tasks.length === 0 && (
+ <div className="py-6 px-4 text-center text-xs text-zinc-400 dark:text-zinc-500">
+ No {title.toLowerCase()} tasks
+ </div>
+ )}
+ </div>
)}
</div>
);
}
- if (!project?.columns) {
+ if (!project) {
return null;
}
+ const plannedTasks = project.plannedTasks || [];
+ const archivedTasks = project.archivedTasks || [];
+
+ const activeTask =
+ project.plannedTasks.find((task) => task.id === activeId) ||
+ project.archivedTasks.find((task) => task.id === activeId);
+
return (
<DndContext
sensors={sensors}
+ collisionDetection={closestCorners}
onDragStart={handleDragStart}
+ onDragOver={handleDragOver}
onDragEnd={handleDragEnd}
+ modifiers={[snapCenterToCursor]}
>
- <div className="w-full h-full p-4 space-y-4">
- {project.columns.map((column: ProjectWithTasks["columns"][number]) => (
- <ColumnSection key={column.id} column={column} />
- ))}
+ <div className="w-full h-full overflow-auto bg-zinc-50/30 dark:bg-transparent">
+ <div className="divide-y divide-zinc-200 dark:divide-zinc-800/50">
+ <BacklogSection
+ sectionId="planned"
+ title="Planned"
+ icon={Clock}
+ tasks={plannedTasks}
+ showAddButton={true}
+ />
+
+ <BacklogSection
+ sectionId="archived"
+ title="Archived"
+ icon={Archive}
+ tasks={archivedTasks}
+ />
+ </div>
</div>
+
<DragOverlay>
{activeTask && (
- <TaskRowOverlay task={activeTask} projectSlug={project?.slug ?? ""} />
+ <div className="bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg shadow-lg p-2 max-w-[200px] cursor-grabbing">
+ <div className="flex items-center gap-2">
+ <div className="flex-shrink-0">
+ <Flag
+ className={cn(
+ "w-3 h-3",
+ priorityColorsTaskCard[
+ activeTask.priority as keyof typeof priorityColorsTaskCard
+ ],
+ )}
+ />
+ </div>
+
+ <div className="flex-1 min-w-0">
+ <div className="flex items-center gap-1.5">
+ <span className="text-[10px] font-mono text-zinc-400 dark:text-zinc-500">
+ {project?.slug}-{activeTask.number}
+ </span>
+ <span className="text-xs text-zinc-900 dark:text-zinc-100 truncate">
+ {activeTask.title}
+ </span>
+ </div>
+ </div>
+ </div>
+ </div>
)}
</DragOverlay>
+
<CreateTaskModal
open={isTaskModalOpen}
onClose={() => setIsTaskModalOpen(false)}
diff --git a/apps/web/src/components/command-palette/command-group.tsx b/apps/web/src/components/command-palette/command-group.tsx
deleted file mode 100644
index d3b5ae6b7..000000000
--- a/apps/web/src/components/command-palette/command-group.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { cn } from "@/lib/cn";
-import { Command } from "cmdk";
-import type { ReactNode } from "react";
-
-interface CommandGroupProps {
- heading: string;
- children: ReactNode;
- className?: string;
-}
-
-function CommandGroup({ heading, children, className }: CommandGroupProps) {
- return (
- <Command.Group heading={heading} className={cn("relative", className)}>
- <div className="absolute -left-4 -ml-0.5 h-full w-px bg-zinc-200 dark:bg-zinc-700" />
- {children}
- </Command.Group>
- );
-}
-
-export default CommandGroup;
diff --git a/apps/web/src/components/command-palette/index.tsx b/apps/web/src/components/command-palette/index.tsx
index 112fe75ca..0335c8980 100644
--- a/apps/web/src/components/command-palette/index.tsx
+++ b/apps/web/src/components/command-palette/index.tsx
@@ -1,24 +1,23 @@
-import useTheme from "@/components/providers/theme-provider/hooks/use-theme";
-import CreateProjectModal from "@/components/shared/modals/create-project-modal";
+import SearchCommandMenu from "@/components/search-command-menu";
import CreateTaskModal from "@/components/shared/modals/create-task-modal";
import CreateWorkspaceModal from "@/components/shared/modals/create-workspace-modal";
-import useGlobalSearch from "@/hooks/queries/search/use-global-search";
-import { cn } from "@/lib/cn";
-import useProjectStore from "@/store/project";
+import {
+ CommandDialog,
+ CommandEmpty,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
+ CommandList,
+} from "@/components/ui/command";
+import { KbdSequence } from "@/components/ui/kbd";
+import { shortcuts } from "@/constants/shortcuts";
+import { useRegisterShortcuts } from "@/hooks/use-keyboard-shortcuts";
+import { useUserPreferencesStore } from "@/store/user-preferences";
import useWorkspaceStore from "@/store/workspace";
import { useNavigate } from "@tanstack/react-router";
-import { Command } from "cmdk";
-import { motion } from "framer-motion";
-import { AnimatePresence } from "framer-motion";
import {
- CommandIcon,
- FileText,
- FolderOpen,
- Globe,
- Hash,
+ FolderKanban,
LayoutDashboard,
- ListTodo,
- MessageCircle,
Monitor,
Moon,
Plus,
@@ -27,453 +26,213 @@ import {
Sun,
Users,
} from "lucide-react";
-import { useEffect, useState } from "react";
-import CommandGroup from "./command-group";
+import { useState } from "react";
+import CreateProjectModal from "../shared/modals/create-project-modal";
-export function CommandPalette() {
+function CommandPalette() {
+ const { theme, setTheme } = useUserPreferencesStore();
+ const navigate = useNavigate();
+ const { workspace } = useWorkspaceStore();
const [open, setOpen] = useState(false);
- const [isCreateProjectOpen, setIsCreateProjectOpen] = useState(false);
+ const [isSearchOpen, setIsSearchOpen] = useState(false);
const [isCreateTaskOpen, setIsCreateTaskOpen] = useState(false);
+ const [isCreateProjectOpen, setIsCreateProjectOpen] = useState(false);
const [isCreateWorkspaceOpen, setIsCreateWorkspaceOpen] = useState(false);
- const [searchValue, setSearchValue] = useState("");
- const [isGlobalSearch, setIsGlobalSearch] = useState(true);
- const [pendingAction, setPendingAction] = useState<{
- type: "task" | "project" | "workspace";
- status?: string;
- } | null>(null);
- const { workspace } = useWorkspaceStore();
- const { project } = useProjectStore();
- const { theme, setTheme } = useTheme();
- const navigate = useNavigate();
- const searchQuery = useGlobalSearch({
- q: searchValue,
- workspaceId: isGlobalSearch ? undefined : workspace?.id,
- limit: 10,
+ useRegisterShortcuts({
+ modifierShortcuts: {
+ [shortcuts.palette.prefix]: {
+ [shortcuts.palette.open]: () => {
+ setOpen(true);
+ },
+ },
+ },
+ sequentialShortcuts: {
+ [shortcuts.task.prefix]: {
+ [shortcuts.task.create]: () => setIsCreateTaskOpen(true),
+ },
+ [shortcuts.project.prefix]: {
+ [shortcuts.project.create]: () => setIsCreateProjectOpen(true),
+ },
+ [shortcuts.workspace.prefix]: {
+ [shortcuts.workspace.create]: () => {
+ setIsCreateWorkspaceOpen(true);
+ },
+ },
+ },
});
- const searchResults = searchQuery.data?.results || [];
- const hasSearchResults = searchValue.length > 2 && searchResults.length > 0;
-
- const commandItemStyles = cn(
- "px-3 py-2 rounded-lg cursor-pointer flex items-center gap-3",
- "text-sm text-zinc-900 dark:text-zinc-100",
- "aria-selected:bg-zinc-100 dark:aria-selected:bg-zinc-800/50",
- "transition-colors duration-100",
- "disabled:opacity-50 disabled:cursor-not-allowed",
- );
-
- useEffect(() => {
- let timeout: ReturnType<typeof setTimeout>;
- if (!open && pendingAction) {
- setOpen(false);
- timeout = setTimeout(() => {
- switch (pendingAction.type) {
- case "task":
- setIsCreateTaskOpen(true);
- break;
- case "project":
- setIsCreateProjectOpen(true);
- break;
- case "workspace":
- setIsCreateWorkspaceOpen(true);
- break;
- }
- setPendingAction(null);
- }, 150);
- return () => {
- if (timeout) clearTimeout(timeout);
- };
- }
- }, [open, pendingAction]);
-
- useEffect(() => {
- const down = (e: KeyboardEvent) => {
- if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
- e.preventDefault();
- setOpen((open) => !open);
- }
- };
-
- document.addEventListener("keydown", down);
- return () => document.removeEventListener("keydown", down);
- }, []);
-
- useEffect(() => {
- if (!open) {
- setSearchValue("");
- setIsGlobalSearch(true);
- }
- }, [open]);
+ const runCommand = (command: () => unknown) => {
+ command();
+ setOpen(false);
+ };
return (
<>
- <AnimatePresence>
- {open && (
- <>
- <motion.div
- initial={{ opacity: 0 }}
- animate={{ opacity: 1 }}
- exit={{ opacity: 0 }}
- transition={{ duration: 0.1 }}
- className="fixed inset-0 bg-black/40 z-50"
- onClick={() => setOpen(false)}
- />
- <motion.div
- initial={{ opacity: 0, scale: 0.95, y: 10 }}
- animate={{ opacity: 1, scale: 1, y: 0 }}
- exit={{ opacity: 0, scale: 0.95, y: 10 }}
- transition={{ duration: 0.1 }}
- className={cn(
- "fixed top-[20vh] left-1/2 -translate-x-1/2 max-w-[640px] w-full p-4 rounded-xl z-50",
- "bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800",
- "shadow-2xl",
+ <CommandDialog open={open} onOpenChange={setOpen}>
+ <CommandInput placeholder="Type a command or search..." />
+ <CommandList>
+ <CommandEmpty>No results found.</CommandEmpty>
+
+ <CommandGroup heading="Create">
+ <CommandItem
+ onSelect={() => {
+ runCommand(() => {
+ setIsCreateTaskOpen(true);
+ });
+ }}
+ >
+ <Plus className="mr-2 h-4 w-4" />
+ <span>Create task</span>
+ <KbdSequence
+ keys={[shortcuts.task.prefix, shortcuts.task.create]}
+ className="ml-auto"
+ />
+ </CommandItem>
+ <CommandItem
+ onSelect={() => {
+ runCommand(() => {
+ setIsCreateProjectOpen(true);
+ });
+ }}
+ >
+ <FolderKanban className="mr-2 h-4 w-4" />
+ <span>Create project</span>
+ <KbdSequence
+ keys={[shortcuts.project.prefix, shortcuts.project.create]}
+ className="ml-auto"
+ />
+ </CommandItem>
+ <CommandItem
+ onSelect={() => {
+ runCommand(() => {
+ setIsCreateWorkspaceOpen(true);
+ });
+ }}
+ >
+ <Plus className="mr-2 h-4 w-4" />
+ <span>Create workspace</span>
+ <KbdSequence
+ keys={[shortcuts.workspace.prefix, shortcuts.workspace.create]}
+ className="ml-auto"
+ />
+ </CommandItem>
+ </CommandGroup>
+
+ <CommandGroup heading="Navigation">
+ <CommandItem
+ onSelect={() =>
+ runCommand(() =>
+ navigate({
+ to: "/dashboard/workspace/$workspaceId",
+ params: { workspaceId: workspace?.id ?? "" },
+ }),
+ )
+ }
+ >
+ <LayoutDashboard className="mr-2 h-4 w-4" />
+ <span>Projects</span>
+ </CommandItem>
+ <CommandItem
+ onSelect={() =>
+ runCommand(() => {
+ setIsSearchOpen(true);
+ })
+ }
+ >
+ <Search className="mr-2 h-4 w-4" />
+ <span>Search</span>
+ <KbdSequence
+ keys={[shortcuts.search.prefix]}
+ className="ml-auto"
+ />
+ </CommandItem>
+ <CommandItem
+ onSelect={() =>
+ runCommand(() =>
+ navigate({
+ to: "/dashboard/workspace/$workspaceId/members",
+ params: { workspaceId: workspace?.id ?? "" },
+ }),
+ )
+ }
+ >
+ <Users className="mr-2 h-4 w-4" />
+ <span>Members</span>
+ </CommandItem>
+ <CommandItem
+ onSelect={() =>
+ runCommand(() =>
+ navigate({
+ to: "/dashboard/workspace/$workspaceId/settings",
+ params: { workspaceId: workspace?.id ?? "" },
+ }),
+ )
+ }
+ >
+ <Settings className="mr-2 h-4 w-4" />
+ <span>Settings</span>
+ </CommandItem>
+ </CommandGroup>
+
+ <CommandGroup heading="Theme">
+ <CommandItem
+ onSelect={() =>
+ runCommand(() => {
+ setTheme("light");
+ })
+ }
+ >
+ <Sun className="mr-2 h-4 w-4" />
+ <span>Light theme</span>
+ {theme === "light" && (
+ <div className="ml-auto h-2 w-2 rounded-full bg-primary" />
)}
+ </CommandItem>
+ <CommandItem
+ onSelect={() =>
+ runCommand(() => {
+ setTheme("dark");
+ })
+ }
>
- <Command.Dialog
- open={open}
- onOpenChange={setOpen}
- label="Global Command Menu"
- shouldFilter={false}
- className={cn(
- "fixed top-[20vh] left-1/2 -translate-x-1/2 max-w-[640px] w-full p-4 rounded-xl z-50",
- "bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800",
- "shadow-2xl",
- "data-[state=open]:animate-in",
- "data-[state=closed]:animate-out",
- "data-[state=closed]:fade-out-0",
- "data-[state=open]:fade-in-0",
- "data-[state=closed]:zoom-out-95",
- "data-[state=open]:zoom-in-95",
- "data-[state=closed]:slide-out-to-left-1/2",
- "data-[state=closed]:slide-out-to-top-[48%]",
- "data-[state=open]:slide-in-from-left-1/2",
- "data-[state=open]:slide-in-from-top-[48%]",
- )}
- >
- <div className="px-3 pb-4 mb-4 border-b border-zinc-200 dark:border-zinc-800">
- <div className="flex items-center gap-4 mb-3">
- <Search className="w-5 h-5 text-zinc-500 dark:text-zinc-400" />
- <Command.Input
- placeholder="Type a command or search..."
- value={searchValue}
- onValueChange={setSearchValue}
- className={cn(
- "w-full outline-none bg-transparent",
- "text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-500 dark:placeholder:text-zinc-400",
- )}
- />
- <kbd className="hidden sm:inline-flex items-center gap-1 px-2 py-0.5 text-xs font-mono text-zinc-600 dark:text-zinc-400 rounded border border-zinc-300 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800">
- <CommandIcon className="w-3 h-3" />K
- </kbd>
- </div>
-
- {/* Search scope toggle */}
- {searchValue.length > 2 && (
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <button
- type="button"
- onClick={() => setIsGlobalSearch(!isGlobalSearch)}
- className={cn(
- "flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-colors",
- isGlobalSearch
- ? "bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300"
- : "bg-zinc-100 dark:bg-zinc-800 text-zinc-600 dark:text-zinc-400 hover:bg-zinc-200 dark:hover:bg-zinc-700",
- )}
- >
- {isGlobalSearch ? (
- <Globe className="w-3 h-3" />
- ) : (
- <Users className="w-3 h-3" />
- )}
- {isGlobalSearch
- ? "All workspaces"
- : workspace?.name || "Current workspace"}
- </button>
- </div>
- <div className="text-xs text-zinc-500 dark:text-zinc-400">
- {searchResults.length} result
- {searchResults.length !== 1 ? "s" : ""}
- </div>
- </div>
- )}
- </div>
- <Command.List className="max-h-[300px] overflow-y-auto px-3">
- <Command.Empty className="py-6 text-center text-sm text-zinc-500 dark:text-zinc-400">
- No results found.
- </Command.Empty>
-
- {/* Search Results */}
- {hasSearchResults && (
- <CommandGroup heading="Search Results">
- {searchResults.map((result) => {
- const getIcon = () => {
- switch (result.type) {
- case "task":
- return <Hash className="w-4 h-4" />;
- case "project":
- return <FolderOpen className="w-4 h-4" />;
- case "workspace":
- return <Users className="w-4 h-4" />;
- case "comment":
- return <MessageCircle className="w-4 h-4" />;
- case "activity":
- return <FileText className="w-4 h-4" />;
- default:
- return <Search className="w-4 h-4" />;
- }
- };
-
- const handleSelect = () => {
- setOpen(false);
- if (
- result.type === "task" &&
- result.projectId &&
- result.workspaceId
- ) {
- navigate({
- to: "/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId",
- params: {
- workspaceId: result.workspaceId,
- projectId: result.projectId,
- taskId: result.id,
- },
- });
- } else if (
- result.type === "project" &&
- result.workspaceId
- ) {
- navigate({
- to: "/dashboard/workspace/$workspaceId/project/$projectId/board",
- params: {
- workspaceId: result.workspaceId,
- projectId: result.id,
- },
- });
- } else if (result.type === "workspace") {
- navigate({
- to: "/dashboard/workspace/$workspaceId",
- params: {
- workspaceId: result.id,
- },
- });
- }
- };
-
- return (
- <Command.Item
- key={result.id}
- onSelect={handleSelect}
- className={commandItemStyles}
- >
- {getIcon()}
- <div className="flex-1 min-w-0">
- <div className="font-medium text-sm truncate">
- {result.title}
- {result.taskNumber && ` #${result.taskNumber}`}
- </div>
- {result.content && (
- <div className="text-xs text-zinc-500 dark:text-zinc-400 truncate">
- {result.content}
- </div>
- )}
- </div>
- <div className="text-xs text-zinc-500 dark:text-zinc-400 ml-2">
- {result.projectName && (
- <span className="bg-zinc-100 dark:bg-zinc-800 px-2 py-0.5 rounded">
- {result.projectName}
- </span>
- )}
- </div>
- </Command.Item>
- );
- })}
- </CommandGroup>
- )}
-
- {/* Regular Commands - only show when no search or no search results */}
- {!hasSearchResults && (
- <>
- <CommandGroup heading="Tasks">
- <Command.Item
- onSelect={() => {
- setOpen(false);
- setPendingAction({ type: "task", status: "to-do" });
- }}
- disabled={!project}
- className={commandItemStyles}
- >
- <Plus className="w-4 h-4" />
- Create new task
- {!project && (
- <span className="ml-auto text-xs text-zinc-500 dark:text-zinc-400">
- Select a project first
- </span>
- )}
- </Command.Item>
- </CommandGroup>
-
- <CommandGroup heading="Projects" className="mt-4">
- <Command.Item
- onSelect={() => {
- setOpen(false);
- setPendingAction({ type: "project" });
- }}
- disabled={!workspace}
- className={commandItemStyles}
- >
- <Plus className="w-4 h-4" />
- Create new project
- {!workspace && (
- <span className="ml-auto text-xs text-zinc-500 dark:text-zinc-400">
- Select a workspace first
- </span>
- )}
- </Command.Item>
- </CommandGroup>
-
- <CommandGroup heading="Project" className="mt-4">
- {project && (
- <Command.Item
- onSelect={() => {
- navigate({
- to: "/dashboard/workspace/$workspaceId/project/$projectId/board",
- params: {
- workspaceId: workspace?.id ?? "",
- projectId: project.id,
- },
- });
- setOpen(false);
- }}
- className={commandItemStyles}
- >
- <LayoutDashboard className="w-4 h-4" />
- Go to Board
- </Command.Item>
- )}
-
- {project && (
- <Command.Item
- className={commandItemStyles}
- onSelect={() => {
- navigate({
- to: "/dashboard/workspace/$workspaceId/project/$projectId/backlog",
- params: {
- workspaceId: workspace?.id ?? "",
- projectId: project?.id ?? "",
- },
- });
- setOpen(false);
- }}
- >
- <ListTodo className="w-4 h-4" />
- Go to Backlog
- </Command.Item>
- )}
-
- {project && (
- <Command.Item
- onSelect={() => {
- setOpen(false);
- navigate({
- to: "/dashboard/workspace/$workspaceId/project/$projectId/settings",
- params: {
- workspaceId: workspace?.id ?? "",
- projectId: project.id,
- },
- });
- }}
- className={commandItemStyles}
- >
- <Settings className="w-4 h-4" />
- Project settings
- </Command.Item>
- )}
- </CommandGroup>
-
- <CommandGroup heading="Workspace" className="mt-4">
- <Command.Item
- onSelect={() => {
- setOpen(false);
- setPendingAction({ type: "workspace" });
- }}
- className={commandItemStyles}
- >
- <Plus className="w-4 h-4" />
- Create new workspace
- </Command.Item>
- </CommandGroup>
-
- <CommandGroup heading="Appearance" className="mt-4 mb-2">
- <Command.Item
- onSelect={() => {
- setTheme("light");
- setOpen(false);
- }}
- className={commandItemStyles}
- >
- <Sun className="w-4 h-4" />
- Light mode
- {theme === "light" && (
- <span className="ml-auto text-xs text-zinc-500 dark:text-zinc-400">
- ✓
- </span>
- )}
- </Command.Item>
- <Command.Item
- onSelect={() => {
- setTheme("dark");
- setOpen(false);
- }}
- className={commandItemStyles}
- >
- <Moon className="w-4 h-4" />
- Dark mode
- {theme === "dark" && (
- <span className="ml-auto text-xs text-zinc-500 dark:text-zinc-400">
- ✓
- </span>
- )}
- </Command.Item>
- <Command.Item
- onSelect={() => {
- setTheme("system");
- setOpen(false);
- }}
- className={commandItemStyles}
- >
- <Monitor className="w-4 h-4" />
- System mode
- {theme === "system" && (
- <span className="ml-auto text-xs text-zinc-500 dark:text-zinc-400">
- ✓
- </span>
- )}
- </Command.Item>
- </CommandGroup>
- </>
- )}
- </Command.List>
- </Command.Dialog>
- </motion.div>
- </>
- )}
- </AnimatePresence>
-
- <CreateProjectModal
- open={isCreateProjectOpen}
- onClose={() => setIsCreateProjectOpen(false)}
- />
+ <Moon className="mr-2 h-4 w-4" />
+ <span>Dark theme</span>
+ {theme === "dark" && (
+ <div className="ml-auto h-2 w-2 rounded-full bg-primary" />
+ )}
+ </CommandItem>
+ <CommandItem
+ onSelect={() =>
+ runCommand(() => {
+ setTheme("system");
+ })
+ }
+ >
+ <Monitor className="mr-2 h-4 w-4" />
+ <span>System theme</span>
+ {theme === "system" && (
+ <div className="ml-auto h-2 w-2 rounded-full bg-primary" />
+ )}
+ </CommandItem>
+ </CommandGroup>
+ </CommandList>
+ </CommandDialog>
+ <SearchCommandMenu open={isSearchOpen} setOpen={setIsSearchOpen} />
<CreateTaskModal
open={isCreateTaskOpen}
onClose={() => setIsCreateTaskOpen(false)}
- status="to-do"
/>
<CreateWorkspaceModal
open={isCreateWorkspaceOpen}
onClose={() => setIsCreateWorkspaceOpen(false)}
/>
+ <CreateProjectModal
+ open={isCreateProjectOpen}
+ onClose={() => setIsCreateProjectOpen(false)}
+ />
</>
);
}
+
+export default CommandPalette;
diff --git a/apps/web/src/components/common/layout.tsx b/apps/web/src/components/common/layout.tsx
new file mode 100644
index 000000000..90f0dd062
--- /dev/null
+++ b/apps/web/src/components/common/layout.tsx
@@ -0,0 +1,70 @@
+import { AppSidebar } from "@/components/app-sidebar";
+import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar";
+import { useUserPreferencesEffects } from "@/hooks/use-user-preferences-effects";
+import { useUserPreferencesStore } from "@/store/user-preferences";
+import { motion } from "framer-motion";
+import type { ReactNode } from "react";
+import type React from "react";
+
+interface LayoutProps {
+ children: ReactNode;
+}
+
+interface HeaderProps {
+ children: ReactNode;
+}
+
+interface ContentProps {
+ children: ReactNode;
+}
+
+function LayoutHeader({ children }: HeaderProps) {
+ return (
+ <motion.header
+ initial={{ opacity: 0, y: -20 }}
+ animate={{ opacity: 1, y: 0 }}
+ transition={{ duration: 0.3 }}
+ className="flex h-10 shrink-0 gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-8 border-b border-border bg-card p-2"
+ >
+ {children}
+ </motion.header>
+ );
+}
+
+function LayoutContent({ children }: ContentProps) {
+ return (
+ <div className="flex-1 min-h-0">
+ <div className="h-full">{children}</div>
+ </div>
+ );
+}
+
+function Layout({ children }: LayoutProps) {
+ const { sidebarDefaultOpen } = useUserPreferencesStore();
+
+ useUserPreferencesEffects();
+
+ return (
+ <div className="flex w-full bg-sidebar">
+ <SidebarProvider
+ defaultOpen={sidebarDefaultOpen}
+ style={
+ {
+ "--sidebar-width": "calc(var(--spacing) * 60)",
+ "--header-height": "calc(var(--spacing) * 12)",
+ } as React.CSSProperties
+ }
+ >
+ <AppSidebar />
+ <SidebarInset className="flex-1 flex flex-col overflow-auto bg-card border border-border rounded-md m-2">
+ {children}
+ </SidebarInset>
+ </SidebarProvider>
+ </div>
+ );
+}
+
+Layout.Header = LayoutHeader;
+Layout.Content = LayoutContent;
+
+export default Layout;
diff --git a/apps/web/src/components/common/project-layout.tsx b/apps/web/src/components/common/project-layout.tsx
new file mode 100644
index 000000000..6514a9786
--- /dev/null
+++ b/apps/web/src/components/common/project-layout.tsx
@@ -0,0 +1,104 @@
+import Layout from "@/components/common/layout";
+import NotificationDropdown from "@/components/notification/notification-dropdown";
+import {
+ Breadcrumb,
+ BreadcrumbItem,
+ BreadcrumbLink,
+ BreadcrumbList,
+ BreadcrumbSeparator,
+} from "@/components/ui/breadcrumb";
+import { KbdSequence } from "@/components/ui/kbd";
+import { Separator } from "@/components/ui/separator";
+import { SidebarTrigger } from "@/components/ui/sidebar";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
+import { shortcuts } from "@/constants/shortcuts";
+import useGetProject from "@/hooks/queries/project/use-get-project";
+import useWorkspaceStore from "@/store/workspace";
+import type { ReactNode } from "react";
+
+interface ProjectLayoutProps {
+ projectId: string;
+ workspaceId: string;
+ title: string;
+ headerActions?: ReactNode;
+ children: ReactNode;
+}
+
+export default function ProjectLayout({
+ projectId,
+ workspaceId,
+ title,
+ headerActions,
+ children,
+}: ProjectLayoutProps) {
+ const { workspace } = useWorkspaceStore();
+ const { data: project } = useGetProject({ id: projectId, workspaceId });
+
+ return (
+ <Layout>
+ <Layout.Header>
+ <div className="flex items-center justify-between w-full">
+ <div className="flex items-center gap-1 w-full">
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <SidebarTrigger className="-ml-1 h-6 w-6" />
+ </TooltipTrigger>
+ <TooltipContent>
+ <p className="flex items-center gap-2 text-xs">
+ Toggle sidebar
+ <KbdSequence
+ keys={[
+ shortcuts.sidebar.prefix,
+ shortcuts.sidebar.toggle,
+ ]}
+ />
+ </p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ <Separator
+ orientation="vertical"
+ className="mx-1.5 data-[orientation=vertical]:h-2.5"
+ />
+ <Breadcrumb className="flex items-center gap-1 text-xs w-full">
+ <BreadcrumbList>
+ <BreadcrumbItem>
+ <BreadcrumbLink href={`/dashboard/workspace/${workspaceId}`}>
+ <h1 className="text-xs text-card-foreground">
+ {workspace?.name}
+ </h1>
+ </BreadcrumbLink>
+ </BreadcrumbItem>
+ <BreadcrumbSeparator />
+ <BreadcrumbItem>
+ <BreadcrumbLink
+ href={`/dashboard/workspace/${workspaceId}/project/${projectId}/board`}
+ >
+ <h1 className="text-xs text-card-foreground">
+ {project?.name}
+ </h1>
+ </BreadcrumbLink>
+ </BreadcrumbItem>
+ <BreadcrumbSeparator />
+ <BreadcrumbItem>
+ <h1 className="text-xs text-card-foreground">{title}</h1>
+ </BreadcrumbItem>
+ </BreadcrumbList>
+ </Breadcrumb>
+ </div>
+ <div className="flex items-center gap-1.5">
+ <NotificationDropdown />
+ {headerActions}
+ </div>
+ </div>
+ </Layout.Header>
+ <Layout.Content>{children}</Layout.Content>
+ </Layout>
+ );
+}
diff --git a/apps/web/src/components/common/sidebar/index.tsx b/apps/web/src/components/common/sidebar/index.tsx
deleted file mode 100644
index 163593ba3..000000000
--- a/apps/web/src/components/common/sidebar/index.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-import { cn } from "@/lib/cn";
-import { useUserPreferencesStore } from "@/store/user-preferences";
-import { SidebarContent } from "./sidebar-content";
-import SidebarFooter from "./sidebar-footer";
-import { SidebarHeader } from "./sidebar-header";
-
-export function Sidebar() {
- const { isSidebarOpened, setIsSidebarOpened } = useUserPreferencesStore();
-
- return (
- <>
- <div
- onClick={() => setIsSidebarOpened()}
- onKeyDown={(e) => {
- if (e.key === "Escape") {
- setIsSidebarOpened();
- }
- }}
- className={cn(
- "fixed inset-0 bg-black/50 z-30 lg:hidden",
- isSidebarOpened ? "opacity-100" : "opacity-0 pointer-events-none",
- "transition-opacity duration-300 ease-in-out",
- )}
- />
-
- <div className="w-16 shrink-0 lg:hidden" />
-
- <div
- className={cn(
- "flex flex-col bg-white dark:bg-zinc-900 border-r border-zinc-200 dark:border-zinc-800",
- "transition-all duration-300 ease-in-out",
- "fixed lg:relative top-0 left-0 bottom-0",
- "z-30",
- !isSidebarOpened ? "w-16" : "w-64",
- )}
- >
- <SidebarHeader />
- <div className="flex-1 overflow-y-auto">
- <SidebarContent />
- </div>
- <div className="relative z-10">
- <SidebarFooter />
- </div>
- </div>
- </>
- );
-}
diff --git a/apps/web/src/components/common/sidebar/sections/manage-teams/index.tsx b/apps/web/src/components/common/sidebar/sections/manage-teams/index.tsx
deleted file mode 100644
index 15cc1b7c0..000000000
--- a/apps/web/src/components/common/sidebar/sections/manage-teams/index.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-import { cn } from "@/lib/cn";
-import { useUserPreferencesStore } from "@/store/user-preferences";
-import useWorkspaceStore from "@/store/workspace";
-import { useNavigate, useRouterState } from "@tanstack/react-router";
-import { Users } from "lucide-react";
-
-function ManageTeams() {
- const { isSidebarOpened } = useUserPreferencesStore();
- const navigate = useNavigate();
- const { workspace } = useWorkspaceStore();
- const location = useRouterState({ select: (s) => s.location });
- const isOnTeamsRoute = location.pathname.includes("/teams");
-
- const onManageTeams = () => {
- if (!workspace) return;
-
- navigate({
- to: "/dashboard/teams/$workspaceId/members",
- params: {
- workspaceId: workspace.id,
- },
- });
- };
-
- return (
- <div>
- <h2
- className={cn(
- "text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider mb-2",
- isSidebarOpened && "px-3",
- )}
- >
- {isSidebarOpened && "Team"}
- </h2>
- <button
- type="button"
- className={cn(
- "w-full text-left py-2 rounded-md flex items-center text-sm transition-all group",
- isSidebarOpened && "px-3",
- !isSidebarOpened && "justify-center px-2",
- "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
- isOnTeamsRoute &&
- "bg-indigo-51 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400",
- )}
- title={!isSidebarOpened ? "Manage Team" : undefined}
- onClick={() => onManageTeams()}
- >
- <Users
- className={cn(
- "shrink-0",
- !isSidebarOpened ? "w-6 h-6" : "w-4 h-4 mr-2",
- )}
- />
- {isSidebarOpened && "Manage Team"}
- </button>
- </div>
- );
-}
-
-export default ManageTeams;
diff --git a/apps/web/src/components/common/sidebar/sections/projects/index.tsx b/apps/web/src/components/common/sidebar/sections/projects/index.tsx
deleted file mode 100644
index d46d86310..000000000
--- a/apps/web/src/components/common/sidebar/sections/projects/index.tsx
+++ /dev/null
@@ -1,253 +0,0 @@
-import Tip from "@/components/common/tip";
-import icons from "@/constants/project-icons";
-import useGetProjects from "@/hooks/queries/project/use-get-projects";
-import { cn } from "@/lib/cn";
-import useProjectStore from "@/store/project";
-import { useUserPreferencesStore } from "@/store/user-preferences";
-import type { ProjectWithTasks } from "@/types/project";
-import { useLocation, useNavigate } from "@tanstack/react-router";
-import {
- Layout,
- LayoutDashboard,
- ListTodo,
- Plus,
- Settings,
-} from "lucide-react";
-import { createElement, useState } from "react";
-import CreateProjectModal from "../../../../shared/modals/create-project-modal";
-
-type ProjectsProps = {
- workspaceId: string;
-};
-
-function Projects({ workspaceId }: ProjectsProps) {
- const { project: currentProject, setProject } = useProjectStore();
- const { data: projects, isLoading } = useGetProjects({ workspaceId });
- const [isCreateProjectOpen, setIsCreateProjectOpen] = useState(false);
- const { isSidebarOpened } = useUserPreferencesStore();
- const navigate = useNavigate();
- const location = useLocation();
-
- const handleSelectProject = (selectedProject: ProjectWithTasks) => {
- if (
- currentProject?.id === selectedProject.id &&
- location.pathname.includes("/board")
- )
- return;
-
- setProject(selectedProject);
- navigate({
- to: "/dashboard/workspace/$workspaceId/project/$projectId/board",
- params: {
- workspaceId,
- projectId: selectedProject.id,
- },
- });
- };
-
- if (isLoading) {
- return (
- <div className="space-y-1 w-full">
- {[1, 2, 3].map((i) => (
- <div
- key={i}
- className="animate-pulse flex items-center px-4 py-1.5 rounded-md"
- >
- <div className="h-4 shrink-0 w-4 bg-zinc-200 dark:bg-zinc-800 rounded mr-2" />
- <div className="h-4 w-full bg-zinc-200 dark:bg-zinc-800 rounded" />
- </div>
- ))}
- </div>
- );
- }
-
- return (
- <div>
- <div
- className={cn(
- "flex items-center justify-between mb-2",
- isSidebarOpened && "px-3",
- )}
- >
- <h2 className="text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">
- {isSidebarOpened && "Projects"}
- </h2>
- <button
- type="button"
- onClick={() => setIsCreateProjectOpen(true)}
- className={cn(
- "rounded-md hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors",
- !isSidebarOpened ? "p-2" : "p-1",
- )}
- >
- <Plus
- className={cn(
- "text-zinc-500 dark:text-zinc-400",
- !isSidebarOpened ? "w-5 h-5" : "w-4 h-4",
- )}
- />
- </button>
- </div>
- <div className="space-y-0.5">
- {projects && projects.length > 0
- ? projects.map((project: ProjectWithTasks) => (
- <div key={project.id} className="space-y-0.5">
- {!isSidebarOpened ? (
- <Tip content={project.name}>
- <button
- type="button"
- onClick={() =>
- handleSelectProject({
- id: project.id,
- name: project.name,
- slug: project.slug,
- description: project.description,
- workspaceId: project.workspaceId,
- icon: project.icon ?? "Layout",
- columns: project.columns,
- archivedTasks: project.archivedTasks,
- plannedTasks: project.plannedTasks,
- isPublic: project.isPublic,
- })
- }
- className={cn(
- "w-full px-4 py-2 rounded-md flex items-center text-sm transition-all group",
- "justify-center px-2",
- project.id === currentProject?.id
- ? "bg-indigo-51 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
- : "text-zinc-601 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
- )}
- >
- {createElement(
- icons[project.icon as keyof typeof icons] || Layout,
- {
- className: "w-6 h-6 shrink-0",
- },
- )}
- </button>
- </Tip>
- ) : (
- <>
- <button
- type="button"
- onClick={() =>
- handleSelectProject({
- id: project.id,
- name: project.name,
- slug: project.slug,
- description: project.description,
- workspaceId: project.workspaceId,
- icon: project.icon ?? "Layout",
- columns: project.columns,
- archivedTasks: project.archivedTasks,
- plannedTasks: project.plannedTasks,
- isPublic: project.isPublic,
- })
- }
- className={cn(
- "w-full px-4 py-2 rounded-md flex items-center text-sm transition-all group",
- project.id === currentProject?.id &&
- !location.pathname.includes("/settings") &&
- !location.pathname.includes("/board") &&
- !location.pathname.includes("/backlog")
- ? "bg-indigo-500/10 text-indigo-500 dark:bg-indigo-400/10 dark:text-indigo-400 font-medium"
- : "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
- )}
- >
- {createElement(
- icons[project.icon as keyof typeof icons] || Layout,
- {
- className: "w-4 h-4 mr-2 shrink-0",
- },
- )}
- {project.name}
- </button>
- {project.id === currentProject?.id && (
- <div className="pl-6 space-y-0.5">
- <button
- type="button"
- onClick={() =>
- navigate({
- to: "/dashboard/workspace/$workspaceId/project/$projectId/board",
- params: {
- workspaceId,
- projectId: project.id,
- },
- })
- }
- className={cn(
- "w-full px-3 py-1.5 rounded-md flex items-center text-sm transition-all group",
- location.pathname.includes("/board") &&
- !location.pathname.includes("/backlog")
- ? "bg-indigo-500/10 text-indigo-500 dark:bg-indigo-400/10 dark:text-indigo-400"
- : "text-zinc-500 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800/50",
- )}
- >
- <LayoutDashboard className="w-3.5 h-3.5 mr-2 shrink-0" />
- Board
- </button>
- <button
- type="button"
- onClick={() =>
- navigate({
- to: "/dashboard/workspace/$workspaceId/project/$projectId/backlog",
- params: {
- workspaceId,
- projectId: project.id,
- },
- })
- }
- className={cn(
- "w-full px-3 py-1.5 rounded-md flex items-center text-sm transition-all group",
- location.pathname.includes("/backlog")
- ? "bg-indigo-500/10 text-indigo-500 dark:bg-indigo-400/10 dark:text-indigo-400"
- : "text-zinc-500 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800/50",
- )}
- >
- <ListTodo className="w-3.5 h-3.5 mr-2 shrink-0" />
- Backlog
- </button>
- <button
- type="button"
- onClick={() =>
- navigate({
- to: "/dashboard/workspace/$workspaceId/project/$projectId/settings",
- params: {
- workspaceId,
- projectId: project.id,
- },
- })
- }
- className={cn(
- "w-full px-3 py-1.5 rounded-md flex items-center text-sm transition-all group",
- location.pathname.includes("/settings")
- ? "bg-indigo-500/10 text-indigo-500 dark:bg-indigo-400/10 dark:text-indigo-400"
- : "text-zinc-500 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800/50",
- )}
- >
- <Settings className="w-3.5 h-3.5 mr-2 shrink-0" />
- Settings
- </button>
- </div>
- )}
- </>
- )}
- </div>
- ))
- : isSidebarOpened && (
- <div className="px-3 py-4 flex flex-col items-center text-center">
- <p className="text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-1">
- No projects yet
- </p>
- </div>
- )}
- </div>
- <CreateProjectModal
- open={isCreateProjectOpen}
- onClose={() => setIsCreateProjectOpen(false)}
- />
- </div>
- );
-}
-
-export default Projects;
diff --git a/apps/web/src/components/common/sidebar/sections/user-info.tsx b/apps/web/src/components/common/sidebar/sections/user-info.tsx
deleted file mode 100644
index b476704ad..000000000
--- a/apps/web/src/components/common/sidebar/sections/user-info.tsx
+++ /dev/null
@@ -1,102 +0,0 @@
-import useAuth from "@/components/providers/auth-provider/hooks/use-auth";
-import { Avatar, AvatarFallback } from "@/components/ui/avatar";
-import useSignOut from "@/hooks/mutations/use-sign-out";
-import { cn } from "@/lib/cn";
-import useProjectStore from "@/store/project";
-import { useUserPreferencesStore } from "@/store/user-preferences";
-import useWorkspaceStore from "@/store/workspace";
-import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
-import { useQueryClient } from "@tanstack/react-query";
-import { useNavigate } from "@tanstack/react-router";
-import { LogOut, Settings } from "lucide-react";
-import { toast } from "sonner";
-
-function UserInfo() {
- const { user, setUser } = useAuth();
- const { isSidebarOpened } = useUserPreferencesStore();
- const navigate = useNavigate();
- const { mutateAsync: signOut, isPending } = useSignOut();
- const queryClient = useQueryClient();
- const { setProject } = useProjectStore();
- const { setWorkspace } = useWorkspaceStore();
-
- const handleSignOut = async () => {
- try {
- await signOut();
- queryClient.clear();
- setUser(null);
- setProject(undefined);
- setWorkspace(undefined);
- toast.success("Signed out successfully");
- navigate({ to: "/auth/sign-in" });
- } catch (error) {
- toast.error(
- error instanceof Error ? error.message : "Failed to sign out",
- );
- }
- };
-
- const handleClickSettings = () => {
- navigate({ to: "/dashboard/settings/appearance" });
- };
-
- return (
- <DropdownMenu.Root>
- <DropdownMenu.Trigger asChild>
- <button
- type="button"
- className={cn(
- "flex items-center w-full",
- isSidebarOpened ? "gap-3 justify-start" : "justify-center",
- "rounded-lg p-2 transition-all",
- "border border-transparent",
- "hover:bg-white dark:hover:bg-zinc-800/50",
- "hover:border-zinc-200 dark:hover:border-zinc-700/50",
- "hover:shadow-sm dark:hover:shadow-none",
- )}
- >
- <Avatar className="text-zinc-900 dark:text-zinc-100">
- <AvatarFallback>{user?.name?.charAt(0)}</AvatarFallback>
- </Avatar>
- <div className={cn(!isSidebarOpened && "hidden")}>
- <p className="text-sm text-left font-medium text-zinc-900 dark:text-zinc-100 truncate">
- {user?.name}
- </p>
- <p className="text-xs text-zinc-500 dark:text-zinc-400 truncate max-w-[150px]">
- {user?.email}
- </p>
- </div>
- </button>
- </DropdownMenu.Trigger>
-
- <DropdownMenu.Portal>
- <DropdownMenu.Content
- className="w-56 bg-white dark:bg-zinc-800 rounded-lg shadow-lg border border-zinc-200 dark:border-zinc-700 py-1 z-50"
- align="start"
- sideOffset={5}
- >
- <DropdownMenu.Item
- className="flex items-center px-3 py-2 text-sm text-zinc-600 dark:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-700 cursor-pointer outline-none"
- onClick={handleClickSettings}
- >
- <Settings className="w-4 h-4 mr-2" />
- Settings
- </DropdownMenu.Item>
-
- <DropdownMenu.Separator className="h-px bg-zinc-200 dark:bg-zinc-700 my-1" />
-
- <DropdownMenu.Item
- className="flex items-center px-3 py-2 text-sm text-red-600 dark:text-red-400 hover:bg-zinc-100 dark:hover:bg-zinc-700 cursor-pointer outline-none"
- onClick={handleSignOut}
- disabled={isPending}
- >
- <LogOut className="w-4 h-4 mr-2" />
- {isPending ? "Signing out..." : "Sign out"}
- </DropdownMenu.Item>
- </DropdownMenu.Content>
- </DropdownMenu.Portal>
- </DropdownMenu.Root>
- );
-}
-
-export default UserInfo;
diff --git a/apps/web/src/components/common/sidebar/sections/workspace-settings/index.tsx b/apps/web/src/components/common/sidebar/sections/workspace-settings/index.tsx
deleted file mode 100644
index ecf117aa2..000000000
--- a/apps/web/src/components/common/sidebar/sections/workspace-settings/index.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-import { cn } from "@/lib/cn";
-import { useUserPreferencesStore } from "@/store/user-preferences";
-import useWorkspaceStore from "@/store/workspace";
-import { Link } from "@tanstack/react-router";
-import { useLocation } from "@tanstack/react-router";
-import { Settings } from "lucide-react";
-
-function WorkspaceSettings() {
- const { workspace } = useWorkspaceStore();
- const location = useLocation();
- const { isSidebarOpened } = useUserPreferencesStore();
- const isOnWorkspaceRoute = location.pathname.includes("/workspace-settings");
-
- if (!workspace) return null;
-
- return (
- <div>
- <h2
- className={cn(
- "text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider mb-2",
- isSidebarOpened && "px-3",
- )}
- >
- {isSidebarOpened && "Workspace"}
- </h2>
- <Link
- to={"/dashboard/workspace-settings/$workspaceId"}
- params={{ workspaceId: workspace.id }}
- className={cn(
- "flex items-center gap-2 text-sm justify-center py-1.5 rounded-md",
- isOnWorkspaceRoute
- ? "bg-zinc-100 dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100"
- : "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800 hover:text-zinc-900 dark:hover:text-zinc-100",
- isSidebarOpened && "justify-start px-3",
- )}
- >
- <Settings
- className={cn(
- "shrink-0",
- !isSidebarOpened ? "w-6 h-6" : "w-4 h-4 mr-2",
- )}
- />
- {isSidebarOpened && "Settings"}
- </Link>
- </div>
- );
-}
-
-export default WorkspaceSettings;
diff --git a/apps/web/src/components/common/sidebar/sections/workspaces/components/add-workspace.tsx b/apps/web/src/components/common/sidebar/sections/workspaces/components/add-workspace.tsx
deleted file mode 100644
index bda5f6c66..000000000
--- a/apps/web/src/components/common/sidebar/sections/workspaces/components/add-workspace.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import { Plus } from "lucide-react";
-import { useState } from "react";
-import CreateWorkspaceModal from "../../../../../shared/modals/create-workspace-modal";
-
-function AddWorkspace() {
- const [isAddWorkspaceModalOpen, setIsAddWorkspaceModalOpen] =
- useState<boolean>(false);
-
- return (
- <>
- <button
- type="button"
- onClick={() => setIsAddWorkspaceModalOpen(true)}
- className="w-full text-left px-2 py-1.5 text-zinc-600 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800/50 rounded-md flex items-center transition-all group"
- >
- <div className="p-1 rounded-md bg-zinc-100 dark:bg-zinc-800 mr-2">
- <Plus className="w-3 h-3 text-zinc-500 dark:text-zinc-400" />
- </div>
- <span className="text-sm font-medium group-hover:text-zinc-900 dark:group-hover:text-zinc-300">
- Add Workspace
- </span>
- </button>
- <CreateWorkspaceModal
- open={isAddWorkspaceModalOpen}
- onClose={() => setIsAddWorkspaceModalOpen(false)}
- />
- </>
- );
-}
-
-export default AddWorkspace;
diff --git a/apps/web/src/components/common/sidebar/sections/workspaces/components/workspace-picker.tsx b/apps/web/src/components/common/sidebar/sections/workspaces/components/workspace-picker.tsx
deleted file mode 100644
index 372cd27a5..000000000
--- a/apps/web/src/components/common/sidebar/sections/workspaces/components/workspace-picker.tsx
+++ /dev/null
@@ -1,103 +0,0 @@
-import useGetWorkspaces from "@/hooks/queries/workspace/use-get-workspaces";
-import { cn } from "@/lib/cn";
-import useProjectStore from "@/store/project";
-import { useUserPreferencesStore } from "@/store/user-preferences";
-import useWorkspaceStore from "@/store/workspace";
-import type { Workspace } from "@/types/workspace";
-import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
-import { useNavigate } from "@tanstack/react-router";
-import { ChevronDown, Plus } from "lucide-react";
-import { useState } from "react";
-import CreateWorkspaceModal from "../../../../../shared/modals/create-workspace-modal";
-
-function WorkspacePicker() {
- const { workspace: selectedWorkspace, setWorkspace } = useWorkspaceStore();
- const { setProject } = useProjectStore();
- const [isCreateWorkspaceOpen, setIsCreateWorkspaceOpen] = useState(false);
- const [isDropdownOpen, setIsDropdownOpen] = useState(false);
- const { data: workspaces } = useGetWorkspaces();
- const { isSidebarOpened } = useUserPreferencesStore();
- const navigate = useNavigate();
-
- const handleSelectWorkspace = (selectedWorkspace: Workspace) => {
- setProject(undefined);
- setWorkspace(selectedWorkspace);
- navigate({
- to: "/dashboard/workspace/$workspaceId",
- params: {
- workspaceId: selectedWorkspace?.id,
- },
- });
- };
-
- const handleCreateWorkspace = () => {
- setIsCreateWorkspaceOpen(true);
- setIsDropdownOpen(false);
- };
-
- return (
- <div className={isSidebarOpened ? undefined : "hidden"}>
- <DropdownMenu.Root open={isDropdownOpen} onOpenChange={setIsDropdownOpen}>
- <DropdownMenu.Trigger asChild>
- <button
- type="button"
- className="w-full px-3 py-2 text-left rounded-lg bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 hover:border-zinc-300 dark:hover:border-zinc-600 transition-colors group"
- >
- <div className="flex items-center">
- <div className="flex-1 min-w-0">
- <div className="text-xs font-medium text-zinc-500 dark:text-zinc-400 mb-0.5">
- Workspace
- </div>
- <div className="text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate">
- {selectedWorkspace?.name || "Select Workspace"}
- </div>
- </div>
- <ChevronDown className="w-4 h-4 text-zinc-500 dark:text-zinc-400 group-hover:text-zinc-700 dark:group-hover:text-zinc-300 ml-2" />
- </div>
- </button>
- </DropdownMenu.Trigger>
- <DropdownMenu.Portal>
- <DropdownMenu.Content
- className="w-56 z-50 bg-white dark:bg-zinc-800 rounded-lg shadow-lg border border-zinc-200 dark:border-zinc-700 py-1"
- align="start"
- sideOffset={5}
- >
- {workspaces &&
- workspaces.length > 0 &&
- workspaces.map((workspace) => (
- <DropdownMenu.Item
- key={workspace.id}
- className={cn(
- "flex items-center px-3 py-2 text-sm cursor-pointer outline-none",
- workspace.id === selectedWorkspace?.id
- ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
- : "text-zinc-600 dark:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-700",
- )}
- onClick={() => handleSelectWorkspace(workspace)}
- >
- {workspace.name}
- </DropdownMenu.Item>
- ))}
- {workspaces && workspaces.length > 0 && (
- <DropdownMenu.Separator className="h-px bg-zinc-200 dark:bg-zinc-700 my-1" />
- )}
- <DropdownMenu.Item
- className="flex items-center px-3 py-2 text-sm text-zinc-600 dark:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-700 cursor-pointer outline-none"
- onClick={handleCreateWorkspace}
- >
- <Plus className="w-4 h-4 mr-2" />
- New Workspace
- </DropdownMenu.Item>
- </DropdownMenu.Content>
- </DropdownMenu.Portal>
- </DropdownMenu.Root>
-
- <CreateWorkspaceModal
- open={isCreateWorkspaceOpen}
- onClose={() => setIsCreateWorkspaceOpen(false)}
- />
- </div>
- );
-}
-
-export default WorkspacePicker;
diff --git a/apps/web/src/components/common/sidebar/sections/workspaces/index.tsx b/apps/web/src/components/common/sidebar/sections/workspaces/index.tsx
deleted file mode 100644
index 8d726d0df..000000000
--- a/apps/web/src/components/common/sidebar/sections/workspaces/index.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import useWorkspaceStore from "@/store/workspace";
-import Projects from "../projects";
-import WorkspacePicker from "./components/workspace-picker";
-
-function Workspaces() {
- const { workspace } = useWorkspaceStore();
-
- return (
- <div>
- <div className="space-y-5 flex flex-col">
- <WorkspacePicker />
- {workspace && <Projects workspaceId={workspace.id} />}
- </div>
- </div>
- );
-}
-
-export default Workspaces;
diff --git a/apps/web/src/components/common/sidebar/sidebar-content.tsx b/apps/web/src/components/common/sidebar/sidebar-content.tsx
deleted file mode 100644
index 96432525e..000000000
--- a/apps/web/src/components/common/sidebar/sidebar-content.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import { cn } from "@/lib/cn";
-import useWorkspaceStore from "@/store/workspace";
-import ManageTeams from "./sections/manage-teams";
-import WorkspaceSettings from "./sections/workspace-settings";
-import Workspaces from "./sections/workspaces";
-
-export function SidebarContent() {
- const { workspace } = useWorkspaceStore();
-
- return (
- <nav className="flex-1 overflow-y-auto p-3">
- <div className={cn("space-y-4")}>
- <Workspaces />
- {workspace && <ManageTeams />}
- {workspace && <WorkspaceSettings />}
- </div>
- </nav>
- );
-}
diff --git a/apps/web/src/components/common/sidebar/sidebar-footer.tsx b/apps/web/src/components/common/sidebar/sidebar-footer.tsx
deleted file mode 100644
index 7aebbfef8..000000000
--- a/apps/web/src/components/common/sidebar/sidebar-footer.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import UserInfo from "./sections/user-info";
-
-function SidebarFooter() {
- return (
- <div className="border-t border-zinc-200 dark:border-zinc-800 p-2">
- <UserInfo />
- </div>
- );
-}
-
-export default SidebarFooter;
diff --git a/apps/web/src/components/common/sidebar/sidebar-header.tsx b/apps/web/src/components/common/sidebar/sidebar-header.tsx
deleted file mode 100644
index 0f7fdafb7..000000000
--- a/apps/web/src/components/common/sidebar/sidebar-header.tsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import { useUserPreferencesStore } from "@/store/user-preferences";
-import { ChevronLeft, ChevronRight } from "lucide-react";
-import { Logo } from "../logo";
-
-export function SidebarHeader() {
- const { isSidebarOpened, setIsSidebarOpened } = useUserPreferencesStore();
-
- return (
- <div className="p-4 flex items-center justify-between">
- {isSidebarOpened && <Logo />}
-
- <button
- type="button"
- onClick={() => setIsSidebarOpened()}
- className="p-1.5 rounded-lg hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors"
- >
- {isSidebarOpened ? (
- <ChevronLeft className="w-5 h-5 text-zinc-500 dark:text-zinc-400" />
- ) : (
- <ChevronRight className="w-5 h-5 text-zinc-500 dark:text-zinc-400" />
- )}
- </button>
- </div>
- );
-}
diff --git a/apps/web/src/components/common/tip.tsx b/apps/web/src/components/common/tip.tsx
deleted file mode 100644
index 2768bad4e..000000000
--- a/apps/web/src/components/common/tip.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-import { cn } from "@/lib/cn";
-import { useState } from "react";
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from "../ui/tooltip";
-
-const Tip = ({
- content,
- children,
- className,
-}: React.PropsWithChildren<{
- content: string | React.ReactNode;
- className?: string;
-}>) => {
- const [open, setOpen] = useState(false);
-
- return (
- <TooltipProvider delayDuration={0}>
- <Tooltip open={open}>
- <TooltipTrigger asChild>
- <button
- type="button"
- className={cn("cursor-pointer", className)}
- onClick={() => setOpen(!open)}
- onMouseEnter={() => setOpen(true)}
- onMouseLeave={() => setOpen(false)}
- onTouchStart={() => setOpen(!open)}
- onKeyDown={(e) => {
- e.preventDefault();
- e.key === "Enter" && setOpen(!open);
- }}
- >
- {children}
- </button>
- </TooltipTrigger>
- <TooltipContent side="right" className={!content ? "hidden" : ""}>
- <span className="inline-block">{content}</span>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- );
-};
-
-export default Tip;
diff --git a/apps/web/src/components/common/workspace-layout.tsx b/apps/web/src/components/common/workspace-layout.tsx
new file mode 100644
index 000000000..2ecc0c973
--- /dev/null
+++ b/apps/web/src/components/common/workspace-layout.tsx
@@ -0,0 +1,92 @@
+import Layout from "@/components/common/layout";
+import NotificationDropdown from "@/components/notification/notification-dropdown";
+import {
+ Breadcrumb,
+ BreadcrumbItem,
+ BreadcrumbLink,
+ BreadcrumbList,
+ BreadcrumbSeparator,
+} from "@/components/ui/breadcrumb";
+import { KbdSequence } from "@/components/ui/kbd";
+import { Separator } from "@/components/ui/separator";
+import { SidebarTrigger } from "@/components/ui/sidebar";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
+import { shortcuts } from "@/constants/shortcuts";
+import { cn } from "@/lib/cn";
+import useWorkspaceStore from "@/store/workspace";
+import type { ReactNode } from "react";
+
+interface WorkspaceLayoutProps {
+ title: string;
+ headerActions?: ReactNode;
+ children: ReactNode;
+ onCreateProject?: () => void;
+ className?: string;
+}
+
+export default function WorkspaceLayout({
+ title,
+ headerActions,
+ children,
+ className,
+}: WorkspaceLayoutProps) {
+ const { workspace } = useWorkspaceStore();
+
+ return (
+ <Layout>
+ <Layout.Header>
+ <div className="flex items-center justify-between w-full">
+ <div className="flex items-center gap-1 w-full">
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <SidebarTrigger className="-ml-1 h-6 w-6" />
+ </TooltipTrigger>
+ <TooltipContent>
+ <p className="flex items-center gap-2 text-xs">
+ Toggle sidebar
+ <KbdSequence
+ keys={[
+ shortcuts.sidebar.prefix,
+ shortcuts.sidebar.toggle,
+ ]}
+ />
+ </p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ <Separator
+ orientation="vertical"
+ className="mx-1.5 data-[orientation=vertical]:h-2.5"
+ />
+ <Breadcrumb className="flex items-center gap-1 text-xs w-full">
+ <BreadcrumbList>
+ <BreadcrumbItem>
+ <BreadcrumbLink href="/">
+ <h1 className="text-xs text-card-foreground">
+ {workspace?.name}
+ </h1>
+ </BreadcrumbLink>
+ </BreadcrumbItem>
+ <BreadcrumbSeparator />
+ <BreadcrumbItem>
+ <h1 className="text-xs text-card-foreground">{title}</h1>
+ </BreadcrumbItem>
+ </BreadcrumbList>
+ </Breadcrumb>
+ </div>
+ <div className={`${cn("flex items-center gap-1.5", className)}`}>
+ <NotificationDropdown />
+ {headerActions}
+ </div>
+ </div>
+ </Layout.Header>
+ <Layout.Content>{children}</Layout.Content>
+ </Layout>
+ );
+}
diff --git a/apps/web/src/components/dashboard/empty-state.tsx b/apps/web/src/components/dashboard/empty-state.tsx
deleted file mode 100644
index c5fe4a2cd..000000000
--- a/apps/web/src/components/dashboard/empty-state.tsx
+++ /dev/null
@@ -1,85 +0,0 @@
-import { motion } from "framer-motion";
-import { LayoutGrid, Plus, Sparkles } from "lucide-react";
-import { useState } from "react";
-import CreateWorkspaceModal from "../shared/modals/create-workspace-modal";
-
-function EmptyDashboardState() {
- const [isCreateWorkspaceOpen, setIsCreateWorkspaceOpen] = useState(false);
-
- return (
- <div className="flex w-full items-center justify-center h-screen flex-col bg-zinc-50 dark:bg-zinc-950">
- <motion.div
- className="max-w-md w-full px-8"
- initial={{ opacity: 0, y: 20 }}
- animate={{ opacity: 1, y: 0 }}
- transition={{ duration: 0.3 }}
- >
- <div className="text-center mb-8">
- <div className="relative w-16 h-16 mb-4 mx-auto">
- <motion.div
- className="w-16 h-16 rounded-2xl bg-indigo-50 dark:bg-indigo-500/10 flex items-center justify-center"
- animate={{ rotate: 360 }}
- transition={{
- duration: 20,
- repeat: Number.POSITIVE_INFINITY,
- ease: "linear",
- }}
- >
- <LayoutGrid className="w-8 h-8 text-indigo-500 dark:text-indigo-400" />
- </motion.div>
- <motion.div
- className="absolute -top-2 -right-2"
- initial={{ scale: 0.5, opacity: 0 }}
- animate={{ scale: 1, opacity: 1 }}
- transition={{ delay: 0.2 }}
- >
- <Sparkles className="w-5 h-5 text-indigo-400 dark:text-indigo-300" />
- </motion.div>
- </div>
- <h1 className="text-2xl font-semibold text-zinc-900 dark:text-zinc-100 mb-3">
- Welcome to Kaneo
- </h1>
- <p className="text-zinc-500 dark:text-zinc-400 text-center max-w-md mb-8">
- Get started by creating your first workspace to organize projects
- and collaborate with your team.
- </p>
- </div>
-
- <div className="space-y-4">
- <motion.div
- className="p-4 rounded-lg border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-900 hover:border-zinc-300 dark:hover:border-zinc-700 transition-colors"
- whileHover={{ scale: 1.02 }}
- transition={{ type: "spring", stiffness: 300 }}
- >
- <div className="flex items-center gap-3 mb-3">
- <div className="w-10 h-10 rounded-full bg-indigo-50 dark:bg-indigo-500/10 flex items-center justify-center">
- <Plus className="w-5 h-5 text-indigo-500 dark:text-indigo-400" />
- </div>
- <div className="flex-1">
- <h3 className="text-sm font-medium text-zinc-900 dark:text-zinc-100">
- Create Your First Workspace
- </h3>
- <p className="text-xs text-zinc-500 dark:text-zinc-400">
- Start organizing your work in one place
- </p>
- </div>
- </div>
- <button
- type="button"
- onClick={() => setIsCreateWorkspaceOpen(true)}
- className="w-full px-4 py-2 bg-indigo-50 hover:bg-indigo-100 dark:bg-indigo-500/10 dark:hover:bg-indigo-500/20 text-indigo-600 dark:text-indigo-400 rounded-lg transition-colors font-medium inline-flex items-center justify-center gap-2 text-sm"
- >
- Get Started
- </button>
- </motion.div>
- </div>
- </motion.div>
- <CreateWorkspaceModal
- open={isCreateWorkspaceOpen}
- onClose={() => setIsCreateWorkspaceOpen(false)}
- />
- </div>
- );
-}
-
-export default EmptyDashboardState;
diff --git a/apps/web/src/components/filters/index.tsx b/apps/web/src/components/filters/index.tsx
deleted file mode 100644
index 2ea6bcc17..000000000
--- a/apps/web/src/components/filters/index.tsx
+++ /dev/null
@@ -1,469 +0,0 @@
-import { Input } from "@/components/ui/input";
-import { priorityColorsFilter } from "@/constants/priority-colors";
-import useGetActiveWorkspaceUsers from "@/hooks/queries/workspace-users/use-active-workspace-users";
-import { cn } from "@/lib/cn";
-import useProjectStore from "@/store/project";
-import { useUserPreferencesStore } from "@/store/user-preferences";
-import * as Popover from "@radix-ui/react-popover";
-import {
- Calendar,
- Filter,
- Flag,
- LayoutGrid,
- List,
- Search,
- SortAsc,
- User as UserIcon,
- X,
-} from "lucide-react";
-import { useState } from "react";
-
-interface BoardFiltersProps {
- onFiltersChange: (filters: BoardFilters) => void;
-}
-
-export interface BoardFilters {
- search: string;
- assignee: string | null;
- priority: string | null;
- dueDate: string | null;
- sortBy: string | null;
- sortOrder: "asc" | "desc" | null;
-}
-
-export type SortOption = {
- label: string;
- field: string;
-};
-
-export const sortOptions: SortOption[] = [
- { label: "Priority", field: "priority" },
- { label: "Due Date", field: "dueDate" },
- { label: "Title", field: "title" },
- { label: "Created Date", field: "createdAt" },
-];
-
-function BoardFilters({ onFiltersChange }: BoardFiltersProps) {
- const { project } = useProjectStore();
- const [searchValue, setSearchValue] = useState("");
- const [selectedAssignee, setSelectedAssignee] = useState<string | null>(null);
- const [selectedPriority, setSelectedPriority] = useState<string | null>(null);
- const [selectedDueDate, setSelectedDueDate] = useState<string | null>(null);
- const [selectedSortBy, setSelectedSortBy] = useState<string | null>(null);
- const [sortOrder, setSortOrder] = useState<"asc" | "desc" | null>("asc");
- const { viewMode, setViewMode } = useUserPreferencesStore();
-
- const { data: users } = useGetActiveWorkspaceUsers({
- workspaceId: project?.workspaceId ?? "",
- });
-
- const handleSearch = (value: string) => {
- setSearchValue(value);
- onFiltersChange({
- search: value,
- assignee: selectedAssignee,
- priority: selectedPriority,
- dueDate: selectedDueDate,
- sortBy: selectedSortBy,
- sortOrder,
- });
- };
-
- const handleAssigneeChange = (email: string | null) => {
- setSelectedAssignee(email);
- onFiltersChange({
- search: searchValue,
- assignee: email,
- priority: selectedPriority,
- dueDate: selectedDueDate,
- sortBy: selectedSortBy,
- sortOrder,
- });
- };
-
- const handlePriorityChange = (priority: string) => {
- setSelectedPriority(priority);
- onFiltersChange({
- search: searchValue,
- assignee: selectedAssignee,
- priority,
- dueDate: selectedDueDate,
- sortBy: selectedSortBy,
- sortOrder,
- });
- };
-
- const handleDueDateChange = (option: string) => {
- setSelectedDueDate(option);
- onFiltersChange({
- search: searchValue,
- assignee: selectedAssignee,
- priority: selectedPriority,
- dueDate: option,
- sortBy: selectedSortBy,
- sortOrder,
- });
- };
-
- const handleSortChange = (sortBy: string) => {
- if (selectedSortBy === sortBy) {
- const newSortOrder = sortOrder === "asc" ? "desc" : "asc";
- setSortOrder(newSortOrder);
- onFiltersChange({
- search: searchValue,
- assignee: selectedAssignee,
- priority: selectedPriority,
- dueDate: selectedDueDate,
- sortBy,
- sortOrder: newSortOrder,
- });
- } else {
- // New sort field, set to ascending by default
- setSelectedSortBy(sortBy);
- setSortOrder("asc");
- onFiltersChange({
- search: searchValue,
- assignee: selectedAssignee,
- priority: selectedPriority,
- dueDate: selectedDueDate,
- sortBy,
- sortOrder: "asc",
- });
- }
- };
-
- const handleClearFilters = () => {
- setSearchValue("");
- setSelectedAssignee(null);
- setSelectedPriority(null);
- setSelectedDueDate(null);
- setSelectedSortBy(null);
- setSortOrder(null);
- onFiltersChange({
- search: "",
- assignee: null,
- priority: null,
- dueDate: null,
- sortBy: null,
- sortOrder: null,
- });
- };
-
- return (
- <div className="flex flex-col gap-2 w-full">
- <div className="flex items-center justify-between gap-2 w-full">
- <div className="flex items-center gap-1.5 flex-1 max-w-md">
- <div className="relative flex-1">
- <Search className="absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zinc-400" />
- <Input
- value={searchValue}
- onChange={(e) => handleSearch(e.target.value)}
- placeholder="Search tasks..."
- className="h-7 pl-7 pr-2 text-xs bg-transparent w-full"
- />
- </div>
-
- <Popover.Root>
- <Popover.Trigger>
- <button
- type="button"
- className={cn(
- "h-7 px-2 flex items-center gap-1.5 rounded-md text-xs transition-colors shrink-0",
- selectedPriority || selectedAssignee || selectedDueDate
- ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
- : "bg-zinc-100 dark:bg-zinc-800 text-zinc-600 dark:text-zinc-400 hover:bg-zinc-200 dark:hover:bg-zinc-700",
- )}
- >
- <Filter className="w-3.5 h-3.5" />
- <span>Filter</span>
- </button>
- </Popover.Trigger>
- <Popover.Portal>
- <Popover.Content
- className="w-56 bg-white dark:bg-zinc-900 rounded-lg shadow-lg border border-zinc-200 dark:border-zinc-800 py-2 z-50"
- align="end"
- sideOffset={4}
- >
- <div className="px-2 py-1.5 text-xs font-medium text-zinc-500 dark:text-zinc-400">
- Priority
- </div>
- {["urgent", "high", "medium", "low"].map((priority) => (
- <button
- type="button"
- key={priority}
- onClick={() => handlePriorityChange(priority)}
- className={cn(
- "w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left transition-colors",
- selectedPriority === priority
- ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
- : "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
- )}
- >
- <Flag
- className={cn(
- "w-3.5 h-3.5",
- priorityColorsFilter[
- priority as keyof typeof priorityColorsFilter
- ],
- )}
- />
- <span className="capitalize">{priority}</span>
- </button>
- ))}
-
- <div className="h-px bg-zinc-200 dark:bg-zinc-800 my-2" />
-
- <div className="px-2 py-1.5 text-xs font-medium text-zinc-500 dark:text-zinc-400">
- Assignee
- </div>
- <button
- type="button"
- onClick={() => handleAssigneeChange(null)}
- className={cn(
- "w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left transition-colors",
- selectedAssignee === null && searchValue === ""
- ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
- : "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
- )}
- >
- <UserIcon className="w-3.5 h-3.5" />
- <span>Unassigned</span>
- </button>
- {users?.map((user) => (
- <button
- type="button"
- key={user.userEmail}
- onClick={() => handleAssigneeChange(user.userEmail ?? null)}
- className={cn(
- "w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left transition-colors",
- selectedAssignee === user.userEmail
- ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
- : "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
- )}
- >
- <UserIcon className="w-3.5 h-3.5" />
- <span>{user.userName}</span>
- </button>
- ))}
-
- <div className="h-px bg-zinc-200 dark:bg-zinc-800 my-2" />
-
- <div className="px-2 py-1.5 text-xs font-medium text-zinc-500 dark:text-zinc-400">
- Due Date
- </div>
- {["No due date", "Due this week", "Due next week"].map(
- (option) => (
- <button
- type="button"
- key={option}
- onClick={() => handleDueDateChange(option)}
- className={cn(
- "w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left transition-colors",
- selectedDueDate === option
- ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
- : "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
- )}
- >
- <Calendar className="w-3.5 h-3.5" />
- <span>{option}</span>
- </button>
- ),
- )}
- </Popover.Content>
- </Popover.Portal>
- </Popover.Root>
-
- <Popover.Root>
- <Popover.Trigger>
- <button
- type="button"
- className={cn(
- "h-7 px-2 flex items-center gap-1.5 rounded-md text-xs transition-colors shrink-0",
- selectedSortBy
- ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
- : "bg-zinc-100 dark:bg-zinc-800 text-zinc-600 dark:text-zinc-400 hover:bg-zinc-200 dark:hover:bg-zinc-700",
- )}
- >
- <SortAsc
- className={cn(
- "w-3.5 h-3.5",
- sortOrder === "desc" && "rotate-180",
- )}
- />
- <span>Sort</span>
- </button>
- </Popover.Trigger>
- <Popover.Portal>
- <Popover.Content
- className="w-56 bg-white dark:bg-zinc-900 rounded-lg shadow-lg border border-zinc-200 dark:border-zinc-800 py-2 z-50"
- align="end"
- sideOffset={4}
- >
- <div className="px-2 py-1.5 text-xs font-medium text-zinc-500 dark:text-zinc-400">
- Sort By
- </div>
- {sortOptions.map((option) => (
- <button
- type="button"
- key={option.field}
- onClick={() => handleSortChange(option.field)}
- className={cn(
- "w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left transition-colors",
- selectedSortBy === option.field
- ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
- : "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
- )}
- >
- <SortAsc
- className={cn(
- "w-3.5 h-3.5",
- selectedSortBy === option.field &&
- sortOrder === "desc" &&
- "rotate-180",
- )}
- />
- <span>{option.label}</span>
- {selectedSortBy === option.field && (
- <span className="ml-auto text-xs opacity-60">
- {sortOrder === "asc" ? "A-Z" : "Z-A"}
- </span>
- )}
- </button>
- ))}
- </Popover.Content>
- </Popover.Portal>
- </Popover.Root>
- </div>
-
- <div className="bg-zinc-100 dark:bg-zinc-800 rounded-md p-0.5 flex items-center shrink-0">
- <button
- type="button"
- onClick={() => setViewMode("board")}
- className={cn(
- "flex items-center gap-1 px-2 py-1 rounded-md transition-colors",
- viewMode === "board"
- ? "bg-white dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 shadow-sm"
- : "text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100",
- )}
- >
- <LayoutGrid className="w-3.5 h-3.5" />
- <span className="text-xs">Board</span>
- </button>
- <button
- type="button"
- onClick={() => setViewMode("list")}
- className={cn(
- "flex items-center gap-1 px-2 py-1 rounded-md transition-colors",
- viewMode === "list"
- ? "bg-white dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 shadow-sm"
- : "text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100",
- )}
- >
- <List className="w-3.5 h-3.5" />
- <span className="text-xs">List</span>
- </button>
- </div>
- </div>
-
- {(selectedPriority ||
- selectedAssignee ||
- selectedDueDate ||
- selectedSortBy ||
- searchValue) && (
- <div className="flex flex-wrap items-center gap-1.5">
- {searchValue && (
- <button
- type="button"
- onClick={() => handleSearch("")}
- className="flex-shrink-0 flex items-center gap-1 px-2 py-1 h-6 text-xs rounded-md bg-zinc-100 dark:bg-zinc-800 hover:bg-zinc-200 dark:hover:bg-zinc-700 transition-colors"
- >
- <Search className="w-3 h-3" />
- <span>{searchValue}</span>
- <X className="w-3 h-3 ml-1 text-zinc-400" />
- </button>
- )}
- {selectedPriority && (
- <button
- type="button"
- onClick={() => handlePriorityChange("")}
- className="flex-shrink-0 flex items-center gap-1 px-2 py-1 h-6 text-xs rounded-md bg-zinc-100 dark:bg-zinc-800 hover:bg-zinc-200 dark:hover:bg-zinc-700 transition-colors"
- >
- <Flag
- className={cn(
- "w-3 h-3",
- priorityColorsFilter[
- selectedPriority as keyof typeof priorityColorsFilter
- ],
- )}
- />
- <span className="capitalize">{selectedPriority}</span>
- <X className="w-3 h-3 ml-1 text-zinc-400" />
- </button>
- )}
- {selectedAssignee && (
- <button
- type="button"
- onClick={() => handleAssigneeChange(null)}
- className="flex-shrink-0 flex items-center gap-1 px-2 py-1 h-6 text-xs rounded-md bg-zinc-100 dark:bg-zinc-800 hover:bg-zinc-200 dark:hover:bg-zinc-700 transition-colors"
- >
- <UserIcon className="w-3 h-3" />
- <span>
- {users?.find((u) => u.userEmail === selectedAssignee)
- ?.userName || "Unassigned"}
- </span>
- <X className="w-3 h-3 ml-1 text-zinc-400" />
- </button>
- )}
- {selectedDueDate && (
- <button
- type="button"
- onClick={() => handleDueDateChange("")}
- className="flex-shrink-0 flex items-center gap-1 px-2 py-1 h-6 text-xs rounded-md bg-zinc-100 dark:bg-zinc-800 hover:bg-zinc-200 dark:hover:bg-zinc-700 transition-colors"
- >
- <Calendar className="w-3 h-3" />
- <span>{selectedDueDate}</span>
- <X className="w-3 h-3 ml-1 text-zinc-400" />
- </button>
- )}
- {selectedSortBy && (
- <button
- type="button"
- onClick={() => {
- setSelectedSortBy(null);
- setSortOrder(null);
- onFiltersChange({
- search: searchValue,
- assignee: selectedAssignee,
- priority: selectedPriority,
- dueDate: selectedDueDate,
- sortBy: null,
- sortOrder: null,
- });
- }}
- className="flex-shrink-0 flex items-center gap-1 px-2 py-1 h-6 text-xs rounded-md bg-zinc-100 dark:bg-zinc-800 hover:bg-zinc-200 dark:hover:bg-zinc-700 transition-colors"
- >
- <SortAsc
- className={cn("w-3 h-3", sortOrder === "desc" && "rotate-180")}
- />
- <span>
- {sortOptions.find((o) => o.field === selectedSortBy)?.label}{" "}
- {sortOrder === "asc" ? "A-Z" : "Z-A"}
- </span>
- <X className="w-3 h-3 ml-1 text-zinc-400" />
- </button>
- )}
- <button
- type="button"
- onClick={handleClearFilters}
- className="flex items-center gap-1 px-1.5 py-1 text-xs rounded text-zinc-500 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors"
- >
- <X className="w-3 h-3" />
- <span>Clear all</span>
- </button>
- </div>
- )}
- </div>
- );
-}
-
-export default BoardFilters;
diff --git a/apps/web/src/components/kanban-board/column/column-dropzone.tsx b/apps/web/src/components/kanban-board/column/column-dropzone.tsx
index 1d4ec1a85..253d802e7 100644
--- a/apps/web/src/components/kanban-board/column/column-dropzone.tsx
+++ b/apps/web/src/components/kanban-board/column/column-dropzone.tsx
@@ -4,14 +4,19 @@ import {
SortableContext,
verticalListSortingStrategy,
} from "@dnd-kit/sortable";
+import { useEffect } from "react";
import TaskCard from "../task-card";
interface ColumnDropzoneProps {
column: ProjectWithTasks["columns"][number];
+ onIsOverChange?: (isOver: boolean) => void;
}
-export function ColumnDropzone({ column }: ColumnDropzoneProps) {
- const { setNodeRef } = useDroppable({
+export function ColumnDropzone({
+ column,
+ onIsOverChange,
+}: ColumnDropzoneProps) {
+ const { setNodeRef, isOver } = useDroppable({
id: column.id,
data: {
type: "column",
@@ -19,13 +24,17 @@ export function ColumnDropzone({ column }: ColumnDropzoneProps) {
},
});
+ useEffect(() => {
+ onIsOverChange?.(isOver);
+ }, [isOver, onIsOverChange]);
+
return (
- <div ref={setNodeRef} className="flex-1">
+ <div ref={setNodeRef} className="flex-1 min-h-0">
<SortableContext
items={column.tasks}
strategy={verticalListSortingStrategy}
>
- <div className="flex flex-col gap-2">
+ <div className="flex flex-col gap-1.5">
{column.tasks.map((task) => (
<TaskCard key={task.id} task={task} />
))}
diff --git a/apps/web/src/components/kanban-board/column/column-header.tsx b/apps/web/src/components/kanban-board/column/column-header.tsx
index 907f6fa19..c62ba16a6 100644
--- a/apps/web/src/components/kanban-board/column/column-header.tsx
+++ b/apps/web/src/components/kanban-board/column/column-header.tsx
@@ -1,4 +1,5 @@
import useUpdateTask from "@/hooks/mutations/task/use-update-task";
+import { getColumnIcon, getColumnIconColor } from "@/lib/column";
import useProjectStore from "@/store/project";
import type { ProjectWithTasks } from "@/types/project";
import { produce } from "immer";
@@ -46,6 +47,14 @@ export function ColumnHeader({ column }: ColumnHeaderProps) {
return (
<div className="flex items-center justify-between">
<div className="flex items-center gap-2">
+ {(() => {
+ const IconComponent = getColumnIcon(column.id);
+ return (
+ <IconComponent
+ className={`w-4 h-4 ${getColumnIconColor(column.id)}`}
+ />
+ );
+ })()}
<h3 className="font-medium text-zinc-900 dark:text-zinc-100">
{column.name}
</h3>
diff --git a/apps/web/src/components/kanban-board/column/index.tsx b/apps/web/src/components/kanban-board/column/index.tsx
index 76cc20375..6158d7652 100644
--- a/apps/web/src/components/kanban-board/column/index.tsx
+++ b/apps/web/src/components/kanban-board/column/index.tsx
@@ -12,30 +12,37 @@ interface ColumnProps {
function Column({ column }: ColumnProps) {
const [isTaskModalOpen, setIsTaskModalOpen] = useState(false);
+ const [isDropzoneOver, setIsDropzoneOver] = useState(false);
return (
- <div className="flex flex-col flex-1 min-w-80 bg-zinc-50/50 dark:bg-zinc-900/50 backdrop-blur-xs rounded-lg border border-zinc-200 dark:border-zinc-800/50 shadow-xs relative group">
+ <div
+ className={`flex flex-col h-full w-full min-h-0 backdrop-blur-xs rounded-lg relative group transition-all duration-300 ease-out ${
+ isDropzoneOver
+ ? "bg-indigo-50/60 dark:bg-indigo-950/40 ring-1 ring-indigo-200 dark:ring-indigo-800/50 shadow-md shadow-indigo-500/10"
+ : "bg-zinc-50/30 dark:bg-zinc-900/30 hover:bg-zinc-50/40 dark:hover:bg-zinc-900/40 hover:shadow-sm"
+ }`}
+ >
<CreateTaskModal
open={isTaskModalOpen}
onClose={() => setIsTaskModalOpen(false)}
status={toKebabCase(column.name)}
/>
- <div className="p-3 border-b border-zinc-200 dark:border-zinc-800/50">
+ <div className="p-2 shrink-0">
<ColumnHeader column={column} />
</div>
- <div className="p-3 overflow-y-auto overflow-x-hidden flex-1">
- <ColumnDropzone column={column} />
+ <div className="p-2 overflow-y-auto overflow-x-hidden flex-1 min-h-0">
+ <ColumnDropzone column={column} onIsOverChange={setIsDropzoneOver} />
</div>
- <div className="p-2 md:opacity-0 md:group-hover:opacity-100 transition-opacity">
+ <div className="p-1.5 md:opacity-0 md:group-hover:opacity-100 transition-opacity">
<button
type="button"
onClick={() => setIsTaskModalOpen(true)}
- className="w-full text-left px-2 py-1.5 text-sm text-zinc-600 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800/50 rounded-md flex items-center gap-2 transition-all"
+ className="w-full text-left px-2 py-1 text-sm text-zinc-500 hover:text-zinc-700 dark:text-zinc-500 dark:hover:text-zinc-300 hover:bg-zinc-50 dark:hover:bg-zinc-800/30 rounded-md flex items-center gap-2 transition-all"
>
- <Plus className="w-4 h-4 text-zinc-500 dark:text-zinc-400" />
+ <Plus className="w-4 h-4" />
<span>Add task</span>
</button>
</div>
diff --git a/apps/web/src/components/kanban-board/index.tsx b/apps/web/src/components/kanban-board/index.tsx
index 82d0ed7e2..5bcbaa922 100644
--- a/apps/web/src/components/kanban-board/index.tsx
+++ b/apps/web/src/components/kanban-board/index.tsx
@@ -6,14 +6,17 @@ import {
type DragEndEvent,
DragOverlay,
type DragStartEvent,
+ type DropAnimation,
KeyboardSensor,
MouseSensor,
TouchSensor,
type UniqueIdentifier,
closestCorners,
+ defaultDropAnimationSideEffects,
useSensor,
useSensors,
} from "@dnd-kit/core";
+import { useQueryClient } from "@tanstack/react-query";
import { produce } from "immer";
import { useState } from "react";
import Column from "./column";
@@ -24,22 +27,44 @@ type KanbanBoardProps = {
};
function KanbanBoard({ project }: KanbanBoardProps) {
+ const queryClient = useQueryClient();
const { setProject } = useProjectStore();
const [activeId, setActiveId] = useState<UniqueIdentifier | null>(null);
const { mutate: updateTask } = useUpdateTask();
const sensors = useSensors(
- useSensor(MouseSensor, { activationConstraint: { distance: 5 } }),
- useSensor(TouchSensor, { activationConstraint: { distance: 5 } }),
+ useSensor(MouseSensor, {
+ activationConstraint: { distance: 8 },
+ }),
+ useSensor(TouchSensor, {
+ activationConstraint: {
+ delay: 200,
+ tolerance: 8,
+ },
+ }),
useSensor(KeyboardSensor),
);
+ const dropAnimation: DropAnimation = {
+ sideEffects: defaultDropAnimationSideEffects({
+ styles: {
+ active: {
+ opacity: "0.8",
+ },
+ },
+ }),
+ duration: 300,
+ easing: "cubic-bezier(0.25, 0.46, 0.45, 0.94)",
+ };
+
const handleDragStart = (event: DragStartEvent) => {
setActiveId(event.active.id);
};
const handleDragEnd = (event: DragEndEvent) => {
const { active, over } = event;
+ setActiveId(null);
+
if (!over || !project?.columns) return;
const activeId = active.id.toString();
@@ -75,6 +100,10 @@ function KanbanBoard({ project }: KanbanBoardProps) {
destinationColumn.tasks.forEach((t, index) => {
updateTask({ ...t, position: index + 1 });
});
+
+ queryClient.invalidateQueries({
+ queryKey: ["projects", project.workspaceId],
+ });
} else {
const updatedTask = { ...task, status: destinationColumn.id };
const destinationIndex =
@@ -155,19 +184,26 @@ function KanbanBoard({ project }: KanbanBoardProps) {
onDragStart={handleDragStart}
onDragEnd={handleDragEnd}
>
- <div className="h-full flex flex-col overflow-hidden w-full">
- <div className="flex-1 h-full overflow-auto">
- <div className="flex gap-6 p-6 min-h-full">
+ <div className="h-full flex flex-col w-full">
+ <div className="flex-1 min-h-0 overflow-x-auto">
+ <div className="flex gap-3 p-3 h-full min-w-max transition-all duration-200 ease-out">
{project.columns?.map((column) => (
- <Column key={column.id} column={column} />
+ <div
+ key={column.id}
+ className="h-full flex-1 min-w-80 flex-shrink-0"
+ >
+ <Column column={column} />
+ </div>
))}
</div>
</div>
</div>
- <DragOverlay>
+ <DragOverlay dropAnimation={dropAnimation}>
{activeTask ? (
- <div className="transform rotate-3">
- <TaskCard task={activeTask} />
+ <div className="transform rotate-1 scale-[1.03] shadow-xl shadow-indigo-500/20 dark:shadow-indigo-400/10">
+ <div className="ring-2 ring-indigo-500/30 dark:ring-indigo-400/40 rounded-lg">
+ <TaskCard task={activeTask} />
+ </div>
</div>
) : null}
</DragOverlay>
diff --git a/apps/web/src/components/kanban-board/task-card-context-menu/task-card-context-menu-content.tsx b/apps/web/src/components/kanban-board/task-card-context-menu/task-card-context-menu-content.tsx
index f9e9fa2dd..03172c101 100644
--- a/apps/web/src/components/kanban-board/task-card-context-menu/task-card-context-menu-content.tsx
+++ b/apps/web/src/components/kanban-board/task-card-context-menu/task-card-context-menu-content.tsx
@@ -24,7 +24,11 @@ import {
ContextMenuSubContent,
ContextMenuSubTrigger,
} from "@/components/ui/context-menu";
+import { priorityColorsTaskCard } from "@/constants/priority-colors";
+import { cn } from "@/lib/cn";
+import { getColumnIcon, getColumnIconColor } from "@/lib/column";
+import { DEFAULT_COLUMNS } from "@/constants/columns";
import useDeleteTask from "@/hooks/mutations/task/use-delete-task";
import { generateLink } from "@/lib/generate-link";
import queryClient from "@/query-client";
@@ -74,18 +78,22 @@ export default function TaskCardContextMenuContent({
{
label: "To Do",
value: "to-do",
+ icon: DEFAULT_COLUMNS[0],
},
{
label: "In Progress",
value: "in-progress",
+ icon: DEFAULT_COLUMNS[1],
},
{
label: "In Review",
value: "in-review",
+ icon: DEFAULT_COLUMNS[2],
},
{
label: "Done",
value: "done",
+ icon: DEFAULT_COLUMNS[3],
},
];
@@ -178,7 +186,14 @@ export default function TaskCardContextMenuContent({
className="flex items-center gap-2 cursor-pointer"
checked={task.priority === "low"}
>
- <Flag className="w-3.5 h-3.5 text-blue-400" />
+ <Flag
+ className={cn(
+ "w-3.5 h-3.5",
+ priorityColorsTaskCard[
+ "low" as keyof typeof priorityColorsTaskCard
+ ],
+ )}
+ />
Low
</ContextMenuCheckboxItem>
<ContextMenuCheckboxItem
@@ -186,7 +201,14 @@ export default function TaskCardContextMenuContent({
className="flex items-center gap-2 cursor-pointer"
checked={task.priority === "medium"}
>
- <Flag className="w-3.5 h-3.5 text-yellow-400" />
+ <Flag
+ className={cn(
+ "w-3.5 h-3.5",
+ priorityColorsTaskCard[
+ "medium" as keyof typeof priorityColorsTaskCard
+ ],
+ )}
+ />
Medium
</ContextMenuCheckboxItem>
<ContextMenuCheckboxItem
@@ -194,7 +216,14 @@ export default function TaskCardContextMenuContent({
className="flex items-center gap-2 cursor-pointer"
checked={task.priority === "high"}
>
- <Flag className="w-3.5 h-3.5 text-red-400" />
+ <Flag
+ className={cn(
+ "w-3.5 h-3.5",
+ priorityColorsTaskCard[
+ "high" as keyof typeof priorityColorsTaskCard
+ ],
+ )}
+ />
High
</ContextMenuCheckboxItem>
<ContextMenuCheckboxItem
@@ -202,7 +231,14 @@ export default function TaskCardContextMenuContent({
className="flex items-center gap-2 cursor-pointer"
checked={task.priority === "urgent"}
>
- <Flag className="w-3.5 h-3.5 text-red-400" />
+ <Flag
+ className={cn(
+ "w-3.5 h-3.5",
+ priorityColorsTaskCard[
+ "urgent" as keyof typeof priorityColorsTaskCard
+ ],
+ )}
+ />
Urgent
</ContextMenuCheckboxItem>
</ContextMenuSubContent>
@@ -219,8 +255,16 @@ export default function TaskCardContextMenuContent({
key={status.value}
checked={task.status === status.value}
onCheckedChange={() => handleChange("status", status.value)}
- className="flex items-center justify-between cursor-pointer"
+ className="flex items-center gap-2 cursor-pointer"
>
+ {(() => {
+ const IconComponent = getColumnIcon(status.value);
+ return (
+ <IconComponent
+ className={`w-3.5 h-3.5 flex-shrink-0 ${getColumnIconColor(status.value)}`}
+ />
+ );
+ })()}
{status.label}
</ContextMenuCheckboxItem>
))}
diff --git a/apps/web/src/components/kanban-board/task-card.tsx b/apps/web/src/components/kanban-board/task-card.tsx
index 1f4d7c04d..281980523 100644
--- a/apps/web/src/components/kanban-board/task-card.tsx
+++ b/apps/web/src/components/kanban-board/task-card.tsx
@@ -1,12 +1,20 @@
import { priorityColorsTaskCard } from "@/constants/priority-colors";
+import { dueDateStatusColors, getDueDateStatus } from "@/lib/due-date-status";
import useProjectStore from "@/store/project";
+import { useUserPreferencesStore } from "@/store/user-preferences";
import useWorkspaceStore from "@/store/workspace";
import type Task from "@/types/task";
import { useSortable } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import { useNavigate } from "@tanstack/react-router";
import { format } from "date-fns";
-import { Calendar, Flag, UserIcon } from "lucide-react";
+import {
+ Calendar,
+ CalendarClock,
+ CalendarX,
+ Flag,
+ UserIcon,
+} from "lucide-react";
import type { CSSProperties } from "react";
import { ContextMenu, ContextMenuTrigger } from "../ui/context-menu";
import TaskCardContextMenuContent from "./task-card-context-menu/task-card-context-menu-content";
@@ -28,12 +36,21 @@ function TaskCard({ task }: TaskCardProps) {
const { project } = useProjectStore();
const { workspace } = useWorkspaceStore();
const navigate = useNavigate();
+ const {
+ showAssignees,
+ showPriority,
+ showDueDates,
+ showLabels,
+ showTaskNumbers,
+ } = useUserPreferencesStore();
const style: CSSProperties = {
transform: CSS.Transform.toString(transform),
- transition,
- opacity: isDragging ? 0.5 : 1,
+ transition:
+ transition || "transform 250ms cubic-bezier(0.25, 0.46, 0.45, 0.94)",
+ opacity: isDragging ? 0.6 : 1,
touchAction: "none",
+ zIndex: isDragging ? 999 : "auto",
};
function handleTaskCardClick() {
@@ -55,61 +72,83 @@ function TaskCard({ task }: TaskCardProps) {
<ContextMenuTrigger asChild>
<div
onClick={handleTaskCardClick}
- className="group bg-white dark:bg-zinc-800/50 backdrop-blur-sm rounded-lg border border-zinc-200 dark:border-zinc-700/50 p-3 cursor-move hover:border-zinc-300 dark:hover:border-zinc-700 transition-colors shadow-sm"
+ className={`group bg-white dark:bg-zinc-800/50 backdrop-blur-sm rounded-lg border p-2.5 cursor-move shadow-sm transition-all duration-200 ease-out ${
+ isDragging
+ ? "border-indigo-300 dark:border-indigo-600/70 shadow-lg shadow-indigo-500/10 dark:shadow-indigo-400/5 bg-white dark:bg-zinc-800/80"
+ : "border-zinc-200 dark:border-zinc-700/50 hover:border-zinc-300 dark:hover:border-zinc-600 hover:shadow-md"
+ }`}
onKeyDown={(e) => {
if (e.key === "Enter") handleTaskCardClick();
}}
>
- <div className="flex items-center gap-2 text-xs font-mono text-zinc-500 dark:text-zinc-400 mb-2">
- {project?.slug}-{task.number}
- </div>
+ {showTaskNumbers && (
+ <div className="flex items-center gap-2 text-xs font-mono text-zinc-500 dark:text-zinc-400 mb-1.5">
+ {project?.slug}-{task.number}
+ </div>
+ )}
- <div className="flex flex-col gap-2 mb-2">
+ <div className="flex flex-col gap-1.5 mb-1.5">
<h3 className="font-medium text-zinc-900 dark:text-zinc-100 max-w-4/5 truncate">
{task.title}
</h3>
- <TaskCardLabels taskId={task.id} />
+ {showLabels && <TaskCardLabels taskId={task.id} />}
</div>
- <div className="flex flex-wrap items-center gap-2 mt-auto">
- {task.userEmail ? (
- <div
- className="flex items-center gap-1.5 px-2 py-1 rounded-md bg-zinc-100/50 dark:bg-zinc-800/50 group-hover:bg-zinc-100 dark:group-hover:bg-zinc-800/80 transition-colors"
- title={task.assigneeName ?? ""}
- >
- <span className="text-xs text-zinc-600 dark:text-zinc-400 truncate max-w-[100px]">
- {task.assigneeName}
- </span>
- </div>
- ) : (
+ <div className="flex flex-wrap items-center gap-1.5 mt-auto">
+ {showAssignees &&
+ (task.userEmail ? (
+ <div
+ className="flex items-center gap-1.5 px-2 py-1 rounded-md bg-zinc-100/50 dark:bg-zinc-800/50 group-hover:bg-zinc-100 dark:group-hover:bg-zinc-800/80 transition-colors"
+ title={task.assigneeName ?? ""}
+ >
+ <span className="text-xs text-zinc-600 dark:text-zinc-400 truncate max-w-[100px]">
+ {task.assigneeName}
+ </span>
+ </div>
+ ) : (
+ <div
+ className="flex items-center gap-1.5 px-2 py-1 rounded-md bg-zinc-100/50 dark:bg-zinc-800/50 group-hover:bg-zinc-100 dark:group-hover:bg-zinc-800/80 transition-colors"
+ title="Unassigned"
+ >
+ <UserIcon className="h-3 w-3 text-zinc-400 dark:text-zinc-500" />
+ <span className="text-xs text-zinc-500 dark:text-zinc-400">
+ Unassigned
+ </span>
+ </div>
+ ))}
+
+ {showDueDates && (
<div
- className="flex items-center gap-1.5 px-2 py-1 rounded-md bg-zinc-100/50 dark:bg-zinc-800/50 group-hover:bg-zinc-100 dark:group-hover:bg-zinc-800/80 transition-colors"
- title="Unassigned"
+ className={`flex items-center gap-1.5 px-2 py-1 rounded-md transition-colors ${dueDateStatusColors[getDueDateStatus(task.dueDate)]} group-hover:opacity-80`}
>
- <UserIcon className="h-3 w-3 text-zinc-400 dark:text-zinc-500" />
- <span className="text-xs text-zinc-500 dark:text-zinc-400">
- Unassigned
+ {getDueDateStatus(task.dueDate) === "overdue" && (
+ <CalendarX className="w-3 h-3" />
+ )}
+ {getDueDateStatus(task.dueDate) === "due-soon" && (
+ <CalendarClock className="w-3 h-3" />
+ )}
+ {(getDueDateStatus(task.dueDate) === "far-future" ||
+ getDueDateStatus(task.dueDate) === "no-due-date") && (
+ <Calendar className="w-3 h-3" />
+ )}
+ <span className="text-xs">
+ {task.dueDate
+ ? format(new Date(task.dueDate), "MMM d")
+ : "No due date"}
</span>
</div>
)}
- {task.dueDate && (
- <div className="flex items-center gap-1.5 px-2 py-1 rounded-md bg-zinc-100/50 dark:bg-zinc-800/50 group-hover:bg-zinc-100 dark:group-hover:bg-zinc-800/80 transition-colors">
- <Calendar className="w-3 h-3 text-zinc-400 dark:text-zinc-500" />
- <span className="text-xs text-zinc-600 dark:text-zinc-400">
- {format(new Date(task.dueDate), "MMM d, yyyy")}
+ {showPriority && (
+ <div className="flex-shrink-0">
+ <span
+ className={`text-xs px-2 py-1 rounded-full ${priorityColorsTaskCard[task.priority as keyof typeof priorityColorsTaskCard]}`}
+ >
+ <Flag className="w-3 h-3 inline-block mr-1" />
+ {task.priority}
</span>
</div>
)}
-
- <div className="flex-shrink-0">
- <span
- className={`text-xs px-2 py-1 rounded-full ${priorityColorsTaskCard[task.priority as keyof typeof priorityColorsTaskCard]}`}
- >
- <Flag className="w-3 h-3 inline-block mr-1" />
- {task.priority}
- </span>
- </div>
</div>
</div>
</ContextMenuTrigger>
diff --git a/apps/web/src/components/kanban-board/task-labels.tsx b/apps/web/src/components/kanban-board/task-labels.tsx
index 5129f58f2..6c1607608 100644
--- a/apps/web/src/components/kanban-board/task-labels.tsx
+++ b/apps/web/src/components/kanban-board/task-labels.tsx
@@ -38,7 +38,7 @@ function TaskCardLabels({ taskId }: { taskId: string }) {
if (!labels.length) return null;
return (
- <div className="flex flex-wrap gap-1 mb-2">
+ <div className="flex flex-wrap gap-1">
{labels.map((label: Label) => (
<Badge
key={label.id}
diff --git a/apps/web/src/components/list-view/index.tsx b/apps/web/src/components/list-view/index.tsx
index c667245dd..5c593446d 100644
--- a/apps/web/src/components/list-view/index.tsx
+++ b/apps/web/src/components/list-view/index.tsx
@@ -1,33 +1,36 @@
+import { priorityColorsTaskCard } from "@/constants/priority-colors";
import useUpdateTask from "@/hooks/mutations/task/use-update-task";
import { cn } from "@/lib/cn";
+import { getColumnIcon, getColumnIconColor } from "@/lib/column";
import toKebabCase from "@/lib/to-kebab-case";
import useProjectStore from "@/store/project";
import type { ProjectWithTasks } from "@/types/project";
-import type Task from "@/types/task";
import {
DndContext,
type DragEndEvent,
+ type DragOverEvent,
DragOverlay,
type DragStartEvent,
KeyboardSensor,
MouseSensor,
TouchSensor,
+ type UniqueIdentifier,
+ closestCorners,
useDroppable,
useSensor,
useSensors,
} from "@dnd-kit/core";
+import { snapCenterToCursor } from "@dnd-kit/modifiers";
import {
SortableContext,
verticalListSortingStrategy,
} from "@dnd-kit/sortable";
-import { motion } from "framer-motion";
import { produce } from "immer";
-import { Archive, ChevronDown, Plus } from "lucide-react";
+import { Archive, ChevronRight, Flag, Plus } from "lucide-react";
import { useState } from "react";
import { toast } from "sonner";
import CreateTaskModal from "../shared/modals/create-task-modal";
import TaskRow from "./task-row";
-import TaskRowOverlay from "./task-row-overlay";
type ListViewProps = {
project: ProjectWithTasks;
@@ -36,12 +39,8 @@ type ListViewProps = {
function ListView({ project }: ListViewProps) {
const { setProject } = useProjectStore();
const { mutate: updateTask } = useUpdateTask();
- const sensors = useSensors(
- useSensor(MouseSensor, { activationConstraint: { distance: 5 } }),
- useSensor(TouchSensor, { activationConstraint: { distance: 5 } }),
- useSensor(KeyboardSensor),
- );
- const [activeTask, setActiveTask] = useState<Task | null>(null);
+ const [activeId, setActiveId] = useState<UniqueIdentifier | null>(null);
+ const [overColumnId, setOverColumnId] = useState<string | null>(null);
const [expandedSections, setExpandedSections] = useState<
Record<string, boolean>
>({
@@ -53,62 +52,108 @@ function ListView({ project }: ListViewProps) {
const [isTaskModalOpen, setIsTaskModalOpen] = useState(false);
const [activeColumn, setActiveColumn] = useState<string | null>(null);
+ const sensors = useSensors(
+ useSensor(MouseSensor, {
+ activationConstraint: { distance: 8 },
+ }),
+ useSensor(TouchSensor, {
+ activationConstraint: {
+ delay: 200,
+ tolerance: 8,
+ },
+ }),
+ useSensor(KeyboardSensor),
+ );
+
const handleDragStart = (event: DragStartEvent) => {
- const { active } = event;
- const task = project?.columns
- ?.flatMap((col) => col.tasks)
- .find((t) => t.id === active.id);
- if (task) {
- setActiveTask(task);
+ setActiveId(event.active.id);
+ };
+
+ const handleDragOver = (event: DragOverEvent) => {
+ const { over } = event;
+ if (!over || !activeId) {
+ setOverColumnId(null);
+ return;
+ }
+
+ if (project?.columns?.some((col) => col.id === over.id)) {
+ setOverColumnId(over.id.toString());
+ return;
+ }
+
+ const taskId = over.id.toString();
+ const columnWithTask = project?.columns?.find((col) =>
+ col.tasks.some((task) => task.id === taskId),
+ );
+
+ if (columnWithTask) {
+ setOverColumnId(columnWithTask.id);
+ } else {
+ setOverColumnId(null);
}
};
const handleDragEnd = (event: DragEndEvent) => {
const { active, over } = event;
+ setActiveId(null);
+ setOverColumnId(null);
+
if (!over || !project?.columns) return;
- const activeId = active.id.toString();
+ const activeTaskId = active.id.toString();
const overId = over.id.toString();
const updatedProject = produce(project, (draft) => {
- const sourceColumn = draft.columns?.find((col) =>
- col.tasks.some((task) => task.id === activeId),
+ const sourceColumn = draft?.columns?.find((col) =>
+ col.tasks.some((task) => task.id === activeTaskId),
);
- const destinationColumn = draft.columns?.find(
+ const destinationColumn = draft?.columns?.find(
(col) =>
col.id === overId || col.tasks.some((task) => task.id === overId),
);
if (!sourceColumn || !destinationColumn) return;
- const taskIndex = sourceColumn.tasks.findIndex((t) => t.id === activeId);
- const task = sourceColumn.tasks[taskIndex];
+ const sourceTaskIndex = sourceColumn.tasks.findIndex(
+ (task) => task.id === activeTaskId,
+ );
+ const task = sourceColumn.tasks[sourceTaskIndex];
- sourceColumn.tasks.splice(taskIndex, 1);
+ sourceColumn.tasks = sourceColumn.tasks.filter(
+ (t) => t.id !== activeTaskId,
+ );
if (sourceColumn.id === destinationColumn.id) {
- const destinationIndex = destinationColumn.tasks.findIndex(
+ let destinationIndex = destinationColumn.tasks.findIndex(
(t) => t.id === overId,
);
+ if (sourceTaskIndex <= destinationIndex) {
+ destinationIndex += 1;
+ }
destinationColumn.tasks.splice(destinationIndex, 0, task);
- } else {
- destinationColumn.tasks.push({
- ...task,
- status: destinationColumn.id,
+
+ destinationColumn.tasks.forEach((t, index) => {
+ updateTask({
+ ...t,
+ status: destinationColumn.id,
+ position: index + 1,
+ });
});
- }
+ } else {
+ task.status = destinationColumn.id;
+ destinationColumn.tasks.push(task);
- destinationColumn.tasks.forEach((t, index) => {
- updateTask({
- ...t,
- status: destinationColumn.id,
- position: index + 1,
+ destinationColumn.tasks.forEach((t, index) => {
+ updateTask({
+ ...t,
+ status: destinationColumn.id,
+ position: index + 1,
+ });
});
- });
+ }
});
setProject(updatedProject);
- setActiveTask(null);
};
const toggleSection = (sectionId: string) => {
@@ -118,6 +163,31 @@ function ListView({ project }: ListViewProps) {
}));
};
+ const handleArchiveTasks = (column: ProjectWithTasks["columns"][number]) => {
+ if (column.id !== "done" || column.tasks.length === 0) return;
+
+ if (!confirm(`Archive all ${column.tasks.length} completed tasks?`)) {
+ return;
+ }
+
+ const updatedProject = produce(project, (draft) => {
+ const doneColumn = draft?.columns?.find((col) => col.id === "done");
+ if (!doneColumn) return;
+
+ for (const task of doneColumn.tasks) {
+ updateTask({
+ ...task,
+ status: "archived",
+ });
+ }
+
+ doneColumn.tasks = [];
+ });
+
+ setProject(updatedProject);
+ toast.success(`Archived ${column.tasks.length} tasks`);
+ };
+
function ColumnSection({
column,
}: { column: ProjectWithTasks["columns"][number] }) {
@@ -129,112 +199,92 @@ function ListView({ project }: ListViewProps) {
},
});
- const handleArchiveTasks = () => {
- if (column.id !== "done") return;
-
- if (column.tasks.length === 0) {
- toast.info("No tasks to archive");
- return;
- }
-
- if (!confirm(`Archive all ${column.tasks.length} completed tasks?`)) {
- return;
- }
-
- const updatedProject = produce(project, (draft) => {
- const doneColumn = draft?.columns?.find((col) => col.id === "done");
- if (!doneColumn) return;
-
- for (const task of doneColumn.tasks) {
- updateTask({
- ...task,
- status: "archived",
- });
- }
-
- doneColumn.tasks = [];
- });
-
- setProject(updatedProject);
- toast.success(`Archived ${column.tasks.length} tasks`);
- };
+ const showDropIndicator = activeId && overColumnId === column.id;
return (
- <div key={column.id} className="space-y-2">
- <div className="flex items-center justify-between">
+ <div
+ className={cn(
+ "border-b border-zinc-200 dark:border-zinc-800/50 transition-all duration-200 overflow-auto",
+ showDropIndicator &&
+ "border-l-4 border-l-indigo-500 dark:border-l-indigo-400 bg-indigo-50/30 dark:bg-indigo-950/10",
+ )}
+ >
+ <div className="flex items-center justify-between py-2 px-4 bg-zinc-100/60 dark:bg-zinc-800/20 border-b border-zinc-200/50 dark:border-zinc-800/30">
<button
type="button"
onClick={() => toggleSection(column.id)}
- className={cn(
- "flex-1 flex items-center gap-2 p-2 text-left rounded-lg",
- "hover:bg-zinc-100 dark:hover:bg-zinc-800/50 transition-colors",
- "group",
- )}
+ className="flex items-center gap-2 text-sm font-medium text-zinc-800 dark:text-zinc-300 hover:text-zinc-900 dark:hover:text-zinc-100 transition-colors"
>
- <ChevronDown
+ <ChevronRight
className={cn(
- "w-4 h-4 text-zinc-500 dark:text-zinc-400 transition-transform",
- !expandedSections[column.id] && "-rotate-90",
+ "w-3 h-3 transition-transform",
+ expandedSections[column.id] && "rotate-90",
)}
/>
- <span className="font-medium text-zinc-900 dark:text-zinc-100">
- {column.name}
- </span>
- <span className="text-sm text-zinc-500 dark:text-zinc-400">
- {column.tasks.length}
- </span>
+ <div className="flex items-center gap-2 h-4">
+ {(() => {
+ const IconComponent = getColumnIcon(column.id);
+ return (
+ <IconComponent
+ className={`w-4 h-4 flex-shrink-0 ${getColumnIconColor(column.id)}`}
+ />
+ );
+ })()}
+ <div className="flex items-center gap-1">
+ <span className="mt-1 mr-1">{column.name}</span>
+ <span className="text-xs text-zinc-400 dark:text-zinc-500 mt-0.5">
+ {column.tasks.length}
+ </span>
+ </div>
+ </div>
</button>
- {column.id === "done" && column.tasks.length > 0 && (
+ <div className="flex items-center gap-1">
<button
type="button"
- onClick={handleArchiveTasks}
- className="p-2 text-zinc-600 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800/50 rounded-md flex items-center transition-all"
- title="Archive all completed tasks"
+ onClick={() => {
+ setIsTaskModalOpen(true);
+ setActiveColumn(column.id);
+ }}
+ className="p-1 hover:bg-zinc-200/70 dark:hover:bg-zinc-700 rounded text-zinc-600 hover:text-zinc-800 dark:text-zinc-500 dark:hover:text-zinc-300 transition-colors"
+ title="Add task"
>
- <Archive className="w-4 h-4" />
+ <Plus className="w-3 h-3" />
</button>
- )}
+
+ {column.id === "done" && column.tasks.length > 0 && (
+ <button
+ type="button"
+ onClick={() => handleArchiveTasks(column)}
+ className="p-1 hover:bg-zinc-200/70 dark:hover:bg-zinc-700 rounded text-zinc-600 hover:text-zinc-800 dark:text-zinc-500 dark:hover:text-zinc-300 transition-colors"
+ title="Archive all completed tasks"
+ >
+ <Archive className="w-3 h-3" />
+ </button>
+ )}
+ </div>
</div>
{expandedSections[column.id] && (
- <div ref={setNodeRef} className="min-h-[60px] rounded-lg">
+ <div ref={setNodeRef} className="bg-white dark:bg-transparent">
<SortableContext
items={column.tasks}
strategy={verticalListSortingStrategy}
>
- <motion.div
- initial={false}
- animate={{ opacity: 1 }}
- className="space-y-1"
- >
- {column.tasks.map((task) => (
- <TaskRow
- key={task.id}
- task={task}
- projectSlug={project?.slug ?? ""}
- />
- ))}
-
- {column.tasks.length === 0 && (
- <div className="px-10 py-4 text-center text-sm text-zinc-500 dark:text-zinc-400 bg-zinc-100 dark:bg-zinc-800/50 rounded-lg min-h-[60px] flex items-center justify-center">
- No tasks in {column.name.toLowerCase()}
- </div>
- )}
- </motion.div>
+ {column.tasks.map((task) => (
+ <TaskRow
+ key={task.id}
+ task={task}
+ projectSlug={project?.slug ?? ""}
+ />
+ ))}
</SortableContext>
- <button
- type="button"
- onClick={() => {
- setIsTaskModalOpen(true);
- setActiveColumn(column.id);
- }}
- className="w-full mt-2 text-left px-3 py-2 text-sm text-zinc-600 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800/50 rounded-md flex items-center gap-2 transition-all"
- >
- <Plus className="w-4 h-4 text-zinc-500 dark:text-zinc-400" />
- <span>Add task</span>
- </button>
+ {column.tasks.length === 0 && (
+ <div className="py-6 px-4 text-center text-xs text-zinc-400 dark:text-zinc-500">
+ No tasks
+ </div>
+ )}
</div>
)}
</div>
@@ -245,22 +295,59 @@ function ListView({ project }: ListViewProps) {
return null;
}
+ const activeTask = activeId
+ ? project.columns
+ ?.flatMap((col) => col.tasks)
+ .find((task) => task.id === activeId)
+ : null;
+
return (
<DndContext
sensors={sensors}
+ collisionDetection={closestCorners}
onDragStart={handleDragStart}
+ onDragOver={handleDragOver}
onDragEnd={handleDragEnd}
+ modifiers={[snapCenterToCursor]}
>
- <div className="w-full h-full p-4 space-y-4">
- {project.columns.map((column) => (
- <ColumnSection key={column.id} column={column} />
- ))}
+ <div className="w-full h-full overflow-auto bg-zinc-50/30 dark:bg-transparent">
+ <div className="divide-y divide-zinc-200 dark:divide-zinc-800/50">
+ {project.columns.map((column) => (
+ <ColumnSection key={column.id} column={column} />
+ ))}
+ </div>
</div>
+
<DragOverlay>
{activeTask && (
- <TaskRowOverlay task={activeTask} projectSlug={project?.slug ?? ""} />
+ <div className="bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg shadow-lg p-2 max-w-[200px] cursor-grabbing">
+ <div className="flex items-center gap-2">
+ <div className="flex-shrink-0">
+ <Flag
+ className={cn(
+ "w-3 h-3",
+ priorityColorsTaskCard[
+ activeTask.priority as keyof typeof priorityColorsTaskCard
+ ],
+ )}
+ />
+ </div>
+
+ <div className="flex-1 min-w-0">
+ <div className="flex items-center gap-1.5">
+ <span className="text-[10px] font-mono text-zinc-400 dark:text-zinc-500">
+ {project?.slug}-{activeTask.number}
+ </span>
+ <span className="text-xs text-zinc-900 dark:text-zinc-100 truncate">
+ {activeTask.title}
+ </span>
+ </div>
+ </div>
+ </div>
+ </div>
)}
</DragOverlay>
+
<CreateTaskModal
open={isTaskModalOpen}
onClose={() => setIsTaskModalOpen(false)}
diff --git a/apps/web/src/components/list-view/task-row-overlay.tsx b/apps/web/src/components/list-view/task-row-overlay.tsx
deleted file mode 100644
index 3c52e039c..000000000
--- a/apps/web/src/components/list-view/task-row-overlay.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-import { Avatar, AvatarFallback } from "@/components/ui/avatar";
-import { priorityColorsTaskCard } from "@/constants/priority-colors";
-import { cn } from "@/lib/cn";
-import type Task from "@/types/task";
-import { format } from "date-fns";
-import { Flag } from "lucide-react";
-
-interface TaskRowOverlayProps {
- task: Task;
- projectSlug: string;
-}
-
-function TaskRowOverlay({ task, projectSlug }: TaskRowOverlayProps) {
- return (
- <div
- className={cn(
- "px-4 py-2 rounded-lg flex items-center gap-4 w-[95%]",
- "bg-white dark:bg-zinc-900 shadow-xl border border-zinc-200 dark:border-zinc-700",
- "transform rotate-2 cursor-grabbing",
- "ring-1 ring-black/5 dark:ring-white/5",
- "w-[calc(100%-2rem)]",
- "max-w-3xl",
- )}
- >
- <div className="flex-1 min-w-0 flex items-center gap-3">
- <div className="text-xs font-mono text-zinc-500 dark:text-zinc-400 shrink-0">
- {projectSlug}-{task.number}
- </div>
-
- <h3 className="text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate">
- {task.title}
- </h3>
- </div>
-
- <div className="flex items-center gap-3">
- {task.userEmail ? (
- <Avatar className="h-6 w-6">
- <AvatarFallback className="text-xs">
- {task.userEmail.charAt(0)}
- </AvatarFallback>
- </Avatar>
- ) : (
- <Avatar className="h-6 w-6">
- <AvatarFallback className="text-xs bg-zinc-100 dark:bg-zinc-800 text-zinc-500 dark:text-zinc-400">
- ?
- </AvatarFallback>
- </Avatar>
- )}
-
- {task.dueDate && (
- <div className="text-xs text-zinc-500 dark:text-zinc-400">
- {format(new Date(task.dueDate), "MMM d")}
- </div>
- )}
-
- {task.priority && (
- <div
- className={cn(
- "flex items-center gap-1 text-xs px-2 py-1 rounded-full",
- priorityColorsTaskCard[
- task.priority as keyof typeof priorityColorsTaskCard
- ],
- )}
- >
- <Flag className="w-3 h-3" />
- <span className="capitalize">{task.priority}</span>
- </div>
- )}
- </div>
- </div>
- );
-}
-
-export default TaskRowOverlay;
diff --git a/apps/web/src/components/list-view/task-row.tsx b/apps/web/src/components/list-view/task-row.tsx
index c06bad551..b890531fa 100644
--- a/apps/web/src/components/list-view/task-row.tsx
+++ b/apps/web/src/components/list-view/task-row.tsx
@@ -1,14 +1,16 @@
-import { Avatar, AvatarFallback } from "@/components/ui/avatar";
import { priorityColorsTaskCard } from "@/constants/priority-colors";
import { cn } from "@/lib/cn";
+import { dueDateStatusColors, getDueDateStatus } from "@/lib/due-date-status";
import useProjectStore from "@/store/project";
+import { useUserPreferencesStore } from "@/store/user-preferences";
import type Task from "@/types/task";
import { useSortable } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import { useNavigate } from "@tanstack/react-router";
import { format } from "date-fns";
-import { Flag, GripVertical } from "lucide-react";
+import { Calendar, CalendarClock, CalendarX, Flag, User } from "lucide-react";
import TaskCardContextMenuContent from "../kanban-board/task-card-context-menu/task-card-context-menu-content";
+import TaskCardLabels from "../kanban-board/task-labels";
import { ContextMenu, ContextMenuTrigger } from "../ui/context-menu";
interface TaskRowProps {
@@ -28,15 +30,24 @@ function TaskRow({ task, projectSlug }: TaskRowProps) {
} = useSortable({ id: task.id });
const { project } = useProjectStore();
+ const {
+ showAssignees,
+ showPriority,
+ showDueDates,
+ showLabels,
+ showTaskNumbers,
+ } = useUserPreferencesStore();
const style = {
transform: CSS.Transform.toString(transform),
- transition,
+ transition:
+ transition || "transform 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94)",
touchAction: "none",
};
- const handleClick = () => {
+ const handleClick = (e: React.MouseEvent) => {
if (!project || !task) return;
+ if (e.defaultPrevented) return;
navigate({
to: "/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId",
@@ -48,80 +59,93 @@ function TaskRow({ task, projectSlug }: TaskRowProps) {
});
};
+ const handleKeyDown = (e: React.KeyboardEvent) => {
+ if (e.key === "Enter") {
+ handleClick(e as unknown as React.MouseEvent);
+ }
+ };
+
return (
- <div ref={setNodeRef} style={style}>
+ <div
+ ref={setNodeRef}
+ style={style}
+ className={cn(
+ "border-b border-zinc-200/50 dark:border-zinc-800/50 transition-all duration-200",
+ isDragging && "opacity-50",
+ )}
+ >
<ContextMenu>
<ContextMenuTrigger asChild>
<div
- onClick={(e) => {
- if (e.nativeEvent.which === 1) {
- handleClick();
- }
- }}
- onKeyDown={(e) => e.key === "Enter" && handleClick()}
- className={cn(
- "group px-4 py-2 rounded-lg flex items-center gap-4 bg-white dark:bg-zinc-900",
- "hover:bg-zinc-50 dark:hover:bg-zinc-800/50 transition-colors cursor-pointer",
- "border border-transparent hover:border-zinc-200 dark:hover:border-zinc-800",
- isDragging && "opacity-25",
- )}
+ onClick={handleClick}
+ onKeyDown={handleKeyDown}
+ className="group relative flex items-center gap-3 px-4 py-1.5 hover:bg-zinc-100/60 dark:hover:bg-zinc-800/20 transition-colors cursor-pointer"
+ {...attributes}
+ {...listeners}
>
- <button
- type="button"
- className="p-1 -ml-2 rounded-md hover:bg-zinc-100 dark:hover:bg-zinc-800 cursor-grab active:cursor-grabbing"
- {...attributes}
- {...listeners}
- >
- <GripVertical className="w-4 h-4 text-zinc-400" />
- </button>
-
- <div className="flex-1 min-w-0 flex items-center gap-3">
- <div className="text-xs font-mono text-zinc-500 dark:text-zinc-400 shrink-0">
+ {showTaskNumbers && (
+ <div className="text-xs font-mono text-zinc-400 dark:text-zinc-500 w-16 flex-shrink-0">
{projectSlug}-{task.number}
</div>
+ )}
- <h3 className="text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate">
- {task.title}
- </h3>
- </div>
-
- <div className="flex items-center gap-3">
- {task.userEmail ? (
- <Avatar className="h-6 w-6">
- <AvatarFallback className="text-xs">
- {task.userEmail.charAt(0)}
- </AvatarFallback>
- </Avatar>
- ) : (
- <Avatar className="h-6 w-6">
- <AvatarFallback className="text-xs bg-zinc-100 dark:bg-zinc-800 text-zinc-500 dark:text-zinc-400">
- ?
- </AvatarFallback>
- </Avatar>
- )}
-
- {task.dueDate && (
- <div className="text-xs text-zinc-500 dark:text-zinc-400">
- {format(new Date(task.dueDate), "MMM d")}
- </div>
- )}
-
- {task.priority && (
- <div
+ {showPriority && (
+ <div className="flex-shrink-0">
+ <Flag
className={cn(
- "flex items-center gap-1 text-xs px-2 py-1 rounded-full",
+ "w-3 h-3",
priorityColorsTaskCard[
task.priority as keyof typeof priorityColorsTaskCard
],
)}
- >
- <Flag className="w-3 h-3" />
- <span className="capitalize hidden group-hover:inline">
- {task.priority}
- </span>
- </div>
- )}
+ />
+ </div>
+ )}
+
+ <div className="flex-1 min-w-0 flex items-center gap-2">
+ <div className="flex items-center gap-2 justify-between w-full">
+ <span className="text-sm text-zinc-900 dark:text-zinc-100 truncate">
+ {task.title}
+ </span>
+ {showLabels && (
+ <div className="flex items-center gap-1">
+ <TaskCardLabels taskId={task.id} />
+ </div>
+ )}
+ </div>
</div>
+
+ {showDueDates && task.dueDate && (
+ <div
+ className={cn(
+ "flex items-center gap-1 text-xs px-1.5 py-0.5 rounded flex-shrink-0",
+ dueDateStatusColors[getDueDateStatus(task.dueDate)],
+ )}
+ >
+ {getDueDateStatus(task.dueDate) === "overdue" && (
+ <CalendarX className="w-3 h-3" />
+ )}
+ {getDueDateStatus(task.dueDate) === "due-soon" && (
+ <CalendarClock className="w-3 h-3" />
+ )}
+ {(getDueDateStatus(task.dueDate) === "far-future" ||
+ getDueDateStatus(task.dueDate) === "no-due-date") && (
+ <Calendar className="w-3 h-3" />
+ )}
+ <span>{format(new Date(task.dueDate), "MMM d")}</span>
+ </div>
+ )}
+
+ {showAssignees && (
+ <div className="flex items-center gap-1.5 text-xs text-zinc-500 dark:text-zinc-400 flex-shrink-0">
+ <User className="w-3 h-3" />
+ <span className="truncate max-w-[100px]">
+ {task.assigneeName ||
+ task.userEmail?.split("@")[0] ||
+ "Unassigned"}
+ </span>
+ </div>
+ )}
</div>
</ContextMenuTrigger>
diff --git a/apps/web/src/components/nav-main.tsx b/apps/web/src/components/nav-main.tsx
new file mode 100644
index 000000000..594d47003
--- /dev/null
+++ b/apps/web/src/components/nav-main.tsx
@@ -0,0 +1,197 @@
+import { useNavigate, useParams } from "@tanstack/react-router";
+import {
+ BarChart3,
+ Calendar,
+ ChevronDown,
+ Clock,
+ LayoutDashboard,
+ LayoutGrid,
+ Search,
+ Users,
+} from "lucide-react";
+
+import {
+ SidebarGroup,
+ SidebarGroupLabel,
+ SidebarMenu,
+ SidebarMenuButton,
+ SidebarMenuItem,
+} from "@/components/ui/sidebar";
+import { cn } from "@/lib/cn";
+import useWorkspaceStore from "@/store/workspace";
+import { useState } from "react";
+import SearchCommandMenu from "./search-command-menu";
+import { SettingsMenu } from "./settings-menu";
+import { Button } from "./ui/button";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "./ui/dropdown-menu";
+
+export function NavMain() {
+ const { workspace } = useWorkspaceStore();
+ const navigate = useNavigate();
+ const [open, setOpen] = useState(false);
+ const { workspaceId: currentWorkspaceId, projectId: currentProjectId } =
+ useParams({
+ strict: false,
+ });
+
+ if (!workspace) return null;
+
+ const isInProject = currentProjectId && currentWorkspaceId === workspace.id;
+ const currentPath = window.location.pathname;
+ const isBoard = currentPath.includes("/board");
+ const isBacklog = currentPath.includes("/backlog");
+
+ const navItems = [
+ {
+ title: "Projects",
+ url: `/dashboard/workspace/${workspace.id}`,
+ icon: LayoutDashboard,
+ isActive:
+ window.location.pathname === `/dashboard/workspace/${workspace.id}`,
+ isDisabled: false,
+ },
+ {
+ title: "Search",
+ onClick: () => {
+ setOpen(true);
+ },
+ icon: Search,
+ isActive: false,
+ isDisabled: false,
+ },
+ {
+ title: "Time Tracking",
+ url: `/dashboard/workspace/${workspace.id}/time`,
+ icon: Clock,
+ isActive:
+ window.location.pathname ===
+ `/dashboard/workspace/${workspace.id}/time`,
+ isDisabled: true,
+ },
+ {
+ title: "Analytics",
+ url: `/dashboard/workspace/${workspace.id}/analytics`,
+ icon: BarChart3,
+ isActive:
+ window.location.pathname ===
+ `/dashboard/workspace/${workspace.id}/analytics`,
+ isDisabled: true,
+ },
+ {
+ title: "Members",
+ url: `/dashboard/workspace/${workspace.id}/members`,
+ icon: Users,
+ isActive:
+ window.location.pathname ===
+ `/dashboard/workspace/${workspace.id}/members`,
+ isDisabled: false,
+ },
+ ];
+
+ const handleNavClick = (url: string) => {
+ navigate({ to: url });
+ };
+
+ const handleViewChange = (view: "board" | "backlog") => {
+ if (!currentProjectId) return;
+ navigate({
+ to: `/dashboard/workspace/$workspaceId/project/$projectId/${view}`,
+ params: {
+ workspaceId: workspace.id,
+ projectId: currentProjectId,
+ },
+ });
+ };
+
+ return (
+ <>
+ <SidebarGroup>
+ <SidebarGroupLabel>Main</SidebarGroupLabel>
+ <SidebarMenu>
+ {navItems.map((item) => (
+ <SidebarMenuItem key={item.title}>
+ <SidebarMenuButton
+ asChild
+ tooltip={item.title}
+ disabled={item.isDisabled}
+ className="w-full flex gap-2 justify-start items-start"
+ >
+ <Button
+ onClick={() => {
+ if (item.url) {
+ handleNavClick(item.url);
+ } else {
+ item.onClick?.();
+ }
+ }}
+ variant="ghost"
+ className={cn("w-full", item.isActive && "bg-accent")}
+ >
+ {item.icon && <item.icon className="w-4 h-4" />}
+ <span>{item.title}</span>
+ </Button>
+ </SidebarMenuButton>
+ </SidebarMenuItem>
+ ))}
+
+ {isInProject && (
+ <SidebarMenuItem>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button
+ variant="ghost"
+ className={cn(
+ "w-full flex items-center gap-2 justify-between",
+ )}
+ >
+ <div className="flex items-center gap-2">
+ {isBoard ? (
+ <LayoutGrid className="w-4 h-4" />
+ ) : (
+ <Calendar className="w-4 h-4" />
+ )}
+ <span>View</span>
+ </div>
+ <ChevronDown className="w-3 h-3 opacity-50" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="start" className="w-48">
+ <DropdownMenuItem
+ onClick={() => handleViewChange("board")}
+ className={cn("cursor-pointer", isBoard && "bg-accent")}
+ >
+ <LayoutGrid className="w-4 h-4 mr-2" />
+ Active Board
+ {isBoard && (
+ <div className="ml-auto w-2 h-2 bg-primary rounded-full" />
+ )}
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ onClick={() => handleViewChange("backlog")}
+ className={cn("cursor-pointer", isBacklog && "bg-accent")}
+ >
+ <Calendar className="w-4 h-4 mr-2" />
+ Backlog
+ {isBacklog && (
+ <div className="ml-auto w-2 h-2 bg-primary rounded-full" />
+ )}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </SidebarMenuItem>
+ )}
+
+ <SidebarMenuItem>
+ <SettingsMenu />
+ </SidebarMenuItem>
+ </SidebarMenu>
+ </SidebarGroup>
+ <SearchCommandMenu open={open} setOpen={setOpen} />
+ </>
+ );
+}
diff --git a/apps/web/src/components/nav-projects.tsx b/apps/web/src/components/nav-projects.tsx
new file mode 100644
index 000000000..00493ad08
--- /dev/null
+++ b/apps/web/src/components/nav-projects.tsx
@@ -0,0 +1,221 @@
+import { Button } from "@/components/ui/button";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu";
+import {
+ SidebarGroup,
+ SidebarGroupLabel,
+ SidebarMenu,
+ SidebarMenuAction,
+ SidebarMenuButton,
+ SidebarMenuItem,
+ useSidebar,
+} from "@/components/ui/sidebar";
+import icons from "@/constants/project-icons";
+import { shortcuts } from "@/constants/shortcuts";
+import useDeleteProject from "@/hooks/mutations/project/use-delete-project";
+import useGetProjects from "@/hooks/queries/project/use-get-projects";
+import { cn } from "@/lib/cn";
+import useWorkspaceStore from "@/store/workspace";
+import type { ProjectWithTasks } from "@/types/project";
+import { useQueryClient } from "@tanstack/react-query";
+import { useNavigate, useParams } from "@tanstack/react-router";
+import { Folder, Forward, MoreHorizontal, Trash2 } from "lucide-react";
+import { useState } from "react";
+import { toast } from "sonner";
+import CreateProjectModal from "./shared/modals/create-project-modal";
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+} from "./ui/alert-dialog";
+import { KbdSequence } from "./ui/kbd";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "./ui/tooltip";
+
+export function NavProjects() {
+ const { isMobile } = useSidebar();
+ const { workspace } = useWorkspaceStore();
+ const { data: projects } = useGetProjects({
+ workspaceId: workspace?.id || "",
+ });
+ const queryClient = useQueryClient();
+ const { mutateAsync: deleteProject } = useDeleteProject();
+ const navigate = useNavigate();
+ const { workspaceId: currentWorkspaceId, projectId: currentProjectId } =
+ useParams({
+ strict: false,
+ });
+
+ const [isCreateProjectModalOpen, setIsCreateProjectModalOpen] =
+ useState(false);
+ const [isDeleteProjectModalOpen, setIsDeleteProjectModalOpen] =
+ useState(false);
+
+ const isCurrentProject = (projectId: string) => {
+ return (
+ currentProjectId === projectId && currentWorkspaceId === workspace?.id
+ );
+ };
+
+ const handleProjectClick = (project: ProjectWithTasks) => {
+ navigate({
+ to: "/dashboard/workspace/$workspaceId/project/$projectId/board",
+ params: {
+ workspaceId: workspace?.id || "",
+ projectId: project.id,
+ },
+ });
+ };
+
+ if (!workspace) return null;
+
+ return (
+ <SidebarGroup className="group-data-[collapsible=icon]:hidden">
+ <SidebarGroupLabel>Projects</SidebarGroupLabel>
+ <SidebarMenu>
+ {projects?.map((project) => {
+ const IconComponent =
+ icons[project.icon as keyof typeof icons] || icons.Layout;
+
+ return (
+ <SidebarMenuItem key={project.id}>
+ <SidebarMenuButton asChild>
+ <Button
+ onClick={() => handleProjectClick(project)}
+ variant="ghost"
+ className={cn(
+ "w-full flex gap-2 justify-start items-start",
+ isCurrentProject(project.id) && "bg-accent",
+ )}
+ >
+ <IconComponent className="w-4 h-4" />
+ <span>{project.name}</span>
+ </Button>
+ </SidebarMenuButton>
+
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <SidebarMenuAction showOnHover>
+ <MoreHorizontal />
+ <span className="sr-only">More</span>
+ </SidebarMenuAction>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent
+ className="w-48 rounded-lg"
+ side={isMobile ? "bottom" : "right"}
+ align={isMobile ? "end" : "start"}
+ >
+ <DropdownMenuItem
+ className="items-start"
+ onClick={() => handleProjectClick(project)}
+ >
+ <Folder className="text-muted-foreground" />
+ <span>View Project</span>
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ className="items-start"
+ onClick={() => {
+ navigator.clipboard.writeText(
+ `${window.location.origin}/dashboard/workspace/${workspace?.id}/project/${project.id}`,
+ );
+ toast.success("Project link copied to clipboard");
+ }}
+ >
+ <Forward className="text-muted-foreground" />
+ <span>Share Project</span>
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ className="items-start text-destructive"
+ onClick={() => {
+ setIsDeleteProjectModalOpen(true);
+ }}
+ >
+ <Trash2 className="text-destructive" />
+ <span>Delete Project</span>
+ <AlertDialog
+ open={isDeleteProjectModalOpen}
+ onOpenChange={setIsDeleteProjectModalOpen}
+ >
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>Delete Project?</AlertDialogTitle>
+ <AlertDialogDescription>
+ This will permanently remove the project and all its
+ data. You can't undo this action.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel>Cancel</AlertDialogCancel>
+ <AlertDialogAction
+ onClick={async () => {
+ await deleteProject({
+ id: project.id,
+ });
+ toast.success("Project deleted");
+ queryClient.invalidateQueries({
+ queryKey: ["projects"],
+ });
+ navigate({
+ to: "/dashboard/workspace/$workspaceId",
+ params: {
+ workspaceId: workspace?.id || "",
+ },
+ });
+ }}
+ className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
+ >
+ Delete Project
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </SidebarMenuItem>
+ );
+ })}
+ <SidebarMenuItem>
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <SidebarMenuButton
+ className="text-sidebar-foreground/70"
+ onClick={() => setIsCreateProjectModalOpen(true)}
+ >
+ <MoreHorizontal className="text-sidebar-foreground/70" />
+ <span>Add project</span>
+ </SidebarMenuButton>
+ </TooltipTrigger>
+ <TooltipContent>
+ <KbdSequence
+ keys={[shortcuts.project.prefix, shortcuts.project.create]}
+ className="ml-auto"
+ />
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ </SidebarMenuItem>
+ </SidebarMenu>
+ <CreateProjectModal
+ open={isCreateProjectModalOpen}
+ onClose={() => setIsCreateProjectModalOpen(false)}
+ />
+ </SidebarGroup>
+ );
+}
diff --git a/apps/web/src/components/nav-user.tsx b/apps/web/src/components/nav-user.tsx
new file mode 100644
index 000000000..710b6d674
--- /dev/null
+++ b/apps/web/src/components/nav-user.tsx
@@ -0,0 +1,131 @@
+"use client";
+
+import { ChevronsUpDown, LogOut } from "lucide-react";
+
+import useAuth from "@/components/providers/auth-provider/hooks/use-auth";
+import { SettingsMenu } from "@/components/settings-menu";
+import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuGroup,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu";
+import {
+ SidebarMenu,
+ SidebarMenuButton,
+ SidebarMenuItem,
+ useSidebar,
+} from "@/components/ui/sidebar";
+import useSignOut from "@/hooks/mutations/use-sign-out";
+import useProjectStore from "@/store/project";
+import useWorkspaceStore from "@/store/workspace";
+import { useQueryClient } from "@tanstack/react-query";
+import { useNavigate } from "@tanstack/react-router";
+import { toast } from "sonner";
+
+export function NavUser() {
+ const { isMobile } = useSidebar();
+ const { user, setUser } = useAuth();
+ const { mutateAsync: signOut, isPending } = useSignOut();
+ const queryClient = useQueryClient();
+ const navigate = useNavigate();
+ const { setProject } = useProjectStore();
+ const { setWorkspace } = useWorkspaceStore();
+
+ if (!user) {
+ return null;
+ }
+
+ const handleSignOut = async () => {
+ try {
+ await signOut();
+ queryClient.clear();
+ setUser(null);
+ setProject(undefined);
+ setWorkspace(undefined);
+ toast.success("Signed out successfully");
+ navigate({ to: "/auth/sign-in" });
+ } catch (error) {
+ toast.error(
+ error instanceof Error ? error.message : "Failed to sign out",
+ );
+ }
+ };
+
+ const initials = user.name
+ ? user.name
+ .split(" ")
+ .map((n) => n[0])
+ .join("")
+ .toUpperCase()
+ : user.email?.substring(0, 2).toUpperCase() || "U";
+
+ return (
+ <SidebarMenu>
+ <SidebarMenuItem>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <SidebarMenuButton
+ size="lg"
+ className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
+ >
+ <Avatar className="h-8 w-8 rounded-lg">
+ <AvatarImage src={""} alt={user.name || ""} />
+ <AvatarFallback className="rounded-lg">
+ {initials}
+ </AvatarFallback>
+ </Avatar>
+ <div className="grid flex-1 text-left text-sm leading-tight">
+ <span className="truncate font-medium">
+ {user.name || "User"}
+ </span>
+ <span className="truncate text-xs">{user.email}</span>
+ </div>
+ <ChevronsUpDown className="ml-auto size-4" />
+ </SidebarMenuButton>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent
+ className="w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg"
+ side={isMobile ? "bottom" : "right"}
+ align="end"
+ sideOffset={4}
+ >
+ <DropdownMenuLabel className="p-0 font-normal">
+ <div className="flex items-center gap-2 px-1 py-1.5 text-left text-sm">
+ <Avatar className="h-8 w-8 rounded-lg">
+ <AvatarImage src={""} alt={user.name || ""} />
+ <AvatarFallback className="rounded-lg">
+ {initials}
+ </AvatarFallback>
+ </Avatar>
+ <div className="grid flex-1 text-left text-sm leading-tight">
+ <span className="truncate font-medium">
+ {user.name || "User"}
+ </span>
+ <span className="truncate text-xs">{user.email}</span>
+ </div>
+ </div>
+ </DropdownMenuLabel>
+ <DropdownMenuSeparator />
+ <DropdownMenuGroup>
+ <SettingsMenu variant="user-dropdown" />
+ </DropdownMenuGroup>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ onClick={handleSignOut}
+ disabled={isPending}
+ className="cursor-pointer"
+ >
+ <LogOut />
+ {isPending ? "Signing out..." : "Log out"}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </SidebarMenuItem>
+ </SidebarMenu>
+ );
+}
diff --git a/apps/web/src/components/notification/notification-bell.tsx b/apps/web/src/components/notification/notification-bell.tsx
deleted file mode 100644
index b68db48a0..000000000
--- a/apps/web/src/components/notification/notification-bell.tsx
+++ /dev/null
@@ -1,156 +0,0 @@
-import { Button } from "@/components/ui/button";
-import useClearNotifications from "@/hooks/mutations/notification/use-clear-notifications";
-import useMarkAllNotificationsAsRead from "@/hooks/mutations/notification/use-mark-all-notifications-as-read";
-import useGetNotifications from "@/hooks/queries/notification/use-get-notifications";
-import { cn } from "@/lib/cn";
-import * as Popover from "@radix-ui/react-popover";
-import { AnimatePresence, motion } from "framer-motion";
-import { Bell, CheckCheck, Trash2 } from "lucide-react";
-import { useState } from "react";
-import { toast } from "sonner";
-import NotificationItem from "./notification-item";
-
-export default function NotificationBell() {
- const [isOpen, setIsOpen] = useState(false);
- const { data: notifications = [], isLoading } = useGetNotifications();
- const { mutate: markAllAsRead } = useMarkAllNotificationsAsRead();
- const { mutate: clearAllNotifications } = useClearNotifications();
-
- const unreadCount = notifications?.filter(
- (notification) => notification.isRead === false,
- ).length;
-
- const handleMarkAllAsRead = () => {
- markAllAsRead(undefined, {
- onSuccess: () => {
- toast.success("All notifications marked as read");
- },
- onError: (error) => {
- toast.error(
- error instanceof Error
- ? error.message
- : "Failed to mark notifications as read",
- );
- },
- });
- };
-
- const handleClearAllNotifications = () => {
- clearAllNotifications(undefined, {
- onSuccess: () => {
- toast.success("All notifications cleared");
- },
- onError: (error) => {
- toast.error(
- error instanceof Error
- ? error.message
- : "Failed to clear notifications",
- );
- },
- });
- };
-
- return (
- <Popover.Root open={isOpen} onOpenChange={setIsOpen}>
- <Popover.Trigger asChild>
- <Button
- variant="ghost"
- size="icon"
- className="relative h-8 w-8 rounded-full"
- >
- <Bell className="h-4 w-4 text-zinc-700 dark:text-zinc-300" />
- {unreadCount > 0 && (
- <span className="absolute -top-0.5 -right-0.5 flex h-3.5 w-3.5 items-center justify-center rounded-full bg-red-500 text-[8px] font-medium text-white">
- {unreadCount > 9 ? "9+" : unreadCount}
- </span>
- )}
- </Button>
- </Popover.Trigger>
- <Popover.Portal>
- <Popover.Content
- align="end"
- sideOffset={8}
- className="z-50 w-80 rounded-lg border border-zinc-200 bg-white p-0 shadow-lg dark:border-zinc-800 dark:bg-zinc-900"
- >
- <AnimatePresence>
- <motion.div
- initial={{ opacity: 0, y: -10 }}
- animate={{ opacity: 1, y: 0 }}
- exit={{ opacity: 0, y: -10 }}
- transition={{ duration: 0.2 }}
- >
- <div className="flex items-center justify-between border-b border-zinc-200 p-3 dark:border-zinc-800">
- <h3 className="text-sm font-medium text-zinc-900 dark:text-zinc-100">
- Notifications
- </h3>
- <div className="flex gap-2">
- {notifications.length > 0 && (
- <>
- <Button
- variant="ghost"
- size="sm"
- className="h-8 gap-1 text-xs text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300"
- onClick={handleClearAllNotifications}
- >
- <Trash2 className="h-3.5 w-3.5" />
- Clear all
- </Button>
- {unreadCount > 0 && (
- <Button
- variant="ghost"
- size="sm"
- className="h-8 gap-1 text-xs text-zinc-600 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-100"
- onClick={handleMarkAllAsRead}
- >
- <CheckCheck className="h-3.5 w-3.5" />
- Mark read
- </Button>
- )}
- </>
- )}
- </div>
- </div>
-
- <div
- className={cn(
- "max-h-[350px] overflow-y-auto scrollbar-thin scrollbar-thumb-zinc-300 dark:scrollbar-thumb-zinc-700",
- notifications.length === 0 && "overflow-hidden",
- )}
- >
- {isLoading ? (
- <div className="flex h-20 items-center justify-center">
- <div className="h-5 w-5 animate-spin rounded-full border-2 border-zinc-300 border-t-zinc-600 dark:border-zinc-700 dark:border-t-zinc-300" />
- </div>
- ) : notifications.length === 0 ? (
- <div className="flex flex-col items-center justify-center py-8 text-center">
- <div className="mb-3 rounded-full bg-zinc-100 p-3 dark:bg-zinc-800">
- <Bell className="h-5 w-5 text-zinc-500 dark:text-zinc-400" />
- </div>
- <p className="mb-1 text-sm font-medium text-zinc-900 dark:text-zinc-100">
- No notifications
- </p>
- <p className="text-xs text-zinc-500 dark:text-zinc-400">
- You're all caught up!
- </p>
- </div>
- ) : (
- <div className="divide-y divide-zinc-200 dark:divide-zinc-800">
- {notifications &&
- notifications.length > 0 &&
- notifications.map((notification) => (
- <NotificationItem
- key={notification.id}
- notification={notification}
- onClose={() => setIsOpen(false)}
- />
- ))}
- </div>
- )}
- </div>
- </motion.div>
- </AnimatePresence>
- </Popover.Content>
- </Popover.Portal>
- </Popover.Root>
- );
-}
diff --git a/apps/web/src/components/notification/notification-dropdown.tsx b/apps/web/src/components/notification/notification-dropdown.tsx
new file mode 100644
index 000000000..584b889ca
--- /dev/null
+++ b/apps/web/src/components/notification/notification-dropdown.tsx
@@ -0,0 +1,210 @@
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+} from "@/components/ui/alert-dialog";
+import { Badge } from "@/components/ui/badge";
+import { Button } from "@/components/ui/button";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu";
+import { KbdSequence } from "@/components/ui/kbd";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
+import { shortcuts } from "@/constants/shortcuts";
+import useClearNotifications from "@/hooks/mutations/notification/use-clear-notifications";
+import useMarkAllNotificationsAsRead from "@/hooks/mutations/notification/use-mark-all-notifications-as-read";
+import useGetNotifications from "@/hooks/queries/notification/use-get-notifications";
+import { useRegisterShortcuts } from "@/hooks/use-keyboard-shortcuts";
+import { cn } from "@/lib/cn";
+import { formatDistanceToNow } from "date-fns";
+import { Bell } from "lucide-react";
+import { forwardRef, useImperativeHandle, useState } from "react";
+
+export interface NotificationDropdownRef {
+ toggle: () => void;
+}
+
+const NotificationDropdown = forwardRef<NotificationDropdownRef>(
+ (_props, ref) => {
+ const { data: notifications } = useGetNotifications();
+ const [isOpen, setIsOpen] = useState(false);
+ const [showClearDialog, setShowClearDialog] = useState(false);
+
+ const { mutate: markAllAsRead } = useMarkAllNotificationsAsRead();
+ const { mutate: clearAll } = useClearNotifications();
+
+ const unreadNotifications = notifications?.filter((n) => !n.isRead) || [];
+ const hasNotifications = notifications && notifications.length > 0;
+
+ useImperativeHandle(ref, () => ({
+ toggle: () => setIsOpen(!isOpen),
+ }));
+
+ const handleClearAll = () => {
+ clearAll();
+ setShowClearDialog(false);
+ };
+
+ useRegisterShortcuts({
+ sequentialShortcuts: {
+ [shortcuts.notification.prefix]: {
+ [shortcuts.notification.open]: () => setIsOpen(!isOpen),
+ },
+ },
+ });
+
+ return (
+ <>
+ <DropdownMenu open={isOpen} onOpenChange={setIsOpen}>
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <DropdownMenuTrigger asChild>
+ <Button
+ variant="ghost"
+ size="sm"
+ className="relative h-9 w-9 p-0"
+ >
+ <Bell className="h-4 w-4" />
+ {unreadNotifications.length > 0 && (
+ <span className="absolute top-0 right-0 h-2 w-2 bg-red-500 rounded-full" />
+ )}
+ <span className="sr-only">Notifications</span>
+ </Button>
+ </DropdownMenuTrigger>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p className="flex items-center gap-2">
+ Notifications
+ <KbdSequence
+ keys={[
+ shortcuts.notification.prefix,
+ shortcuts.notification.open,
+ ]}
+ />
+ </p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+
+ <DropdownMenuContent align="end" className="w-80 p-0">
+ <div className="flex items-center justify-between px-3 py-2 border-b">
+ <h3 className="font-medium text-sm">Notifications</h3>
+ {unreadNotifications.length > 0 && (
+ <div className="flex items-center gap-2">
+ <Badge variant="secondary" className="text-xs">
+ {unreadNotifications.length} new
+ </Badge>
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => markAllAsRead()}
+ className="text-xs h-6 px-2"
+ >
+ Mark all read
+ </Button>
+ </div>
+ )}
+ </div>
+
+ <div className="relative max-h-96 overflow-y-auto">
+ {!hasNotifications ? (
+ <div className="p-6 text-center text-sm text-muted-foreground">
+ <Bell className="mx-auto h-12 w-12 opacity-50 mb-2" />
+ <p>No notifications yet</p>
+ <p className="text-xs mt-1">
+ You'll see updates and activity here.
+ </p>
+ </div>
+ ) : (
+ <>
+ {notifications.map((notification) => (
+ <div
+ key={notification.id}
+ className={cn(
+ "px-3 py-3 border-b border-border/50 hover:bg-accent/50 transition-colors",
+ !notification.isRead && "bg-accent/20",
+ )}
+ >
+ <div className="flex items-start gap-3">
+ <div className="flex-1 min-w-0">
+ <div className="flex items-center gap-2 mb-1">
+ <h4 className="text-sm font-medium text-foreground">
+ {notification.title}
+ </h4>
+ {!notification.isRead && (
+ <div className="w-2 h-2 bg-primary rounded-full flex-shrink-0" />
+ )}
+ </div>
+ {notification.content && (
+ <p className="text-xs text-muted-foreground line-clamp-2">
+ {notification.content}
+ </p>
+ )}
+ <p className="text-xs text-muted-foreground mt-2">
+ {formatDistanceToNow(notification.createdAt, {
+ addSuffix: true,
+ })}
+ </p>
+ </div>
+ </div>
+ </div>
+ ))}
+ </>
+ )}
+ </div>
+ {hasNotifications && (
+ <div className="border-t border-border p-2">
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => setShowClearDialog(true)}
+ className="w-full text-xs text-destructive hover:text-destructive hover:bg-destructive/10"
+ >
+ Clear all notifications
+ </Button>
+ </div>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+
+ <AlertDialog open={showClearDialog} onOpenChange={setShowClearDialog}>
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>Clear all notifications?</AlertDialogTitle>
+ <AlertDialogDescription>
+ This will permanently remove all notifications. You can't undo
+ this action.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel>Cancel</AlertDialogCancel>
+ <AlertDialogAction
+ onClick={handleClearAll}
+ className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
+ >
+ Clear all
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+ </>
+ );
+ },
+);
+
+NotificationDropdown.displayName = "NotificationDropdown";
+
+export default NotificationDropdown;
diff --git a/apps/web/src/components/notification/notification-item.tsx b/apps/web/src/components/notification/notification-item.tsx
deleted file mode 100644
index 60c751bce..000000000
--- a/apps/web/src/components/notification/notification-item.tsx
+++ /dev/null
@@ -1,124 +0,0 @@
-import useMarkNotificationAsRead from "@/hooks/mutations/notification/use-mark-notification-as-read";
-import { cn } from "@/lib/cn";
-import type { Notification } from "@/types/notification";
-import { useNavigate } from "@tanstack/react-router";
-import { formatDistanceToNow } from "date-fns";
-import {
- AlertCircle,
- CheckCircle2,
- FileText,
- FolderKanban,
- Info,
- MessageSquare,
- Users,
-} from "lucide-react";
-
-interface NotificationItemProps {
- notification: Notification;
- onClose?: () => void;
-}
-
-export default function NotificationItem({
- notification,
- onClose,
-}: NotificationItemProps) {
- const navigate = useNavigate();
- const { mutate: markAsRead } = useMarkNotificationAsRead();
-
- const handleClick = () => {
- if (!notification.isRead) {
- markAsRead(notification.id);
- }
-
- if (notification.resourceId && notification.resourceType) {
- if (notification.resourceType === "task") {
- onClose?.();
- } else if (notification.resourceType === "workspace") {
- navigate({
- to: "/dashboard/workspace/$workspaceId",
- params: { workspaceId: notification.resourceId },
- });
- onClose?.();
- }
- }
- };
-
- const getIcon = () => {
- switch (notification.type) {
- case "task":
- return (
- <FileText className="h-4 w-4 text-blue-500 dark:text-blue-400" />
- );
- case "workspace":
- return (
- <FolderKanban className="h-4 w-4 text-purple-500 dark:text-purple-400" />
- );
- case "project":
- return <Users className="h-4 w-4 text-green-500 dark:text-green-400" />;
- case "comment":
- return (
- <MessageSquare className="h-4 w-4 text-yellow-500 dark:text-yellow-400" />
- );
- case "success":
- return (
- <CheckCircle2 className="h-4 w-4 text-green-500 dark:text-green-400" />
- );
- case "error":
- return (
- <AlertCircle className="h-4 w-4 text-red-500 dark:text-red-400" />
- );
- case "warning":
- return (
- <AlertCircle className="h-4 w-4 text-yellow-500 dark:text-yellow-400" />
- );
- default:
- return <Info className="h-4 w-4 text-blue-500 dark:text-blue-400" />;
- }
- };
-
- return (
- <div
- className={cn(
- "flex cursor-pointer gap-3 p-3 hover:bg-zinc-50 dark:hover:bg-zinc-800/50",
- !notification.isRead && "bg-blue-50/50 dark:bg-blue-900/10",
- )}
- onClick={handleClick}
- onKeyDown={(e) => {
- if (e.key === "Enter" || e.key === " ") {
- handleClick();
- }
- }}
- >
- <div
- className={cn(
- "mt-0.5 flex h-8 w-8 items-center justify-center rounded-full bg-zinc-100 dark:bg-zinc-800",
- !notification.isRead && "bg-blue-100 dark:bg-blue-900/20",
- )}
- >
- {getIcon()}
- </div>
- <div className="flex-1 space-y-1">
- <div className="flex items-start justify-between">
- <p
- className={cn(
- "text-sm text-zinc-900 dark:text-zinc-100",
- !notification.isRead && "font-medium",
- )}
- >
- {notification.title}
- </p>
- <span className="ml-2 whitespace-nowrap text-xs text-zinc-500 dark:text-zinc-400">
- {formatDistanceToNow(new Date(notification.createdAt), {
- addSuffix: true,
- })}
- </span>
- </div>
- {notification.content && (
- <p className="text-xs text-zinc-500 dark:text-zinc-400">
- {notification.content}
- </p>
- )}
- </div>
- </div>
- );
-}
diff --git a/apps/web/src/components/project/empty-state.tsx b/apps/web/src/components/project/empty-state.tsx
deleted file mode 100644
index 977dc65cc..000000000
--- a/apps/web/src/components/project/empty-state.tsx
+++ /dev/null
@@ -1,85 +0,0 @@
-import { motion } from "framer-motion";
-import { LayoutGrid, Plus, Sparkles } from "lucide-react";
-import { useState } from "react";
-import CreateProjectModal from "../shared/modals/create-project-modal";
-
-function EmptyProjectState() {
- const [isCreateProjectOpen, setIsCreateProjectOpen] = useState(false);
-
- return (
- <div className="flex w-full items-center justify-center h-screen flex-col bg-zinc-50 dark:bg-zinc-950">
- <motion.div
- className="max-w-md w-full px-8"
- initial={{ opacity: 0, y: 20 }}
- animate={{ opacity: 1, y: 0 }}
- transition={{ duration: 0.3 }}
- >
- <div className="text-center mb-8">
- <div className="relative w-16 h-16 mb-4 mx-auto">
- <motion.div
- className="w-16 h-16 rounded-2xl bg-indigo-50 dark:bg-indigo-500/10 flex items-center justify-center"
- animate={{ rotate: 360 }}
- transition={{
- duration: 20,
- repeat: Number.POSITIVE_INFINITY,
- ease: "linear",
- }}
- >
- <LayoutGrid className="w-8 h-8 text-indigo-500 dark:text-indigo-400" />
- </motion.div>
- <motion.div
- className="absolute -top-2 -right-2"
- initial={{ scale: 0.5, opacity: 0 }}
- animate={{ scale: 1, opacity: 1 }}
- transition={{ delay: 0.2 }}
- >
- <Sparkles className="w-5 h-5 text-indigo-400 dark:text-indigo-300" />
- </motion.div>
- </div>
- <h1 className="text-2xl font-semibold text-zinc-900 dark:text-zinc-100 mb-3">
- Create Your First Project
- </h1>
- <p className="text-zinc-500 dark:text-zinc-400 text-center max-w-md mb-8">
- Start organizing your tasks and collaborating with your team by
- creating your first project.
- </p>
- </div>
-
- <div className="space-y-4">
- <motion.div
- className="p-4 rounded-lg border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-900 hover:border-zinc-300 dark:hover:border-zinc-700 transition-colors"
- whileHover={{ scale: 1.02 }}
- transition={{ type: "spring", stiffness: 300 }}
- >
- <div className="flex items-center gap-3 mb-3">
- <div className="w-10 h-10 rounded-full bg-indigo-50 dark:bg-indigo-500/10 flex items-center justify-center">
- <Plus className="w-5 h-5 text-indigo-500 dark:text-indigo-400" />
- </div>
- <div className="flex-1">
- <h3 className="text-sm font-medium text-zinc-900 dark:text-zinc-100">
- New Project
- </h3>
- <p className="text-xs text-zinc-500 dark:text-zinc-400">
- Create a project to organize your tasks
- </p>
- </div>
- </div>
- <button
- type="button"
- onClick={() => setIsCreateProjectOpen(true)}
- className="w-full px-4 py-2 bg-indigo-50 hover:bg-indigo-100 dark:bg-indigo-500/10 dark:hover:bg-indigo-500/20 text-indigo-600 dark:text-indigo-400 rounded-lg transition-colors font-medium inline-flex items-center justify-center gap-2 text-sm"
- >
- Create Project
- </button>
- </motion.div>
- </div>
- </motion.div>
- <CreateProjectModal
- open={isCreateProjectOpen}
- onClose={() => setIsCreateProjectOpen(false)}
- />
- </div>
- );
-}
-
-export default EmptyProjectState;
diff --git a/apps/web/src/components/project/github-integration-settings.tsx b/apps/web/src/components/project/github-integration-settings.tsx
index d8234dd0a..4be0d32be 100644
--- a/apps/web/src/components/project/github-integration-settings.tsx
+++ b/apps/web/src/components/project/github-integration-settings.tsx
@@ -254,7 +254,6 @@ export function GitHubIntegrationSettings({
return (
<div className="space-y-6">
- {/* Header */}
<div className="flex items-start gap-4">
<div className="p-2 bg-gray-100 dark:bg-gray-800 rounded-lg">
<Github className="w-6 h-6" />
@@ -268,7 +267,6 @@ export function GitHubIntegrationSettings({
</div>
</div>
- {/* Status Card */}
<Card>
<CardHeader className="pb-3">
<div className="flex items-center justify-between">
@@ -334,7 +332,6 @@ export function GitHubIntegrationSettings({
</CardContent>
</Card>
- {/* Configuration Card */}
<Card>
<CardHeader>
<CardTitle className="text-base flex items-center gap-2">
@@ -451,7 +448,6 @@ export function GitHubIntegrationSettings({
</form>
</Form>
- {/* Verification Results */}
{verificationResult && (
<div className="mt-4">
<div
@@ -538,7 +534,6 @@ export function GitHubIntegrationSettings({
</CardContent>
</Card>
- {/* Actions Card */}
{isConnected && (
<Card>
<CardHeader>
diff --git a/apps/web/src/components/project/repository-browser-modal.tsx b/apps/web/src/components/project/repository-browser-modal.tsx
index c882f0260..16014a91f 100644
--- a/apps/web/src/components/project/repository-browser-modal.tsx
+++ b/apps/web/src/components/project/repository-browser-modal.tsx
@@ -188,7 +188,6 @@ export function RepositoryBrowserModal({
</div>
)}
- {/* Repository list */}
{filteredRepositories.length > 0 && (
<div className="p-4 space-y-2">
{filteredRepositories.map((repository) => (
@@ -276,7 +275,6 @@ export function RepositoryBrowserModal({
</div>
)}
- {/* No filtered results */}
{filteredRepositories.length === 0 &&
data.repositories.length > 0 && (
<div className="text-center py-12">
@@ -294,7 +292,6 @@ export function RepositoryBrowserModal({
)}
</div>
- {/* Footer */}
{data && data.installations.length > 0 && (
<div className="flex-shrink-0 border-t border-zinc-200 dark:border-zinc-800 p-4">
<div className="flex items-center justify-between text-sm text-zinc-600 dark:text-zinc-400">
diff --git a/apps/web/src/components/project/select-project-state.tsx b/apps/web/src/components/project/select-project-state.tsx
deleted file mode 100644
index 12da6501c..000000000
--- a/apps/web/src/components/project/select-project-state.tsx
+++ /dev/null
@@ -1,52 +0,0 @@
-import { motion } from "framer-motion";
-import { ArrowLeft, LayoutGrid } from "lucide-react";
-
-function SelectProjectState() {
- return (
- <div className="flex w-full items-center justify-center h-screen flex-col bg-zinc-50 dark:bg-zinc-950">
- <motion.div
- className="max-w-md w-full px-8"
- initial={{ opacity: 0, y: 20 }}
- animate={{ opacity: 1, y: 0 }}
- transition={{ duration: 0.3 }}
- >
- <div className="text-center mb-8">
- <div className="relative w-16 h-16 mb-4 mx-auto">
- <motion.div
- className="w-16 h-16 rounded-2xl bg-indigo-50 dark:bg-indigo-500/10 flex items-center justify-center"
- animate={{ x: [0, 10, 0] }}
- transition={{
- duration: 2,
- repeat: Number.POSITIVE_INFINITY,
- ease: "easeInOut",
- }}
- >
- <LayoutGrid className="w-8 h-8 text-indigo-500 dark:text-indigo-400" />
- </motion.div>
- <motion.div
- className="absolute -left-4 top-1/2 -translate-y-1/2"
- animate={{ x: [0, 5, 0] }}
- transition={{
- duration: 2,
- repeat: Number.POSITIVE_INFINITY,
- ease: "easeInOut",
- delay: 0.5,
- }}
- >
- <ArrowLeft className="w-5 h-5 text-indigo-400 dark:text-indigo-300" />
- </motion.div>
- </div>
- <h1 className="text-2xl font-semibold text-zinc-900 dark:text-zinc-100 mb-3">
- Select a Project
- </h1>
- <p className="text-zinc-500 dark:text-zinc-400 text-center max-w-md">
- Choose a project from the sidebar to view its kanban board and start
- managing your tasks.
- </p>
- </div>
- </motion.div>
- </div>
- );
-}
-
-export default SelectProjectState;
diff --git a/apps/web/src/components/providers/theme-provider/hooks/use-theme.tsx b/apps/web/src/components/providers/theme-provider/hooks/use-theme.tsx
deleted file mode 100644
index 1010a9a26..000000000
--- a/apps/web/src/components/providers/theme-provider/hooks/use-theme.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import { create } from "zustand";
-import { persist } from "zustand/middleware";
-
-interface ThemeStore {
- theme: "light" | "dark" | "system";
- setTheme: (theme: "light" | "dark" | "system") => void;
-}
-
-const useTheme = create<ThemeStore>()(
- persist(
- (set) => ({
- theme: "dark",
- setTheme: (theme: "light" | "dark" | "system") => set({ theme }),
- }),
- { name: "theme-storage" },
- ),
-);
-
-export default useTheme;
diff --git a/apps/web/src/components/providers/theme-provider/index.tsx b/apps/web/src/components/providers/theme-provider/index.tsx
index daa326606..65032a33c 100644
--- a/apps/web/src/components/providers/theme-provider/index.tsx
+++ b/apps/web/src/components/providers/theme-provider/index.tsx
@@ -1,8 +1,8 @@
+import { useUserPreferencesStore } from "@/store/user-preferences";
import { useEffect } from "react";
-import useTheme from "./hooks/use-theme";
export function ThemeProvider({ children }: { children: React.ReactNode }) {
- const { theme } = useTheme();
+ const { theme } = useUserPreferencesStore();
useEffect(() => {
const root = document.documentElement;
diff --git a/apps/web/src/components/public-project/task-detail-modal.tsx b/apps/web/src/components/public-project/task-detail-modal.tsx
index 03d6f9861..b3f34848e 100644
--- a/apps/web/src/components/public-project/task-detail-modal.tsx
+++ b/apps/web/src/components/public-project/task-detail-modal.tsx
@@ -28,7 +28,6 @@ export function PublicTaskDetailModal({
<Dialog.Overlay className="fixed inset-0 bg-black/60 backdrop-blur-sm z-40" />
<Dialog.Content className="fixed z-50 left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-full max-w-2xl max-h-[90vh] overflow-hidden">
<div className="bg-white dark:bg-zinc-900 rounded-xl shadow-2xl border border-zinc-200 dark:border-zinc-700/50 flex flex-col h-full max-h-[90vh]">
- {/* Header */}
<div className="flex items-center justify-between p-6 border-b border-zinc-200 dark:border-zinc-800/50 flex-shrink-0">
<div className="flex items-center gap-3">
<div className="text-sm text-zinc-600 dark:text-zinc-400 font-mono font-medium">
@@ -44,17 +43,14 @@ export function PublicTaskDetailModal({
</Dialog.Close>
</div>
- {/* Content */}
<div className="flex-1 overflow-y-auto">
<div className="p-6 space-y-6">
- {/* Title */}
<div>
<h1 className="text-xl font-semibold text-zinc-900 dark:text-zinc-100 leading-relaxed">
{task.title}
</h1>
</div>
- {/* Meta information */}
<div className="flex flex-wrap items-center gap-4">
{task.priority && (
<div
@@ -96,7 +92,6 @@ export function PublicTaskDetailModal({
)}
</div>
- {/* Description */}
{task.description && (
<div className="space-y-3">
<h3 className="text-sm font-semibold text-zinc-900 dark:text-zinc-100 uppercase tracking-wide">
@@ -106,7 +101,6 @@ export function PublicTaskDetailModal({
</div>
)}
- {/* Task Dates */}
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4 pt-4 border-t border-zinc-200 dark:border-zinc-800">
<div className="space-y-1">
<div className="text-xs font-semibold text-zinc-600 dark:text-zinc-400 uppercase tracking-wide">
diff --git a/apps/web/src/components/public-project/theme-toggle.tsx b/apps/web/src/components/public-project/theme-toggle.tsx
index 299c2b720..5a0b195ec 100644
--- a/apps/web/src/components/public-project/theme-toggle.tsx
+++ b/apps/web/src/components/public-project/theme-toggle.tsx
@@ -1,33 +1,26 @@
import { Button } from "@/components/ui/button";
+import { getClickCoordinates } from "@/lib/get-click-coordinates";
+import { useUserPreferencesStore } from "@/store/user-preferences";
import { Moon, Sun } from "lucide-react";
-import { useEffect, useState } from "react";
+import type { MouseEvent } from "react";
export function ThemeToggle() {
- const [isDark, setIsDark] = useState(false);
+ const { theme, setTheme } = useUserPreferencesStore();
- useEffect(() => {
- const savedTheme = localStorage.getItem("theme");
- const systemPrefersDark = window.matchMedia(
- "(prefers-color-scheme: dark)",
- ).matches;
- const shouldBeDark =
- savedTheme === "dark" || (!savedTheme && systemPrefersDark);
-
- setIsDark(shouldBeDark);
- document.documentElement.classList.toggle("dark", shouldBeDark);
- }, []);
-
- const toggleTheme = () => {
- const newTheme = !isDark;
- setIsDark(newTheme);
- localStorage.setItem("theme", newTheme ? "dark" : "light");
- document.documentElement.classList.toggle("dark", newTheme);
+ const toggleTheme = (event: MouseEvent<HTMLButtonElement>) => {
+ const newTheme = theme === "dark" ? "light" : "dark";
+ const coordinates = getClickCoordinates(event);
+ setTheme(newTheme, coordinates);
};
return (
<Button variant="outline" size="sm" onClick={toggleTheme} className="gap-2">
- {isDark ? <Sun className="w-4 h-4" /> : <Moon className="w-4 h-4" />}
- {isDark ? "Light" : "Dark"}
+ {theme === "dark" ? (
+ <Sun className="w-4 h-4" />
+ ) : (
+ <Moon className="w-4 h-4" />
+ )}
+ {theme === "dark" ? "Light" : "Dark"}
</Button>
);
}
diff --git a/apps/web/src/components/search-command-menu/index.tsx b/apps/web/src/components/search-command-menu/index.tsx
new file mode 100644
index 000000000..31f6e569a
--- /dev/null
+++ b/apps/web/src/components/search-command-menu/index.tsx
@@ -0,0 +1,238 @@
+import {
+ CommandDialog,
+ CommandEmpty,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
+ CommandList,
+} from "@/components/ui/command";
+import { KbdSequence } from "@/components/ui/kbd";
+import { shortcuts } from "@/constants/shortcuts";
+import useGlobalSearch from "@/hooks/queries/search/use-global-search";
+import { useRegisterShortcuts } from "@/hooks/use-keyboard-shortcuts";
+import useWorkspaceStore from "@/store/workspace";
+import { useNavigate } from "@tanstack/react-router";
+import {
+ FileText,
+ FolderKanban,
+ Hash,
+ MessageSquare,
+ Search,
+ Users,
+ Zap,
+} from "lucide-react";
+import { useEffect, useState } from "react";
+
+type SearchResultItem = {
+ id: string;
+ title: string;
+ description?: string;
+ content?: string;
+ type: "task" | "project" | "workspace" | "comment" | "activity";
+ projectId?: string;
+ workspaceId?: string;
+ taskNumber?: number;
+ projectSlug?: string;
+ priority?: string;
+ status?: string;
+};
+
+type SearchCommandMenuProps = {
+ open: boolean;
+ setOpen: (open: boolean) => void;
+};
+
+function SearchCommandMenu({ open, setOpen }: SearchCommandMenuProps) {
+ const [query, setQuery] = useState("");
+ const { workspace } = useWorkspaceStore();
+ const navigate = useNavigate();
+
+ const { data: searchResults } = useGlobalSearch({
+ q: query,
+ type: "all",
+ workspaceId: workspace?.id,
+ limit: 20,
+ });
+
+ useRegisterShortcuts({
+ shortcuts: {
+ [shortcuts.search.prefix]: () => {
+ setOpen(true);
+ },
+ },
+ });
+
+ useEffect(() => {
+ if (!open) {
+ setQuery("");
+ }
+ }, [open]);
+
+ const handleSelect = (item: SearchResultItem) => {
+ setOpen(false);
+ setQuery("");
+
+ switch (item.type) {
+ case "task":
+ if (item.projectId && item.id && workspace?.id) {
+ navigate({
+ to: "/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId",
+ params: {
+ workspaceId: workspace.id,
+ projectId: item.projectId,
+ taskId: item.id,
+ },
+ });
+ }
+ break;
+ case "project":
+ if (item.id && workspace?.id) {
+ navigate({
+ to: "/dashboard/workspace/$workspaceId/project/$projectId/board",
+ params: {
+ workspaceId: workspace.id,
+ projectId: item.id,
+ },
+ });
+ }
+ break;
+ case "workspace":
+ if (item.id) {
+ navigate({
+ to: "/dashboard/workspace/$workspaceId",
+ params: {
+ workspaceId: item.id,
+ },
+ });
+ }
+ break;
+ case "comment":
+ case "activity":
+ if (item.projectId && item.id && workspace?.id) {
+ navigate({
+ to: "/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId",
+ params: {
+ workspaceId: workspace.id,
+ projectId: item.projectId,
+ taskId: item.id,
+ },
+ });
+ }
+ break;
+ }
+ };
+
+ const getItemIcon = (type: string) => {
+ switch (type) {
+ case "task":
+ return Hash;
+ case "project":
+ return FolderKanban;
+ case "workspace":
+ return Users;
+ case "comment":
+ return MessageSquare;
+ case "activity":
+ return Zap;
+ default:
+ return FileText;
+ }
+ };
+
+ const groupedResults = searchResults?.results?.reduce(
+ (acc: Record<string, SearchResultItem[]>, item: SearchResultItem) => {
+ if (!acc[item.type]) {
+ acc[item.type] = [];
+ }
+ acc[item.type].push(item);
+ return acc;
+ },
+ {} as Record<string, SearchResultItem[]>,
+ );
+
+ const getGroupLabel = (type: string) => {
+ switch (type) {
+ case "task":
+ return "Tasks";
+ case "project":
+ return "Projects";
+ case "workspace":
+ return "Workspaces";
+ case "comment":
+ return "Comments";
+ case "activity":
+ return "Activities";
+ default:
+ return "Results";
+ }
+ };
+
+ return (
+ <CommandDialog
+ open={open}
+ onOpenChange={setOpen}
+ title="Search"
+ description="Search for tasks, projects, comments, and more"
+ >
+ <CommandInput
+ placeholder="Search tasks, projects, comments..."
+ value={query}
+ onValueChange={setQuery}
+ />
+ <CommandList>
+ {query.length <= 2 && (
+ <CommandEmpty>
+ <div className="text-center py-6">
+ <Search className="h-8 w-8 mx-auto mb-2 text-muted-foreground" />
+ <p className="text-sm text-muted-foreground">
+ Type at least 3 characters to search
+ </p>
+ <div className="mt-2 text-xs text-muted-foreground">
+ Press <KbdSequence keys={["/"]} className="inline-flex" /> to
+ focus
+ </div>
+ </div>
+ </CommandEmpty>
+ )}
+
+ {groupedResults &&
+ Object.keys(groupedResults).length > 0 &&
+ Object.entries(groupedResults).map(([type, items]) =>
+ items.length > 0 ? (
+ <CommandGroup key={type} heading={getGroupLabel(type)}>
+ {items.map((item) => {
+ const Icon = getItemIcon(item.type);
+ return (
+ <CommandItem
+ key={`${item.type}-${item.id}`}
+ onSelect={() => handleSelect(item)}
+ className="flex items-start gap-3 py-3"
+ value={`${item.title} ${item.description || ""} ${item.type} ${item.id}`}
+ aria-label={`${item.type}: ${item.title}`}
+ >
+ <Icon
+ className="h-4 w-4 mt-0.5 text-muted-foreground flex-shrink-0"
+ aria-hidden="true"
+ />
+ <div className="flex-1 min-w-0">
+ <div className="font-medium text-sm truncate">
+ {item.title}
+ </div>
+ {item.description && (
+ <div className="text-xs text-muted-foreground truncate mt-1">
+ {item.description}
+ </div>
+ )}
+ </div>
+ </CommandItem>
+ );
+ })}
+ </CommandGroup>
+ ) : null,
+ )}
+ </CommandList>
+ </CommandDialog>
+ );
+}
+
+export default SearchCommandMenu;
diff --git a/apps/web/src/components/settings-layout.tsx b/apps/web/src/components/settings-layout.tsx
new file mode 100644
index 000000000..b5020b1cc
--- /dev/null
+++ b/apps/web/src/components/settings-layout.tsx
@@ -0,0 +1,187 @@
+import Layout from "@/components/common/layout";
+import {
+ Breadcrumb,
+ BreadcrumbItem,
+ BreadcrumbLink,
+ BreadcrumbList,
+ BreadcrumbSeparator,
+} from "@/components/ui/breadcrumb";
+import { Button } from "@/components/ui/button";
+import { KbdSequence } from "@/components/ui/kbd";
+import { Separator } from "@/components/ui/separator";
+import { SidebarTrigger } from "@/components/ui/sidebar";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
+import { shortcuts } from "@/constants/shortcuts";
+import { cn } from "@/lib/cn";
+import { useNavigate } from "@tanstack/react-router";
+import { AlertTriangle, ArrowLeft } from "lucide-react";
+import type { ReactNode } from "react";
+
+interface SettingsLayoutProps {
+ title: string;
+ description?: string;
+ icon?: ReactNode;
+ backPath?: string;
+ backLabel?: string;
+ children: ReactNode;
+ className?: string;
+}
+
+export function SettingsLayout({
+ title,
+ description,
+ backPath,
+ backLabel = "Back",
+ children,
+ className,
+}: SettingsLayoutProps) {
+ const navigate = useNavigate();
+
+ const handleBack = () => {
+ if (backPath) {
+ navigate({ to: backPath });
+ } else {
+ window.history.back();
+ }
+ };
+
+ return (
+ <Layout>
+ <Layout.Header>
+ <div className="flex items-center justify-between w-full">
+ <div className="flex items-center gap-1 w-full">
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <SidebarTrigger className="-ml-1 h-6 w-6" />
+ </TooltipTrigger>
+ <TooltipContent>
+ <p className="flex items-center gap-2 text-xs">
+ Toggle sidebar
+ <KbdSequence
+ keys={[
+ shortcuts.sidebar.prefix,
+ shortcuts.sidebar.toggle,
+ ]}
+ />
+ </p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ <Separator
+ orientation="vertical"
+ className="mx-1.5 data-[orientation=vertical]:h-2.5"
+ />
+ <Breadcrumb className="flex items-center gap-1 text-xs w-full">
+ <BreadcrumbList>
+ <BreadcrumbItem>
+ <BreadcrumbLink href="/dashboard/settings">
+ <h1 className="text-xs text-card-foreground">Settings</h1>
+ </BreadcrumbLink>
+ </BreadcrumbItem>
+ <BreadcrumbSeparator />
+ <BreadcrumbItem>
+ <h1 className="text-xs text-card-foreground">{title}</h1>
+ </BreadcrumbItem>
+ </BreadcrumbList>
+ </Breadcrumb>
+ </div>
+ <div className="flex items-center gap-1.5">
+ {backPath && (
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={handleBack}
+ className="gap-1.5 text-xs"
+ >
+ <ArrowLeft className="w-3 h-3" />
+ {backLabel}
+ </Button>
+ )}
+ </div>
+ </div>
+ </Layout.Header>
+ <Layout.Content>
+ <div className={cn("max-w-4xl mx-auto space-y-8 py-6", className)}>
+ {description && (
+ <div className="space-y-1">
+ <p className="text-sm text-muted-foreground">{description}</p>
+ </div>
+ )}
+ {children}
+ </div>
+ </Layout.Content>
+ </Layout>
+ );
+}
+
+interface SettingsSectionProps {
+ title: string;
+ description?: string;
+ icon?: ReactNode;
+ children: ReactNode;
+ className?: string;
+}
+
+export function SettingsSection({
+ title,
+ description,
+ icon,
+ children,
+ className,
+}: SettingsSectionProps) {
+ return (
+ <div className={cn("space-y-6", className)}>
+ <div className="flex items-center gap-3">
+ {icon && (
+ <div className="flex h-8 w-8 items-center justify-center rounded-md border bg-background">
+ {icon}
+ </div>
+ )}
+ <div className="space-y-1">
+ <h2 className="text-lg font-semibold tracking-tight">{title}</h2>
+ {description && (
+ <p className="text-sm text-muted-foreground">{description}</p>
+ )}
+ </div>
+ </div>
+ <div className="space-y-4">{children}</div>
+ </div>
+ );
+}
+
+interface DangerZoneSectionProps {
+ title: string;
+ description: string;
+ children: ReactNode;
+}
+
+export function DangerZoneSection({
+ title,
+ description,
+ children,
+}: DangerZoneSectionProps) {
+ return (
+ <div className="space-y-6">
+ <div className="flex items-center gap-3">
+ <div className="flex h-8 w-8 items-center justify-center rounded-md border border-destructive/20 bg-destructive/10">
+ <AlertTriangle className="h-4 w-4 text-destructive" />
+ </div>
+ <div className="space-y-1">
+ <h2 className="text-lg font-semibold tracking-tight text-destructive">
+ {title}
+ </h2>
+ <p className="text-sm text-muted-foreground">{description}</p>
+ </div>
+ </div>
+ <div className="rounded-lg border border-destructive/20 bg-destructive/5 p-6">
+ {children}
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/src/components/settings-menu.tsx b/apps/web/src/components/settings-menu.tsx
new file mode 100644
index 000000000..09d9af30a
--- /dev/null
+++ b/apps/web/src/components/settings-menu.tsx
@@ -0,0 +1,148 @@
+import { Button } from "@/components/ui/button";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu";
+import { cn } from "@/lib/cn";
+import useProjectStore from "@/store/project";
+import useWorkspaceStore from "@/store/workspace";
+import { useNavigate } from "@tanstack/react-router";
+import {
+ Building2,
+ ChevronDown,
+ FolderOpen,
+ Settings,
+ User,
+} from "lucide-react";
+
+interface SettingsMenuProps {
+ variant?: "nav" | "user-dropdown";
+ className?: string;
+}
+
+export function SettingsMenu({
+ variant = "nav",
+ className,
+}: SettingsMenuProps) {
+ const { workspace } = useWorkspaceStore();
+ const { project } = useProjectStore();
+ const navigate = useNavigate();
+
+ const handleUserSettings = () => {
+ navigate({ to: "/dashboard/settings/appearance" });
+ };
+
+ const handleWorkspaceSettings = () => {
+ if (!workspace) return;
+ navigate({
+ to: "/dashboard/workspace/$workspaceId/settings",
+ params: { workspaceId: workspace.id },
+ });
+ };
+
+ const handleProjectSettings = () => {
+ if (!workspace || !project) return;
+ navigate({
+ to: "/dashboard/workspace/$workspaceId/project/$projectId/settings",
+ params: {
+ workspaceId: workspace.id,
+ projectId: project.id,
+ },
+ });
+ };
+
+ if (variant === "user-dropdown") {
+ return (
+ <DropdownMenuItem onClick={handleUserSettings} className="cursor-pointer">
+ <Settings className="w-4 h-4 mr-2" />
+ Settings
+ </DropdownMenuItem>
+ );
+ }
+
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button
+ variant="ghost"
+ className={cn(
+ "w-full flex items-center gap-2 justify-between",
+ className,
+ )}
+ >
+ <div className="flex items-center gap-2">
+ <Settings className="w-4 h-4" />
+ <span>Settings</span>
+ </div>
+ <ChevronDown className="w-3 h-3 opacity-50" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="start" className="w-56">
+ <DropdownMenuLabel className="flex items-center gap-2 text-xs text-muted-foreground">
+ <Settings className="w-3 h-3" />
+ Settings
+ </DropdownMenuLabel>
+ <DropdownMenuSeparator />
+
+ <DropdownMenuItem
+ onClick={handleUserSettings}
+ className="cursor-pointer"
+ >
+ <User className="w-4 h-4 mr-2" />
+ <div className="flex flex-col">
+ <span className="font-medium">User Settings</span>
+ <span className="text-xs text-muted-foreground">
+ Appearance, preferences
+ </span>
+ </div>
+ </DropdownMenuItem>
+
+ {workspace && (
+ <DropdownMenuItem
+ onClick={handleWorkspaceSettings}
+ className="cursor-pointer"
+ >
+ <Building2 className="w-4 h-4 mr-2" />
+ <div className="flex flex-col">
+ <span className="font-medium">Workspace Settings</span>
+ <span className="text-xs text-muted-foreground">
+ {workspace.name}
+ </span>
+ </div>
+ </DropdownMenuItem>
+ )}
+
+ {workspace && project && (
+ <DropdownMenuItem
+ onClick={handleProjectSettings}
+ className="cursor-pointer"
+ >
+ <FolderOpen className="w-4 h-4 mr-2" />
+ <div className="flex flex-col">
+ <span className="font-medium">Project Settings</span>
+ <span className="text-xs text-muted-foreground">
+ {project.name}
+ </span>
+ </div>
+ </DropdownMenuItem>
+ )}
+
+ {(!workspace || !project) && (
+ <>
+ <DropdownMenuSeparator />
+ <div className="px-2 py-1.5 text-xs text-muted-foreground">
+ {!workspace && "Select a workspace to access workspace settings"}
+ {workspace &&
+ !project &&
+ "Select a project to access project settings"}
+ </div>
+ </>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ );
+}
diff --git a/apps/web/src/components/shared/modals/create-project-modal.tsx b/apps/web/src/components/shared/modals/create-project-modal.tsx
index 84f0cb837..f23335dd4 100644
--- a/apps/web/src/components/shared/modals/create-project-modal.tsx
+++ b/apps/web/src/components/shared/modals/create-project-modal.tsx
@@ -1,14 +1,31 @@
+import {
+ Breadcrumb,
+ BreadcrumbItem,
+ BreadcrumbList,
+ BreadcrumbSeparator,
+} from "@/components/ui/breadcrumb";
import { Button } from "@/components/ui/button";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from "@/components/ui/dialog";
import { Input } from "@/components/ui/input";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/popover";
import icons from "@/constants/project-icons";
import useCreateProject from "@/hooks/mutations/project/use-create-project";
import { cn } from "@/lib/cn";
import generateProjectSlug from "@/lib/generate-project-id";
import useWorkspaceStore from "@/store/workspace";
-import * as Dialog from "@radix-ui/react-dialog";
import { useQueryClient } from "@tanstack/react-query";
import { useNavigate } from "@tanstack/react-router";
-import { X } from "lucide-react";
import { useState } from "react";
import { toast } from "sonner";
@@ -21,6 +38,7 @@ function CreateProjectModal({ open, onClose }: CreateProjectModalProps) {
const [name, setName] = useState("");
const [slug, setSlug] = useState("");
const [selectedIcon, setSelectedIcon] = useState("Layout");
+ const [iconPopoverOpen, setIconPopoverOpen] = useState(false);
const queryClient = useQueryClient();
const { workspace } = useWorkspaceStore();
const { mutateAsync } = useCreateProject({
@@ -32,6 +50,14 @@ function CreateProjectModal({ open, onClose }: CreateProjectModalProps) {
const IconComponent = icons[selectedIcon as keyof typeof icons];
const navigate = useNavigate();
+ const handleClose = () => {
+ setName("");
+ setSlug("");
+ setSelectedIcon("Layout");
+ setIconPopoverOpen(false);
+ onClose();
+ };
+
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
if (!name.trim()) return;
@@ -49,7 +75,7 @@ function CreateProjectModal({ open, onClose }: CreateProjectModalProps) {
},
});
- resetAndCloseModal();
+ handleClose();
} catch (error) {
toast.error(
error instanceof Error ? error.message : "Failed to create project",
@@ -63,139 +89,124 @@ function CreateProjectModal({ open, onClose }: CreateProjectModalProps) {
setSlug(generateProjectSlug(newName));
};
- const resetProjectState = async () => {
- await queryClient.invalidateQueries({ queryKey: ["projects"] });
- resetState();
- };
-
- const resetState = () => {
- setName("");
- setSlug("");
- setSelectedIcon("Layout");
- };
-
- const resetAndCloseModal = () => {
- resetProjectState();
- onClose();
- };
-
return (
- <Dialog.Root open={open} onOpenChange={resetAndCloseModal}>
- <Dialog.Portal>
- <Dialog.Overlay className="fixed inset-0 bg-black/40 backdrop-blur-xs z-40" />
- <Dialog.Content className="fixed z-50 left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-full max-w-md">
- <div className="bg-white dark:bg-zinc-900 rounded-lg shadow-xl">
- <div className="flex items-center justify-between p-4 border-b border-zinc-200 dark:border-zinc-800">
- <Dialog.Title className="text-lg font-semibold text-zinc-900 dark:text-zinc-100">
- New Project
- </Dialog.Title>
- <Dialog.Close
- asChild
- className="text-zinc-500 hover:text-zinc-700 dark:text-zinc-400 dark:hover:text-zinc-300"
- >
- <X size={20} />
- </Dialog.Close>
- </div>
-
- <form onSubmit={handleSubmit} className="p-4">
- <div className="mb-4">
- <label
- htmlFor="projectName"
- aria-label="Project name"
- className="block text-sm font-medium text-zinc-900 dark:text-zinc-300 mb-1"
- >
- Project Name
- </label>
- <Input
- value={name}
- onChange={handleNameChange}
- placeholder="Designers"
- className="bg-white dark:bg-zinc-800/50"
- required
- />
- </div>
-
- <div className="mb-4">
- <label
- htmlFor="slug"
- className="block text-sm font-medium text-zinc-900 dark:text-zinc-300 mb-1"
+ <Dialog open={open} onOpenChange={handleClose}>
+ <DialogContent className="max-w-md" showCloseButton={false}>
+ <DialogHeader className="pb-6">
+ <DialogTitle asChild>
+ <Breadcrumb>
+ <BreadcrumbList>
+ <BreadcrumbItem className="text-zinc-600 dark:text-zinc-400 font-semibold tracking-wider text-sm">
+ {workspace?.name?.toUpperCase() || "WORKSPACE"}
+ </BreadcrumbItem>
+ <BreadcrumbSeparator />
+ <BreadcrumbItem className="text-zinc-700 dark:text-zinc-300 font-medium text-sm">
+ Create a new project
+ </BreadcrumbItem>
+ </BreadcrumbList>
+ </Breadcrumb>
+ </DialogTitle>
+ <DialogDescription className="sr-only">
+ Create a new project in your workspace by providing a name, key, and
+ selecting an icon.
+ </DialogDescription>
+ </DialogHeader>
+
+ <form onSubmit={handleSubmit} className="space-y-6">
+ <div className="space-y-4 px-6">
+ <Popover
+ open={iconPopoverOpen}
+ onOpenChange={setIconPopoverOpen}
+ modal={true}
+ >
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ className="flex items-center justify-center p-2 rounded border border-border hover:border-zinc-400 dark:hover:border-zinc-600 transition-colors"
>
- Project Slug
- </label>
- <div className="flex gap-3">
- <Input
- value={slug}
- onChange={(e) => setSlug(e.target.value.toUpperCase())}
- placeholder="ABC"
- className="bg-white dark:bg-zinc-800/50 uppercase"
- maxLength={5}
- pattern="[A-Z0-9]+"
- required
- />
- </div>
- <p className="mt-1 text-xs text-zinc-500 dark:text-zinc-400">
- This key will be used for ticket IDs (e.g., ABC-123)
- </p>
- </div>
-
- <div>
- <label
- htmlFor="icon"
- className="block text-sm font-medium text-zinc-900 dark:text-zinc-300 mb-3"
- >
- Project Icon
- </label>
- <div className="relative">
- <div className="grid grid-cols-8 gap-2 max-h-[240px] overflow-y-auto p-2 rounded-lg border border-zinc-200 dark:border-zinc-700/50">
- {Object.entries(icons).map(([name, Icon]) => (
+ <IconComponent className="w-4 h-4 text-zinc-600 dark:text-zinc-400" />
+ </button>
+ </PopoverTrigger>
+ <PopoverContent className="w-80 p-2" align="start">
+ <div className="max-h-[300px] overflow-y-auto">
+ <div className="grid grid-cols-8 gap-2">
+ {Object.entries(icons).map(([iconName, Icon]) => (
<button
- key={name}
+ key={iconName}
type="button"
- onClick={() => setSelectedIcon(name)}
+ onClick={() => {
+ setSelectedIcon(iconName);
+ setIconPopoverOpen(false);
+ }}
className={cn(
- "p-2 rounded-lg transition-colors flex items-center justify-center group",
- selectedIcon === name
+ "p-2 rounded-lg transition-all duration-200 flex items-center justify-center group hover:scale-105",
+ selectedIcon === iconName
? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
- : "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
+ : "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-700",
)}
- title={name}
+ title={iconName}
>
- <Icon className="w-5 h-5" />
+ <Icon className="w-4 h-4" />
</button>
))}
</div>
- <div className="absolute left-0 right-0 bottom-0 h-8 bg-gradient-to-t from-white dark:from-zinc-900 to-transparent pointer-events-none" />
- </div>
- <div className="flex items-center gap-2 mt-2 px-2">
- <IconComponent className="w-4 h-4 text-zinc-400" />
- <span className="text-sm text-zinc-500 dark:text-zinc-400">
- {selectedIcon}
- </span>
</div>
- </div>
+ </PopoverContent>
+ </Popover>
+
+ <Input
+ value={name}
+ onChange={handleNameChange}
+ autoFocus
+ placeholder="Project name"
+ className="!text-2xl font-semibold !border-0 px-0 py-3 !shadow-none focus-visible:!ring-0 !bg-transparent text-zinc-900 dark:text-white placeholder:text-zinc-500 dark:placeholder:text-zinc-400 tracking-tight focus:!outline-none focus-visible:!outline-none"
+ required
+ />
+ </div>
- <div className="flex justify-end gap-2">
- <Dialog.Close asChild>
- <Button
- type="button"
- className="bg-zinc-100 text-zinc-900 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-100 dark:hover:bg-zinc-700"
- >
- Cancel
- </Button>
- </Dialog.Close>
- <Button
- type="submit"
- disabled={!name.trim() || !slug.trim()}
- className="bg-indigo-600 text-white hover:bg-indigo-500 dark:bg-indigo-500 dark:hover:bg-indigo-400"
- >
- Create Project
- </Button>
+ <div className="space-y-4 px-6">
+ <div className="flex items-center gap-3 p-3 rounded-xl bg-gradient-to-r from-zinc-50 to-zinc-100/50 dark:from-zinc-900/50 dark:to-zinc-800/30 border border-zinc-200/50 dark:border-zinc-700/30">
+ <div className="flex items-center gap-2">
+ <span className="text-sm font-medium text-zinc-600 dark:text-zinc-400">
+ Key:
+ </span>
+ <Input
+ id="project-key"
+ value={slug}
+ onChange={(e) => setSlug(e.target.value)}
+ placeholder="PRO"
+ className="w-20 h-8 text-center font-semibold text-sm bg-white/80 dark:bg-zinc-900/80 border-zinc-300/50 dark:border-zinc-600/50 rounded-lg focus:bg-white dark:focus:bg-zinc-900 focus:border-indigo-400 dark:focus:border-indigo-500 transition-all duration-200"
+ required
+ />
+ </div>
+ <div className="flex-1 text-xs text-zinc-500 dark:text-zinc-400 opacity-80">
+ Used for ticket IDs (e.g., {slug || "ABC"}-123)
</div>
- </form>
+ </div>
</div>
- </Dialog.Content>
- </Dialog.Portal>
- </Dialog.Root>
+
+ <DialogFooter>
+ <Button
+ type="button"
+ onClick={handleClose}
+ variant="outline"
+ size="sm"
+ className="border-zinc-300 dark:border-zinc-700 text-zinc-700 dark:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800"
+ >
+ Cancel
+ </Button>
+ <Button
+ type="submit"
+ disabled={!name.trim() || !slug.trim()}
+ size="sm"
+ className="bg-indigo-600 hover:bg-indigo-500 text-white disabled:opacity-50"
+ >
+ Create Project
+ </Button>
+ </DialogFooter>
+ </form>
+ </DialogContent>
+ </Dialog>
);
}
diff --git a/apps/web/src/components/shared/modals/create-task-modal.tsx b/apps/web/src/components/shared/modals/create-task-modal.tsx
index c60c2c7c3..40c4a6dff 100644
--- a/apps/web/src/components/shared/modals/create-task-modal.tsx
+++ b/apps/web/src/components/shared/modals/create-task-modal.tsx
@@ -1,8 +1,27 @@
-import { Editor } from "@/components/common/editor";
import { Badge } from "@/components/ui/badge";
+import {
+ Breadcrumb,
+ BreadcrumbItem,
+ BreadcrumbList,
+ BreadcrumbSeparator,
+} from "@/components/ui/breadcrumb";
import { Button } from "@/components/ui/button";
import { Calendar } from "@/components/ui/calendar";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from "@/components/ui/dialog";
import { Input } from "@/components/ui/input";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/popover";
+import { Textarea } from "@/components/ui/textarea";
import useCreateLabel from "@/hooks/mutations/label/use-create-label";
import useCreateTask from "@/hooks/mutations/task/use-create-task";
import useUpdateTask from "@/hooks/mutations/task/use-update-task";
@@ -10,8 +29,6 @@ import useGetActiveWorkspaceUsers from "@/hooks/queries/workspace-users/use-acti
import { cn } from "@/lib/cn";
import useProjectStore from "@/store/project";
import useWorkspaceStore from "@/store/workspace";
-import * as Dialog from "@radix-ui/react-dialog";
-import * as Popover from "@radix-ui/react-popover";
import { format } from "date-fns";
import { produce } from "immer";
import {
@@ -23,7 +40,6 @@ import {
Tag,
Target,
UserIcon,
- X,
} from "lucide-react";
import { useEffect, useRef, useState } from "react";
import { toast } from "sonner";
@@ -271,424 +287,386 @@ function CreateTaskModal({ open, onClose, status }: CreateTaskModalProps) {
};
return (
- <Dialog.Root open={open} onOpenChange={handleClose}>
- <Dialog.Portal>
- <Dialog.Overlay className="fixed inset-0 bg-black/60 z-40 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" />
- <Dialog.Content className="fixed z-50 left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-full max-w-2xl data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95">
- <div className="bg-white dark:bg-gradient-to-br dark:from-zinc-900 dark:via-zinc-900 dark:to-zinc-800 rounded-xl shadow-2xl border border-zinc-200 dark:border-zinc-700/50 backdrop-blur-xl">
- <div className="flex items-center justify-between p-6 border-b border-zinc-200 dark:border-zinc-800/50">
- <div className="flex items-center gap-3">
- <div className="text-sm text-zinc-600 dark:text-zinc-400 font-semibold tracking-wider">
+ <Dialog open={open} onOpenChange={handleClose}>
+ <DialogContent className="max-w-2xl" showCloseButton={false}>
+ <DialogHeader>
+ <DialogTitle asChild>
+ <Breadcrumb>
+ <BreadcrumbList>
+ <BreadcrumbItem className="text-zinc-600 dark:text-zinc-400 font-semibold tracking-wider text-sm">
{project?.slug?.toUpperCase() || "TASK"}
- </div>
- <div className="w-1 h-1 bg-gradient-to-r from-indigo-400 to-purple-400 rounded-full" />
- <div className="text-sm text-zinc-700 dark:text-zinc-300 font-medium">
+ </BreadcrumbItem>
+ <BreadcrumbSeparator />
+ <BreadcrumbItem className="text-zinc-700 dark:text-zinc-300 font-medium text-sm">
New Task
- </div>
- </div>
- <Dialog.Close
- asChild
- className="text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100 cursor-pointer p-2 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 rounded-lg transition-all duration-200"
- >
- <X size={18} />
- </Dialog.Close>
- </div>
-
- <form onSubmit={handleSubmit} className="px-6 pb-6">
- <div className="space-y-6">
- <div className="pt-2">
- <Input
- value={title}
- onChange={(e) => setTitle(e.target.value)}
- autoFocus
- placeholder="Task title"
- className="text-xl font-semibold border-0 px-0 shadow-none focus-visible:ring-0 bg-transparent text-zinc-900 dark:text-white placeholder:text-zinc-500 dark:placeholder:text-zinc-400 tracking-tight"
- required
- />
- </div>
-
- <div>
- <div className="border border-zinc-300 dark:border-zinc-700/30 bg-zinc-50 dark:bg-zinc-800/30 h-[240px] rounded-lg shadow-sm backdrop-blur-sm overflow-hidden">
- <Editor
- value={description}
- onChange={setDescription}
- placeholder="Add description..."
+ </BreadcrumbItem>
+ </BreadcrumbList>
+ </Breadcrumb>
+ </DialogTitle>
+ <DialogDescription className="sr-only">
+ Create a new task by providing a title, description, and other
+ details.
+ </DialogDescription>
+ </DialogHeader>
+
+ <form onSubmit={handleSubmit} className="space-y-6">
+ <div className="space-y-6 px-6">
+ <Input
+ value={title}
+ onChange={(e) => setTitle(e.target.value)}
+ autoFocus
+ placeholder="Task title"
+ className="!text-2xl font-semibold !border-0 px-0 py-3 !shadow-none focus-visible:!ring-0 !bg-transparent text-zinc-900 dark:text-white placeholder:text-zinc-500 dark:placeholder:text-zinc-400 tracking-tight focus:!outline-none focus-visible:!outline-none"
+ required
+ />
+
+ <Textarea
+ value={description}
+ onChange={(e) => setDescription(e.target.value)}
+ placeholder="Add description..."
+ className="!border-0 px-0 py-2 !shadow-none focus-visible:!ring-0 !bg-transparent text-zinc-700 dark:text-zinc-300 placeholder:text-zinc-500 dark:placeholder:text-zinc-400 resize-none min-h-[120px] focus:!outline-none focus-visible:!outline-none"
+ />
+
+ {labels.length > 0 && (
+ <div className="flex flex-wrap gap-2">
+ {labels.map((label) => (
+ <Badge
+ key={label.name}
+ badgeColor={label.color}
+ variant="outline"
+ className="flex items-center gap-1 pl-3 cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800/50 transition-colors"
+ onClick={() => removeLabel(label.name)}
+ >
+ <span
+ className="inline-block w-2 h-2 mr-1.5 rounded-full"
+ style={{
+ backgroundColor:
+ labelColors.find((c) => c.value === label.color)
+ ?.color || "#94a3b8",
+ }}
/>
- </div>
- </div>
-
- {labels.length > 0 && (
- <div className="flex flex-wrap gap-2">
- {labels.map((label) => (
- <Badge
- key={label.name}
- badgeColor={label.color}
- variant="outline"
- className="flex items-center gap-1 pl-3 cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800/50 transition-colors"
- onClick={() => removeLabel(label.name)}
- >
- <span
- className="inline-block w-2 h-2 mr-1.5 rounded-full"
- style={{
- backgroundColor:
- labelColors.find((c) => c.value === label.color)
- ?.color || "#94a3b8",
- }}
- />
- {label.name}
- </Badge>
- ))}
- </div>
- )}
-
- <div className="flex flex-wrap items-center gap-2 py-2">
- <div className="flex items-center gap-1.5 px-2.5 py-1.5 bg-gradient-to-r from-amber-100 to-yellow-100 dark:from-amber-500/20 dark:to-yellow-500/20 text-amber-800 dark:text-amber-300 rounded-md text-xs font-medium border border-amber-300 dark:border-amber-500/30">
- <div className="w-1.5 h-1.5 bg-gradient-to-r from-amber-500 to-yellow-500 dark:from-amber-400 dark:to-yellow-400 rounded-full shadow-sm" />
- {status
- ? status.charAt(0).toUpperCase() +
- status.slice(1).replace("-", " ")
- : "In Progress"}
- </div>
+ {label.name}
+ </Badge>
+ ))}
+ </div>
+ )}
+
+ <div className="flex flex-wrap items-center gap-2 py-2">
+ <div className="flex items-center gap-1.5 px-2.5 py-1.5 bg-gradient-to-r from-amber-100 to-yellow-100 dark:from-amber-500/20 dark:to-yellow-500/20 text-amber-800 dark:text-amber-300 rounded-md text-xs font-medium border border-amber-300 dark:border-amber-500/30">
+ <div className="w-1.5 h-1.5 bg-gradient-to-r from-amber-500 to-yellow-500 dark:from-amber-400 dark:to-yellow-400 rounded-full shadow-sm" />
+ {status
+ ? status.charAt(0).toUpperCase() +
+ status.slice(1).replace("-", " ")
+ : "In Progress"}
+ </div>
- <Popover.Root>
- <Popover.Trigger asChild>
+ <Popover>
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ className={cn(
+ "flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md transition-all duration-200 hover:scale-105 border",
+ selectedPriority && priority !== "low"
+ ? `${selectedPriority.color} ${selectedPriority.bg} ${selectedPriority.border}`
+ : "text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 border-zinc-300 dark:border-zinc-700/50",
+ )}
+ >
+ <Target className="w-3.5 h-3.5" />
+ <span>
+ {selectedPriority ? selectedPriority.label : "Priority"}
+ </span>
+ </button>
+ </PopoverTrigger>
+ <PopoverContent className="w-48 p-2" align="start">
+ <div className="space-y-1">
+ {priorityOptions.map((option) => (
<button
+ key={option.value}
type="button"
className={cn(
- "flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md transition-all duration-200 hover:scale-105 border",
- selectedPriority && priority !== "low"
- ? `${selectedPriority.color} ${selectedPriority.bg} ${selectedPriority.border}`
- : "text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 border-zinc-300 dark:border-zinc-700/50",
+ "w-full flex items-center gap-3 px-3 py-2 text-sm rounded-lg transition-all duration-200 hover:scale-[1.02]",
+ option.color,
+ option.bg,
+ `hover:${option.bg}`,
)}
+ onClick={() => setPriority(option.value as Priority)}
>
- <Target className="w-3.5 h-3.5" />
- <span>
- {selectedPriority
- ? selectedPriority.label
- : "Priority"}
- </span>
+ <Flag className={cn("w-3.5 h-3.5", option.color)} />
+ {option.label}
</button>
- </Popover.Trigger>
- <Popover.Portal>
- <Popover.Content
- align="start"
- className="z-50 w-48 bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg shadow-lg p-2 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"
+ ))}
+ </div>
+ </PopoverContent>
+ </Popover>
+
+ <Popover>
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ className={cn(
+ "flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md transition-all duration-200 hover:scale-105 border",
+ selectedUser
+ ? "text-indigo-300 bg-indigo-500/10 border-indigo-500/30"
+ : "text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 border-zinc-300 dark:border-zinc-700/50",
+ )}
+ >
+ {selectedUser ? (
+ <>
+ <div className="w-4 h-4 bg-zinc-400 dark:bg-zinc-600 rounded-full flex items-center justify-center text-[10px] text-white font-bold">
+ {selectedUser.userName?.charAt(0).toUpperCase() ||
+ "?"}
+ </div>
+ <span>{selectedUser.userName}</span>
+ </>
+ ) : (
+ <>
+ <UserIcon className="w-3.5 h-3.5" />
+ <span>Assign</span>
+ </>
+ )}
+ </button>
+ </PopoverTrigger>
+ <PopoverContent className="w-64 p-2" align="start">
+ <div className="space-y-1">
+ <button
+ type="button"
+ className="w-full flex items-center gap-3 px-3 py-2 text-sm rounded-lg hover:bg-zinc-100 dark:hover:bg-zinc-800/50 text-zinc-900 dark:text-zinc-300 transition-all duration-200 hover:scale-[1.02]"
+ onClick={() => setAssigneeEmail("")}
+ >
+ <UserIcon className="w-4 h-4 text-zinc-600 dark:text-zinc-500" />
+ Unassigned
+ </button>
+ {users?.map((user) => (
+ <button
+ key={user.userEmail}
+ type="button"
+ className="w-full flex items-center gap-3 px-3 py-2 text-sm rounded-lg hover:bg-zinc-100 dark:hover:bg-zinc-800/50 text-zinc-900 dark:text-zinc-300 transition-all duration-200 hover:scale-[1.02]"
+ onClick={() => setAssigneeEmail(user.userEmail || "")}
>
- <div className="space-y-1">
- {priorityOptions.map((option) => (
- <button
- key={option.value}
- type="button"
- className={cn(
- "w-full flex items-center gap-3 px-3 py-2 text-sm rounded-lg transition-all duration-200 hover:scale-[1.02]",
- option.color,
- option.bg,
- `hover:${option.bg}`,
- )}
- onClick={() =>
- setPriority(option.value as Priority)
- }
- >
- <Flag
- className={cn("w-3.5 h-3.5", option.color)}
- />
- {option.label}
- </button>
- ))}
+ <div className="w-4 h-4 bg-zinc-400 dark:bg-zinc-600 rounded-full flex items-center justify-center text-[10px] text-white font-bold">
+ {user.userName?.charAt(0).toUpperCase() || "?"}
</div>
- </Popover.Content>
- </Popover.Portal>
- </Popover.Root>
+ {user.userName}
+ </button>
+ ))}
+ </div>
+ </PopoverContent>
+ </Popover>
- <Popover.Root>
- <Popover.Trigger asChild>
+ <Popover>
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ className={cn(
+ "flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md transition-all duration-200 hover:scale-105 border",
+ dueDate
+ ? "text-emerald-300 bg-emerald-500/10 border-emerald-500/30"
+ : "text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 border-zinc-300 dark:border-zinc-700/50",
+ )}
+ >
+ <CalendarIcon className="w-3.5 h-3.5" />
+ <span>
+ {dueDate ? format(dueDate, "MMM d, yyyy") : "Due date"}
+ </span>
+ </button>
+ </PopoverTrigger>
+ <PopoverContent className="w-auto p-3" align="start">
+ <Calendar
+ mode="single"
+ selected={dueDate}
+ onSelect={setDueDate}
+ className="rounded-md border-0"
+ />
+ {dueDate && (
+ <div className="flex justify-between items-center pt-3 border-t border-zinc-200 dark:border-zinc-800/50 mt-3">
+ <span className="text-sm text-zinc-600 dark:text-zinc-400">
+ {format(dueDate, "EEEE, MMMM d, yyyy")}
+ </span>
<button
type="button"
- className={cn(
- "flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md transition-all duration-200 hover:scale-105 border",
- selectedUser
- ? "text-indigo-300 bg-indigo-500/10 border-indigo-500/30"
- : "text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 border-zinc-300 dark:border-zinc-700/50",
- )}
+ onClick={() => setDueDate(undefined)}
+ className="text-xs text-zinc-600 dark:text-zinc-500 hover:text-zinc-900 dark:hover:text-zinc-300 transition-colors"
>
- {selectedUser ? (
- <>
- <div className="w-4 h-4 bg-zinc-400 dark:bg-zinc-600 rounded-full flex items-center justify-center text-[10px] text-white font-bold">
- {selectedUser.userName?.charAt(0).toUpperCase() ||
- "?"}
- </div>
- <span>{selectedUser.userName}</span>
- </>
- ) : (
- <>
- <UserIcon className="w-3.5 h-3.5" />
- <span>Assign</span>
- </>
- )}
+ Clear
</button>
- </Popover.Trigger>
- <Popover.Portal>
- <Popover.Content
- align="start"
- className="z-50 w-64 bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg shadow-lg p-2 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"
- >
- <div className="space-y-1">
+ </div>
+ )}
+ </PopoverContent>
+ </Popover>
+
+ <Popover open={labelsOpen} onOpenChange={setLabelsOpen}>
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ className={cn(
+ "flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md transition-all duration-200 hover:scale-105 border",
+ labels.length > 0
+ ? "text-violet-300 bg-violet-500/10 border-violet-500/30"
+ : "text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 border-zinc-300 dark:border-zinc-700/50",
+ )}
+ >
+ <Tag className="w-3.5 h-3.5" />
+ <span>Labels</span>
+ </button>
+ </PopoverTrigger>
+ <PopoverContent
+ className="w-80 p-0 overflow-hidden"
+ align="start"
+ sideOffset={5}
+ >
+ <div className="flex items-center p-2 border-b border-zinc-200 dark:border-zinc-800">
+ <Search className="w-4 h-4 text-zinc-500 dark:text-zinc-400 mr-2" />
+ <input
+ ref={searchInputRef}
+ type="text"
+ value={searchValue}
+ onChange={(e) => setSearchValue(e.target.value)}
+ onKeyDown={handleSearchKeyDown}
+ placeholder="Change or add labels..."
+ className="w-full bg-transparent border-none text-zinc-900 dark:text-zinc-200 text-sm focus:outline-none placeholder:text-zinc-500"
+ />
+ </div>
+
+ <div className="max-h-80 overflow-y-auto">
+ {filteredLabels.length > 0 ? (
+ <div className="py-1">
+ {filteredLabels.map((label: Label) => (
<button
+ key={label.name}
type="button"
- className="w-full flex items-center gap-3 px-3 py-2 text-sm rounded-lg hover:bg-zinc-100 dark:hover:bg-zinc-800/50 text-zinc-900 dark:text-zinc-300 transition-all duration-200 hover:scale-[1.02]"
- onClick={() => setAssigneeEmail("")}
+ className="w-full flex items-center px-3 py-2 text-sm text-left text-zinc-900 dark:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-800"
+ onClick={() => toggleLabel(label.name)}
>
- <UserIcon className="w-4 h-4 text-zinc-600 dark:text-zinc-500" />
- Unassigned
+ <div className="flex-shrink-0 w-4 mr-2 text-center">
+ <Check className="w-4 h-4 text-zinc-400" />
+ </div>
+ <span
+ className="w-3 h-3 rounded-full mr-2"
+ style={{
+ backgroundColor:
+ labelColors.find(
+ (c) => c.value === label.color,
+ )?.color || "#94a3b8",
+ }}
+ />
+ <span>{label.name}</span>
</button>
- {users?.map((user) => (
- <button
- key={user.userEmail}
- type="button"
- className="w-full flex items-center gap-3 px-3 py-2 text-sm rounded-lg hover:bg-zinc-100 dark:hover:bg-zinc-800/50 text-zinc-900 dark:text-zinc-300 transition-all duration-200 hover:scale-[1.02]"
- onClick={() =>
- setAssigneeEmail(user.userEmail || "")
- }
- >
- <div className="w-4 h-4 bg-zinc-400 dark:bg-zinc-600 rounded-full flex items-center justify-center text-[10px] text-white font-bold">
- {user.userName?.charAt(0).toUpperCase() || "?"}
- </div>
- {user.userName}
- </button>
- ))}
- </div>
- </Popover.Content>
- </Popover.Portal>
- </Popover.Root>
-
- <Popover.Root>
- <Popover.Trigger asChild>
- <button
- type="button"
- className={cn(
- "flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md transition-all duration-200 hover:scale-105 border",
- dueDate
- ? "text-emerald-300 bg-emerald-500/10 border-emerald-500/30"
- : "text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 border-zinc-300 dark:border-zinc-700/50",
- )}
- >
- <CalendarIcon className="w-3.5 h-3.5" />
- <span>
- {dueDate
- ? format(dueDate, "MMM d, yyyy")
- : "Due date"}
- </span>
- </button>
- </Popover.Trigger>
- <Popover.Portal>
- <Popover.Content
- align="start"
- className="z-50 w-auto bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg shadow-lg p-3 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"
- >
- <Calendar
- mode="single"
- selected={dueDate}
- onSelect={setDueDate}
- className="rounded-md border-0"
- />
- {dueDate && (
- <div className="flex justify-between items-center pt-3 border-t border-zinc-200 dark:border-zinc-800/50 mt-3">
- <span className="text-sm text-zinc-600 dark:text-zinc-400">
- {format(dueDate, "EEEE, MMMM d, yyyy")}
- </span>
+ ))}
+ </div>
+ ) : null}
+
+ {isCreatingNewLabel && (
+ <div className="py-1 border-t border-zinc-200 dark:border-zinc-800">
+ <button
+ type="button"
+ className="w-full flex items-center px-3 py-2 text-sm text-left text-zinc-900 dark:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-800"
+ onClick={handleCreateLabel}
+ >
+ <div className="flex-shrink-0 w-4 mr-2 text-center">
+ <PlusIcon className="w-4 h-4 text-zinc-400" />
+ </div>
+ <span
+ className="w-3 h-3 rounded-full mr-2"
+ style={{
+ backgroundColor:
+ labelColors.find(
+ (c) => c.value === selectedColor,
+ )?.color || "#94a3b8",
+ }}
+ />
+ <span>Create new label: "{searchValue}"</span>
+ </button>
+
+ <Popover
+ open={colorPickerOpen}
+ onOpenChange={setColorPickerOpen}
+ >
+ <PopoverTrigger asChild>
<button
type="button"
- onClick={() => setDueDate(undefined)}
- className="text-xs text-zinc-600 dark:text-zinc-500 hover:text-zinc-900 dark:hover:text-zinc-300 transition-colors"
+ className="w-full flex items-center px-3 py-2 text-sm text-left text-zinc-500 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800"
>
- Clear
+ <div className="flex-shrink-0 w-4 mr-2" />
+ <span>Pick a color for label</span>
</button>
- </div>
- )}
- </Popover.Content>
- </Popover.Portal>
- </Popover.Root>
-
- <Popover.Root open={labelsOpen} onOpenChange={setLabelsOpen}>
- <Popover.Trigger asChild>
- <button
- type="button"
- className={cn(
- "flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md transition-all duration-200 hover:scale-105 border",
- labels.length > 0
- ? "text-violet-300 bg-violet-500/10 border-violet-500/30"
- : "text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 border-zinc-300 dark:border-zinc-700/50",
- )}
- >
- <Tag className="w-3.5 h-3.5" />
- <span>Labels</span>
- </button>
- </Popover.Trigger>
- <Popover.Portal>
- <Popover.Content
- align="start"
- className="w-80 bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg shadow-lg overflow-hidden z-50"
- sideOffset={5}
- >
- <div className="flex items-center p-2 border-b border-zinc-200 dark:border-zinc-800">
- <Search className="w-4 h-4 text-zinc-500 dark:text-zinc-400 mr-2" />
- <input
- ref={searchInputRef}
- type="text"
- value={searchValue}
- onChange={(e) => setSearchValue(e.target.value)}
- onKeyDown={handleSearchKeyDown}
- placeholder="Change or add labels..."
- className="w-full bg-transparent border-none text-zinc-900 dark:text-zinc-200 text-sm focus:outline-none placeholder:text-zinc-500"
- />
- </div>
-
- <div className="max-h-80 overflow-y-auto">
- {filteredLabels.length > 0 ? (
- <div className="py-1">
- {filteredLabels.map((label: Label) => (
+ </PopoverTrigger>
+ <PopoverContent
+ className="w-64 p-2"
+ align="start"
+ sideOffset={5}
+ >
+ <div className="grid grid-cols-1 gap-1">
+ {labelColors.map((color) => (
<button
- key={label.name}
+ key={color.value}
type="button"
- className="w-full flex items-center px-3 py-2 text-sm text-left text-zinc-900 dark:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-800"
- onClick={() => toggleLabel(label.name)}
+ className={cn(
+ "flex items-center px-3 py-2 text-sm text-left text-zinc-900 dark:text-zinc-200 rounded hover:bg-zinc-100 dark:hover:bg-zinc-800",
+ selectedColor === color.value &&
+ "bg-zinc-100 dark:bg-zinc-800",
+ )}
+ onClick={() => {
+ setSelectedColor(color.value);
+ setColorPickerOpen(false);
+ }}
>
- <div className="flex-shrink-0 w-4 mr-2 text-center">
- <Check className="w-4 h-4 text-zinc-400" />
- </div>
<span
- className="w-3 h-3 rounded-full mr-2"
+ className="w-3 h-3 rounded-full mr-3"
style={{
- backgroundColor:
- labelColors.find(
- (c) => c.value === label.color,
- )?.color || "#94a3b8",
+ backgroundColor: color.color,
}}
/>
- <span>{label.name}</span>
+ <span>{color.label}</span>
+ {selectedColor === color.value && (
+ <Check className="w-4 h-4 ml-auto text-zinc-400" />
+ )}
</button>
))}
</div>
- ) : null}
-
- {isCreatingNewLabel && (
- <div className="py-1 border-t border-zinc-200 dark:border-zinc-800">
- <button
- type="button"
- className="w-full flex items-center px-3 py-2 text-sm text-left text-zinc-900 dark:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-800"
- onClick={handleCreateLabel}
- >
- <div className="flex-shrink-0 w-4 mr-2 text-center">
- <PlusIcon className="w-4 h-4 text-zinc-400" />
- </div>
- <span
- className="w-3 h-3 rounded-full mr-2"
- style={{
- backgroundColor:
- labelColors.find(
- (c) => c.value === selectedColor,
- )?.color || "#94a3b8",
- }}
- />
- <span>Create new label: "{searchValue}"</span>
- </button>
-
- <Popover.Root
- open={colorPickerOpen}
- onOpenChange={setColorPickerOpen}
- >
- <Popover.Trigger asChild>
- <button
- type="button"
- className="w-full flex items-center px-3 py-2 text-sm text-left text-zinc-500 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800"
- >
- <div className="flex-shrink-0 w-4 mr-2" />
- <span>Pick a color for label</span>
- </button>
- </Popover.Trigger>
- <Popover.Portal>
- <Popover.Content
- align="start"
- className="w-64 bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg shadow-lg p-2 z-50"
- sideOffset={5}
- >
- <div className="grid grid-cols-1 gap-1">
- {labelColors.map((color) => (
- <button
- key={color.value}
- type="button"
- className={cn(
- "flex items-center px-3 py-2 text-sm text-left text-zinc-900 dark:text-zinc-200 rounded hover:bg-zinc-100 dark:hover:bg-zinc-800",
- selectedColor === color.value &&
- "bg-zinc-100 dark:bg-zinc-800",
- )}
- onClick={() => {
- setSelectedColor(color.value);
- setColorPickerOpen(false);
- }}
- >
- <span
- className="w-3 h-3 rounded-full mr-3"
- style={{
- backgroundColor: color.color,
- }}
- />
- <span>{color.label}</span>
- {selectedColor === color.value && (
- <Check className="w-4 h-4 ml-auto text-zinc-400" />
- )}
- </button>
- ))}
- </div>
- </Popover.Content>
- </Popover.Portal>
- </Popover.Root>
- </div>
- )}
- </div>
- </Popover.Content>
- </Popover.Portal>
- </Popover.Root>
- </div>
- </div>
-
- <div className="flex items-center justify-between pt-6 border-t border-zinc-200 dark:border-zinc-800/50 mt-6">
- <div className="flex items-center gap-3">
- <div className="flex items-center gap-2">
- <label className="flex items-center gap-2 text-sm text-zinc-600 dark:text-zinc-400 cursor-pointer hover:text-zinc-900 dark:hover:text-zinc-300 transition-colors">
- <input
- type="checkbox"
- checked={createMore}
- onChange={(e) => setCreateMore(e.target.checked)}
- className="rounded border-zinc-400 dark:border-zinc-600 bg-white dark:bg-zinc-800 text-indigo-500 focus:ring-indigo-500 focus:ring-offset-0 focus:ring-2 transition-all"
- />
- Create more
- </label>
+ </PopoverContent>
+ </Popover>
+ </div>
+ )}
</div>
- </div>
-
- <div className="flex items-center gap-3">
- <Button
- type="button"
- onClick={handleClose}
- className="bg-transparent border border-zinc-300 dark:border-zinc-700/50 text-zinc-700 dark:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 hover:text-zinc-900 dark:hover:text-white hover:border-zinc-400 dark:hover:border-zinc-600 transition-all duration-200"
- >
- Cancel
- </Button>
- <Button
- type="submit"
- disabled={!title.trim()}
- className="bg-indigo-600 text-white hover:bg-indigo-500 transition-all duration-200 disabled:opacity-50"
- >
- Create Task
- </Button>
- </div>
- </div>
- </form>
+ </PopoverContent>
+ </Popover>
+ </div>
</div>
- </Dialog.Content>
- </Dialog.Portal>
- </Dialog.Root>
+
+ <DialogFooter>
+ <div className="flex items-center gap-3 mr-auto">
+ <label className="flex items-center gap-2 text-sm text-zinc-600 dark:text-zinc-400 cursor-pointer hover:text-zinc-900 dark:hover:text-zinc-300 transition-colors">
+ <input
+ type="checkbox"
+ checked={createMore}
+ onChange={(e) => setCreateMore(e.target.checked)}
+ className="rounded border-zinc-400 dark:border-zinc-600 bg-white dark:bg-zinc-800 text-indigo-500 focus:ring-indigo-500 focus:ring-offset-0 focus:ring-2 transition-all"
+ />
+ Create more
+ </label>
+ </div>
+
+ <Button
+ type="button"
+ onClick={handleClose}
+ variant="outline"
+ size="sm"
+ className="border-zinc-300 dark:border-zinc-700 text-zinc-700 dark:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800"
+ >
+ Cancel
+ </Button>
+ <Button
+ type="submit"
+ disabled={!title.trim()}
+ size="sm"
+ className="bg-indigo-600 hover:bg-indigo-500 text-white disabled:opacity-50"
+ >
+ Create Task
+ </Button>
+ </DialogFooter>
+ </form>
+ </DialogContent>
+ </Dialog>
);
}
diff --git a/apps/web/src/components/shared/modals/create-workspace-modal.tsx b/apps/web/src/components/shared/modals/create-workspace-modal.tsx
index 35c861174..33c02c34f 100644
--- a/apps/web/src/components/shared/modals/create-workspace-modal.tsx
+++ b/apps/web/src/components/shared/modals/create-workspace-modal.tsx
@@ -1,38 +1,72 @@
+import {
+ Breadcrumb,
+ BreadcrumbItem,
+ BreadcrumbList,
+ BreadcrumbSeparator,
+} from "@/components/ui/breadcrumb";
import { Button } from "@/components/ui/button";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from "@/components/ui/dialog";
import { Input } from "@/components/ui/input";
import useCreateWorkspace from "@/hooks/queries/workspace/use-create-workspace";
-import * as Dialog from "@radix-ui/react-dialog";
+import { useUserPreferencesStore } from "@/store/user-preferences";
import { useQueryClient } from "@tanstack/react-query";
import { useNavigate } from "@tanstack/react-router";
-import { X } from "lucide-react";
-import { useState } from "react";
+import { useEffect, useRef, useState } from "react";
import { toast } from "sonner";
interface CreateWorkspaceModalProps {
open: boolean;
onClose: () => void;
}
+
function CreateWorkspaceModal({ open, onClose }: CreateWorkspaceModalProps) {
const [name, setName] = useState("");
+ const [description, setDescription] = useState("");
+ const inputRef = useRef<HTMLInputElement>(null);
const queryClient = useQueryClient();
const navigate = useNavigate();
- const { mutateAsync } = useCreateWorkspace({ name });
+ const { setActiveWorkspaceId } = useUserPreferencesStore();
+ const { mutateAsync } = useCreateWorkspace();
+
+ useEffect(() => {
+ if (open && inputRef.current) {
+ setTimeout(() => {
+ inputRef.current?.focus();
+ }, 100);
+ }
+ }, [open]);
+
+ const handleClose = () => {
+ setName("");
+ setDescription("");
+ onClose();
+ };
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
if (!name.trim()) return;
try {
- const createdWorkspace = await mutateAsync();
+ const createdWorkspace = await mutateAsync({ name, description });
toast.success("Workspace created successfully");
- resetAndCloseModal();
+ await queryClient.invalidateQueries({ queryKey: ["workspaces"] });
+ setActiveWorkspaceId(createdWorkspace.id);
navigate({
to: "/dashboard/workspace/$workspaceId",
params: {
workspaceId: createdWorkspace.id,
},
});
+
+ handleClose();
} catch (error) {
toast.error(
error instanceof Error ? error.message : "Failed to create workspace",
@@ -40,75 +74,69 @@ function CreateWorkspaceModal({ open, onClose }: CreateWorkspaceModalProps) {
}
};
- const resetWorkspaceState = async () => {
- await queryClient.invalidateQueries({ queryKey: ["workspaces"] });
- setName("");
- };
-
- const resetAndCloseModal = () => {
- resetWorkspaceState();
- onClose();
- };
-
return (
- <Dialog.Root open={open} onOpenChange={resetAndCloseModal}>
- <Dialog.Portal>
- <Dialog.Overlay className="fixed inset-0 bg-black/40 backdrop-blur-xs z-40" />
- <Dialog.Content className="fixed z-50 left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-full max-w-md">
- <div className="bg-white dark:bg-zinc-900 rounded-lg shadow-xl">
- <div className="flex items-center justify-between p-4 border-b border-zinc-200 dark:border-zinc-800">
- <Dialog.Title className="text-lg font-semibold text-zinc-900 dark:text-zinc-100">
- New Workspace
- </Dialog.Title>
- <Dialog.Close
- asChild
- className="text-zinc-500 hover:text-zinc-700 dark:text-zinc-400 dark:hover:text-zinc-300"
- >
- <X size={20} />
- </Dialog.Close>
- </div>
+ <Dialog open={open} onOpenChange={handleClose}>
+ <DialogContent className="max-w-md" showCloseButton={false}>
+ <DialogHeader>
+ <DialogTitle asChild>
+ <Breadcrumb>
+ <BreadcrumbList>
+ <BreadcrumbItem className="text-zinc-600 dark:text-zinc-400 font-semibold tracking-wider text-sm">
+ KANEO
+ </BreadcrumbItem>
+ <BreadcrumbSeparator />
+ <BreadcrumbItem className="text-zinc-700 dark:text-zinc-300 font-medium text-sm">
+ Create a new workspace
+ </BreadcrumbItem>
+ </BreadcrumbList>
+ </Breadcrumb>
+ </DialogTitle>
+ <DialogDescription className="sr-only">
+ Create a new workspace by providing a name for your workspace.
+ </DialogDescription>
+ </DialogHeader>
- <form onSubmit={handleSubmit} className="p-4">
- <div className="mb-4">
- <label
- htmlFor="workspaceName"
- aria-label="Workspace name"
- className="block text-sm font-medium text-zinc-900 dark:text-zinc-300 mb-1"
- >
- Workspace Name
- </label>
- <Input
- value={name}
- onChange={(e) => setName(e.target.value)}
- placeholder="My Workspace"
- className="bg-white dark:bg-zinc-800/50"
- required
- autoFocus
- />
- </div>
+ <form onSubmit={handleSubmit} className="space-y-6">
+ <div className="space-y-4 px-6">
+ <Input
+ ref={inputRef}
+ value={name}
+ onChange={(e) => setName(e.target.value)}
+ placeholder="Workspace name"
+ className="!text-2xl font-semibold !border-0 px-0 py-3 !shadow-none focus-visible:!ring-0 !bg-transparent text-zinc-900 dark:text-white placeholder:text-zinc-500 dark:placeholder:text-zinc-400 tracking-tight focus:!outline-none focus-visible:!outline-none"
+ required
+ />
- <div className="flex justify-end gap-2">
- <Dialog.Close asChild>
- <Button
- type="button"
- className="bg-zinc-100 text-zinc-900 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-100 dark:hover:bg-zinc-700"
- >
- Cancel
- </Button>
- </Dialog.Close>
- <Button
- type="submit"
- disabled={!name.trim()}
- className="bg-indigo-600 text-white hover:bg-indigo-500 dark:bg-indigo-500 dark:hover:bg-indigo-400"
- >
- Create Workspace
- </Button>
- </div>
- </form>
+ <Input
+ value={description}
+ onChange={(e) => setDescription(e.target.value)}
+ placeholder="Add description..."
+ className="!border-0 px-0 py-2 !shadow-none focus-visible:!ring-0 !bg-transparent text-zinc-700 dark:text-zinc-300 placeholder:text-zinc-500 dark:placeholder:text-zinc-400 focus:!outline-none focus-visible:!outline-none"
+ />
</div>
- </Dialog.Content>
- </Dialog.Portal>
- </Dialog.Root>
+
+ <DialogFooter>
+ <Button
+ type="button"
+ onClick={handleClose}
+ variant="outline"
+ size="sm"
+ className="border-zinc-300 dark:border-zinc-700 text-zinc-700 dark:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800"
+ >
+ Cancel
+ </Button>
+ <Button
+ type="submit"
+ disabled={!name.trim()}
+ size="sm"
+ className="bg-indigo-600 hover:bg-indigo-500 text-white disabled:opacity-50"
+ >
+ Create Workspace
+ </Button>
+ </DialogFooter>
+ </form>
+ </DialogContent>
+ </Dialog>
);
}
diff --git a/apps/web/src/components/task/task-activities.tsx b/apps/web/src/components/task/task-activities.tsx
index 756fef6ac..4f524b28e 100644
--- a/apps/web/src/components/task/task-activities.tsx
+++ b/apps/web/src/components/task/task-activities.tsx
@@ -2,7 +2,7 @@ import { Avatar, AvatarFallback } from "@/components/ui/avatar";
import useDeleteComment from "@/hooks/mutations/comment/use-delete-comment";
import useGetActivitiesByTaskId from "@/hooks/queries/activity/use-get-activities-by-task-id";
import { cn } from "@/lib/cn";
-import { Route } from "@/routes/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId";
+import { Route } from "@/routes/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_";
import { formatDistanceToNow } from "date-fns";
import { History, MessageSquare, Pencil, PlusCircle } from "lucide-react";
import { useState } from "react";
diff --git a/apps/web/src/components/task/task-comment.tsx b/apps/web/src/components/task/task-comment.tsx
index 16355fc98..3cb0a1b0f 100644
--- a/apps/web/src/components/task/task-comment.tsx
+++ b/apps/web/src/components/task/task-comment.tsx
@@ -3,7 +3,7 @@ import { Button } from "@/components/ui/button";
import { Form, FormControl, FormField, FormItem } from "@/components/ui/form";
import useCreateComment from "@/hooks/mutations/comment/use-create-comment";
import useUpdateComment from "@/hooks/mutations/comment/use-update-comment";
-import { Route } from "@/routes/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId";
+import { Route } from "@/routes/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_";
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
import { useQueryClient } from "@tanstack/react-query";
import { MessageSquare } from "lucide-react";
diff --git a/apps/web/src/components/task/task-description.tsx b/apps/web/src/components/task/task-description.tsx
index 5e7d19b54..b808fbee4 100644
--- a/apps/web/src/components/task/task-description.tsx
+++ b/apps/web/src/components/task/task-description.tsx
@@ -1,7 +1,7 @@
import useUpdateTask from "@/hooks/mutations/task/use-update-task";
import useGetTask from "@/hooks/queries/task/use-get-task";
import debounce from "@/lib/debounce";
-import { Route } from "@/routes/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId";
+import { Route } from "@/routes/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_";
import { useEffect } from "react";
import { useForm } from "react-hook-form";
import { Editor } from "../common/editor";
diff --git a/apps/web/src/components/task/task-info.tsx b/apps/web/src/components/task/task-info.tsx
index c7a224733..370ce9e5c 100644
--- a/apps/web/src/components/task/task-info.tsx
+++ b/apps/web/src/components/task/task-info.tsx
@@ -1,6 +1,12 @@
import { Button } from "@/components/ui/button";
import { Form, FormField, FormItem, FormLabel } from "@/components/ui/form";
-import { Select } from "@/components/ui/select";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
import useDeleteTask from "@/hooks/mutations/task/use-delete-task";
import useUpdateTask from "@/hooks/mutations/task/use-update-task";
import useGetActiveWorkspaceUsers from "@/hooks/queries/workspace-users/use-active-workspace-users";
@@ -8,7 +14,6 @@ import useProjectStore from "@/store/project";
import type Task from "@/types/task";
import { useQueryClient } from "@tanstack/react-query";
import { useNavigate } from "@tanstack/react-router";
-import { Flag } from "lucide-react";
import { useEffect } from "react";
import { useForm } from "react-hook-form";
import { toast } from "sonner";
@@ -111,18 +116,22 @@ function TaskInfo({
<FormLabel>Status</FormLabel>
<Select
value={field.value}
- placeholder="Select status"
- onChange={(value) => {
+ onValueChange={(value) => {
field.onChange(value);
handleChange({ ...form.getValues(), status: value });
}}
- options={
- project?.columns?.map((col) => ({
- value: col.id,
- label: col.name,
- })) || []
- }
- />
+ >
+ <SelectTrigger>
+ <SelectValue placeholder="Select status" />
+ </SelectTrigger>
+ <SelectContent>
+ {project?.columns?.map((column) => (
+ <SelectItem key={column.id} value={column.id}>
+ {column.name}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
</FormItem>
)}
/>
@@ -135,22 +144,25 @@ function TaskInfo({
<FormLabel>Assign to</FormLabel>
<Select
value={field.value}
- placeholder="Assign to"
- onChange={(value) => {
+ onValueChange={(value) => {
field.onChange(value);
handleChange({ ...form.getValues(), userEmail: value });
}}
- options={[
- {
- value: "",
- label: "Unassigned",
- },
- ...(workspaceUsers?.map((user) => ({
- value: user.userEmail ?? "",
- label: user.userName ?? "",
- })) || []),
- ]}
- />
+ >
+ <SelectTrigger>
+ <SelectValue placeholder="Select assignee" />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="unassigned">Unassigned</SelectItem>
+ {workspaceUsers?.map((user) => {
+ return (
+ <SelectItem key={user.userEmail} value={user.userEmail}>
+ {user.userName}
+ </SelectItem>
+ );
+ })}
+ </SelectContent>
+ </Select>
</FormItem>
)}
/>
@@ -162,34 +174,21 @@ function TaskInfo({
<FormLabel>Priority</FormLabel>
<Select
value={field.value || ""}
- placeholder="Select priority"
- onChange={(value) => {
+ onValueChange={(value) => {
field.onChange(value);
handleChange({ ...form.getValues(), priority: value });
}}
- options={[
- {
- value: "low",
- label: "Low",
- icon: <Flag className="w-4 h-4 text-blue-500" />,
- },
- {
- value: "medium",
- label: "Medium",
- icon: <Flag className="w-4 h-4 text-yellow-500" />,
- },
- {
- value: "high",
- label: "High",
- icon: <Flag className="w-4 h-4 text-red-500" />,
- },
- {
- value: "urgent",
- label: "Urgent",
- icon: <Flag className="w-4 h-4 text-red-500" />,
- },
- ]}
- />
+ >
+ <SelectTrigger>
+ <SelectValue placeholder="Select priority" />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="low">Low</SelectItem>
+ <SelectItem value="medium">Medium</SelectItem>
+ <SelectItem value="high">High</SelectItem>
+ <SelectItem value="urgent">Urgent</SelectItem>
+ </SelectContent>
+ </Select>
</FormItem>
)}
/>
diff --git a/apps/web/src/components/task/task-title.tsx b/apps/web/src/components/task/task-title.tsx
index cd22c4236..545f3ff3e 100644
--- a/apps/web/src/components/task/task-title.tsx
+++ b/apps/web/src/components/task/task-title.tsx
@@ -1,7 +1,7 @@
import useUpdateTask from "@/hooks/mutations/task/use-update-task";
import useGetTask from "@/hooks/queries/task/use-get-task";
import debounce from "@/lib/debounce";
-import { Route } from "@/routes/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId";
+import { Route } from "@/routes/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_";
import { useForm } from "react-hook-form";
import { toast } from "sonner";
import { z } from "zod/v4";
diff --git a/apps/web/src/components/team/delete-team-member-modal.tsx b/apps/web/src/components/team/delete-team-member-modal.tsx
index 52cf02d77..2dcaff141 100644
--- a/apps/web/src/components/team/delete-team-member-modal.tsx
+++ b/apps/web/src/components/team/delete-team-member-modal.tsx
@@ -1,5 +1,5 @@
import useDeleteWorkspaceUser from "@/hooks/mutations/workspace-user/use-delete-workspace-user";
-import { Route } from "@/routes/dashboard/teams/$workspaceId/_layout";
+import { Route } from "@/routes/dashboard/workspace/$workspaceId/members";
import * as Dialog from "@radix-ui/react-dialog";
import { useQueryClient } from "@tanstack/react-query";
import { Trash2, X } from "lucide-react";
diff --git a/apps/web/src/components/team/invite-team-member-modal.tsx b/apps/web/src/components/team/invite-team-member-modal.tsx
index 58cfbd454..37c097c7d 100644
--- a/apps/web/src/components/team/invite-team-member-modal.tsx
+++ b/apps/web/src/components/team/invite-team-member-modal.tsx
@@ -1,5 +1,5 @@
import useInviteWorkspaceUser from "@/hooks/mutations/workspace-user/use-invite-workspace-user";
-import { Route } from "@/routes/dashboard/teams/$workspaceId/_layout";
+import { Route } from "@/routes/dashboard/workspace/$workspaceId/members";
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
import * as Dialog from "@radix-ui/react-dialog";
import { useQueryClient } from "@tanstack/react-query";
diff --git a/apps/web/src/components/team/members-table.tsx b/apps/web/src/components/team/members-table.tsx
index 67bcce33f..0fbaa1ed7 100644
--- a/apps/web/src/components/team/members-table.tsx
+++ b/apps/web/src/components/team/members-table.tsx
@@ -1,10 +1,23 @@
import { useWorkspacePermission } from "@/hooks/useWorkspacePermission";
import { getStatusIcon, getStatusText } from "@/lib/status";
import type WorkspaceUser from "@/types/workspace-user";
-import * as Popover from "@radix-ui/react-popover";
import { MoreHorizontal, Trash2 } from "lucide-react";
import { useState } from "react";
import { Avatar, AvatarFallback } from "../ui/avatar";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "../ui/dropdown-menu";
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from "../ui/table";
import DeleteTeamMemberModal from "./delete-team-member-modal";
function MembersTable({ users }: { users: WorkspaceUser[] }) {
@@ -14,114 +27,119 @@ function MembersTable({ users }: { users: WorkspaceUser[] }) {
null,
);
+ if (users?.length === 0) {
+ return (
+ <div className="flex items-center justify-center min-h-[60vh]">
+ <div className="text-center space-y-6">
+ <div className="w-16 h-16 mx-auto rounded-xl bg-muted flex items-center justify-center">
+ <span className="text-2xl">👥</span>
+ </div>
+ <div className="space-y-2">
+ <h3 className="text-xl font-semibold">No team members yet</h3>
+ <p className="text-muted-foreground">
+ Invite your first team member to get started.
+ </p>
+ </div>
+ </div>
+ </div>
+ );
+ }
+
return (
<>
- <table className="w-full table-auto min-w-[800px]">
- <thead>
- <tr className="border-b border-zinc-200 dark:border-zinc-800">
- <th className="text-left py-3 px-4 text-sm font-medium text-zinc-500 dark:text-zinc-400">
- Email
- </th>
- <th className="text-left py-3 px-4 text-sm font-medium text-zinc-500 dark:text-zinc-400">
- Role
- </th>
- <th className="text-left py-3 px-4 text-sm font-medium text-zinc-500 dark:text-zinc-400">
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead className="text-foreground font-medium">
+ Member
+ </TableHead>
+ <TableHead className="text-foreground font-medium">Role</TableHead>
+ <TableHead className="text-foreground font-medium">
Status
- </th>
- <th className="text-left py-3 px-4 text-sm font-medium text-zinc-500 dark:text-zinc-400">
- Date
- </th>
+ </TableHead>
+ <TableHead className="text-foreground font-medium">
+ Joined
+ </TableHead>
{isOwner && (
- <th className="text-left py-3 px-4 text-sm font-medium text-zinc-500 dark:text-zinc-400">
+ <TableHead className="text-foreground font-medium">
Actions
- </th>
+ </TableHead>
)}
- </tr>
- </thead>
- <tbody className="divide-y divide-zinc-200 dark:divide-zinc-800">
+ </TableRow>
+ </TableHeader>
+ <TableBody>
{users?.map((member) => (
- <tr
- key={member.userEmail}
- className="hover:bg-zinc-50 dark:hover:bg-zinc-800/50"
- >
- <td className="py-3 px-4">
- <div className="flex items-center">
- <Avatar className="h-8 w-8 mr-3">
- <AvatarFallback className="bg-indigo-100 dark:bg-indigo-900/50 text-indigo-600 dark:text-indigo-400">
- {member.userEmail?.charAt(0)}
+ <TableRow key={member.userEmail} className="cursor-pointer">
+ <TableCell className="py-3">
+ <div className="flex items-center gap-3">
+ <Avatar className="h-5 w-5">
+ <AvatarFallback className="bg-muted text-muted-foreground font-medium text-xs">
+ {member.userEmail?.charAt(0).toUpperCase()}
</AvatarFallback>
</Avatar>
- <span className="text-sm text-zinc-900 dark:text-zinc-100">
- {member.userEmail}
- </span>
+ <span className="font-medium">{member.userEmail}</span>
</div>
- </td>
- <td className="py-3 px-4">
- <span className="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-indigo-50 text-indigo-700 dark:bg-indigo-500/10 dark:text-indigo-400">
+ </TableCell>
+ <TableCell className="py-3">
+ <span className="inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-muted text-muted-foreground">
{member.role.charAt(0).toUpperCase() +
member.role.slice(1).toLowerCase()}
</span>
- </td>
- <td className="py-3 px-4">
+ </TableCell>
+ <TableCell className="py-3">
<div className="flex items-center gap-2">
{getStatusIcon(member.status as "active" | "pending")}
- <span className="text-sm text-zinc-600 dark:text-zinc-400">
+ <span className="text-sm text-muted-foreground">
{getStatusText(member.status as "active" | "pending")}
</span>
</div>
- </td>
- <td className="py-3 px-4 text-sm text-zinc-500 dark:text-zinc-400">
- {member.joinedAt &&
- new Date(member.joinedAt).toLocaleDateString("en-US", {
- month: "short",
- day: "numeric",
- year: "numeric",
- })}
- </td>
+ </TableCell>
+ <TableCell className="py-3">
+ <span className="text-sm text-muted-foreground">
+ {member.joinedAt &&
+ new Date(member.joinedAt).toLocaleDateString("en-US", {
+ month: "short",
+ day: "numeric",
+ year: "numeric",
+ })}
+ </span>
+ </TableCell>
{isOwner && (
- <td className="py-3 px-4">
+ <TableCell className="py-3">
{member.role === "owner" ? (
- <span className="text-xs text-zinc-400 dark:text-zinc-500 italic">
+ <span className="text-xs text-muted-foreground italic">
Workspace owner
</span>
) : (
- <Popover.Root>
- <Popover.Trigger asChild>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
<button
type="button"
- className="p-1 hover:bg-zinc-100 dark:hover:bg-zinc-800 rounded"
+ className="p-1 hover:bg-accent rounded"
>
- <MoreHorizontal className="w-4 h-4 text-zinc-500 dark:text-zinc-400" />
+ <MoreHorizontal className="w-4 h-4 text-muted-foreground" />
</button>
- </Popover.Trigger>
- <Popover.Portal>
- <Popover.Content
- className="bg-white dark:bg-zinc-900 rounded-md shadow-md border border-zinc-200 dark:border-zinc-700 p-1 z-50"
- sideOffset={5}
- align="end"
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem
+ onClick={() => {
+ setIsRemoveMemberModalOpen(true);
+ setSelectedMember(member);
+ }}
+ variant="destructive"
>
- <button
- type="button"
- onClick={() => {
- setIsRemoveMemberModalOpen(true);
- setSelectedMember(member);
- }}
- className="flex items-center gap-2 px-3 py-2 text-sm rounded text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300 hover:bg-red-50 dark:hover:bg-red-900/20 w-full text-left"
- >
- <Trash2 className="w-4 h-4" />
- <span>Remove member</span>
- </button>
- <Popover.Arrow className="fill-white dark:fill-zinc-900" />
- </Popover.Content>
- </Popover.Portal>
- </Popover.Root>
+ <Trash2 className="w-4 h-4" />
+ Remove member
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
)}
- </td>
+ </TableCell>
)}
- </tr>
+ </TableRow>
))}
- </tbody>
- </table>
+ </TableBody>
+ </Table>
{selectedMember && (
<DeleteTeamMemberModal
diff --git a/apps/web/src/components/ui/alert-dialog.tsx b/apps/web/src/components/ui/alert-dialog.tsx
new file mode 100644
index 000000000..8646b95c7
--- /dev/null
+++ b/apps/web/src/components/ui/alert-dialog.tsx
@@ -0,0 +1,155 @@
+import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
+import type * as React from "react";
+
+import { buttonVariants } from "@/components/ui/button";
+import { cn } from "@/lib/cn";
+
+function AlertDialog({
+ ...props
+}: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
+ return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />;
+}
+
+function AlertDialogTrigger({
+ ...props
+}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
+ return (
+ <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
+ );
+}
+
+function AlertDialogPortal({
+ ...props
+}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
+ return (
+ <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
+ );
+}
+
+function AlertDialogOverlay({
+ className,
+ ...props
+}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
+ return (
+ <AlertDialogPrimitive.Overlay
+ data-slot="alert-dialog-overlay"
+ className={cn(
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function AlertDialogContent({
+ className,
+ ...props
+}: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {
+ return (
+ <AlertDialogPortal>
+ <AlertDialogOverlay />
+ <AlertDialogPrimitive.Content
+ data-slot="alert-dialog-content"
+ className={cn(
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
+ className,
+ )}
+ {...props}
+ />
+ </AlertDialogPortal>
+ );
+}
+
+function AlertDialogHeader({
+ className,
+ ...props
+}: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="alert-dialog-header"
+ className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
+ {...props}
+ />
+ );
+}
+
+function AlertDialogFooter({
+ className,
+ ...props
+}: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="alert-dialog-footer"
+ className={cn(
+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function AlertDialogTitle({
+ className,
+ ...props
+}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
+ return (
+ <AlertDialogPrimitive.Title
+ data-slot="alert-dialog-title"
+ className={cn("text-lg font-semibold", className)}
+ {...props}
+ />
+ );
+}
+
+function AlertDialogDescription({
+ className,
+ ...props
+}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
+ return (
+ <AlertDialogPrimitive.Description
+ data-slot="alert-dialog-description"
+ className={cn("text-muted-foreground text-sm", className)}
+ {...props}
+ />
+ );
+}
+
+function AlertDialogAction({
+ className,
+ ...props
+}: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {
+ return (
+ <AlertDialogPrimitive.Action
+ className={cn(buttonVariants(), className)}
+ {...props}
+ />
+ );
+}
+
+function AlertDialogCancel({
+ className,
+ ...props
+}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
+ return (
+ <AlertDialogPrimitive.Cancel
+ className={cn(buttonVariants({ variant: "outline" }), className)}
+ {...props}
+ />
+ );
+}
+
+export {
+ AlertDialog,
+ AlertDialogPortal,
+ AlertDialogOverlay,
+ AlertDialogTrigger,
+ AlertDialogContent,
+ AlertDialogHeader,
+ AlertDialogFooter,
+ AlertDialogTitle,
+ AlertDialogDescription,
+ AlertDialogAction,
+ AlertDialogCancel,
+};
diff --git a/apps/web/src/components/ui/breadcrumb.tsx b/apps/web/src/components/ui/breadcrumb.tsx
new file mode 100644
index 000000000..74feb915f
--- /dev/null
+++ b/apps/web/src/components/ui/breadcrumb.tsx
@@ -0,0 +1,110 @@
+import { Slot } from "@radix-ui/react-slot";
+import { ChevronRight, MoreHorizontal } from "lucide-react";
+import type * as React from "react";
+
+import { cn } from "@/lib/cn";
+
+function Breadcrumb({ ...props }: React.ComponentProps<"nav">) {
+ return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />;
+}
+
+function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">) {
+ return (
+ <ol
+ data-slot="breadcrumb-list"
+ className={cn(
+ "text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">) {
+ return (
+ <li
+ data-slot="breadcrumb-item"
+ className={cn("inline-flex items-center gap-1.5", className)}
+ {...props}
+ />
+ );
+}
+
+function BreadcrumbLink({
+ asChild,
+ className,
+ ...props
+}: React.ComponentProps<"a"> & {
+ asChild?: boolean;
+}) {
+ const Comp = asChild ? Slot : "a";
+
+ return (
+ <Comp
+ data-slot="breadcrumb-link"
+ className={cn("hover:text-foreground transition-colors", className)}
+ {...props}
+ />
+ );
+}
+
+function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) {
+ return (
+ <span
+ data-slot="breadcrumb-page"
+ role="link"
+ aria-disabled="true"
+ aria-current="page"
+ tabIndex={0}
+ className={cn("text-foreground font-normal", className)}
+ {...props}
+ />
+ );
+}
+
+function BreadcrumbSeparator({
+ children,
+ className,
+ ...props
+}: React.ComponentProps<"li">) {
+ return (
+ <li
+ data-slot="breadcrumb-separator"
+ role="presentation"
+ aria-hidden="true"
+ className={cn("[&>svg]:size-3.5", className)}
+ {...props}
+ >
+ {children ?? <ChevronRight />}
+ </li>
+ );
+}
+
+function BreadcrumbEllipsis({
+ className,
+ ...props
+}: React.ComponentProps<"span">) {
+ return (
+ <span
+ data-slot="breadcrumb-ellipsis"
+ role="presentation"
+ aria-hidden="true"
+ className={cn("flex size-9 items-center justify-center", className)}
+ {...props}
+ >
+ <MoreHorizontal className="size-4" />
+ <span className="sr-only">More</span>
+ </span>
+ );
+}
+
+export {
+ Breadcrumb,
+ BreadcrumbList,
+ BreadcrumbItem,
+ BreadcrumbLink,
+ BreadcrumbPage,
+ BreadcrumbSeparator,
+ BreadcrumbEllipsis,
+};
diff --git a/apps/web/src/components/ui/button.tsx b/apps/web/src/components/ui/button.tsx
index 9d5c9d1cd..6f61b581e 100644
--- a/apps/web/src/components/ui/button.tsx
+++ b/apps/web/src/components/ui/button.tsx
@@ -24,6 +24,7 @@ const buttonVariants = cva(
size: {
default: "h-9 px-4 py-2 has-[>svg]:px-3",
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
+ xs: "h-6 rounded-md gap-1 px-2 text-xs has-[>svg]:px-1.5",
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
icon: "size-9",
},
@@ -50,7 +51,7 @@ function Button({
return (
<Comp
data-slot="button"
- className={cn(buttonVariants({ variant, size, className }))}
+ className={cn(buttonVariants({ variant, size: size || "sm", className }))}
{...props}
/>
);
diff --git a/apps/web/src/components/ui/calendar.tsx b/apps/web/src/components/ui/calendar.tsx
index 07239d4bc..6314f6e64 100644
--- a/apps/web/src/components/ui/calendar.tsx
+++ b/apps/web/src/components/ui/calendar.tsx
@@ -31,7 +31,7 @@ function Calendar({
<DayPicker
showOutsideDays={showOutsideDays}
className={cn(
- "bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
+ "bg-popover group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
className,
@@ -55,12 +55,12 @@ function Calendar({
),
button_previous: cn(
buttonVariants({ variant: buttonVariant }),
- "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none hover:bg-zinc-100 dark:hover:bg-zinc-800",
+ "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
defaultClassNames.button_previous,
),
button_next: cn(
buttonVariants({ variant: buttonVariant }),
- "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none hover:bg-zinc-100 dark:hover:bg-zinc-800",
+ "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
defaultClassNames.button_next,
),
month_caption: cn(
@@ -72,21 +72,24 @@ function Calendar({
defaultClassNames.dropdowns,
),
dropdown_root: cn(
- "relative has-focus:border-zinc-300 dark:has-focus:border-zinc-600 border border-zinc-200 dark:border-zinc-800 shadow-xs has-focus:ring-zinc-200/50 dark:has-focus:ring-zinc-700/50 has-focus:ring-[3px] rounded-md",
+ "relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",
defaultClassNames.dropdown_root,
),
- dropdown: cn("absolute inset-0 opacity-0", defaultClassNames.dropdown),
+ dropdown: cn(
+ "absolute bg-popover inset-0 opacity-0",
+ defaultClassNames.dropdown,
+ ),
caption_label: cn(
- "select-none font-medium text-zinc-900 dark:text-zinc-100",
+ "select-none font-medium",
captionLayout === "label"
? "text-sm"
- : "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-zinc-500 dark:text-zinc-400 [&>svg]:size-3.5",
+ : "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",
defaultClassNames.caption_label,
),
table: "w-full border-collapse",
weekdays: cn("flex", defaultClassNames.weekdays),
weekday: cn(
- "text-zinc-500 dark:text-zinc-400 rounded-md flex-1 font-normal text-[0.8rem] select-none",
+ "text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",
defaultClassNames.weekday,
),
week: cn("flex w-full mt-2", defaultClassNames.week),
@@ -95,7 +98,7 @@ function Calendar({
defaultClassNames.week_number_header,
),
week_number: cn(
- "text-[0.8rem] select-none text-zinc-500 dark:text-zinc-400",
+ "text-[0.8rem] select-none text-muted-foreground",
defaultClassNames.week_number,
),
day: cn(
@@ -103,24 +106,21 @@ function Calendar({
defaultClassNames.day,
),
range_start: cn(
- "rounded-l-md bg-indigo-500/10 dark:bg-indigo-500/20",
+ "rounded-l-md bg-accent",
defaultClassNames.range_start,
),
range_middle: cn("rounded-none", defaultClassNames.range_middle),
- range_end: cn(
- "rounded-r-md bg-indigo-500/10 dark:bg-indigo-500/20",
- defaultClassNames.range_end,
- ),
+ range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
today: cn(
- "bg-indigo-500/10 dark:bg-indigo-500/20 text-indigo-600 dark:text-indigo-400 rounded-md data-[selected=true]:rounded-none",
+ "bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
defaultClassNames.today,
),
outside: cn(
- "text-zinc-400 dark:text-zinc-500 aria-selected:text-zinc-400 dark:aria-selected:text-zinc-500",
+ "text-muted-foreground aria-selected:text-muted-foreground",
defaultClassNames.outside,
),
disabled: cn(
- "text-zinc-400 dark:text-zinc-500 opacity-50",
+ "text-muted-foreground opacity-50",
defaultClassNames.disabled,
),
hidden: cn("invisible", defaultClassNames.hidden),
@@ -140,36 +140,21 @@ function Calendar({
Chevron: ({ className, orientation, ...props }) => {
if (orientation === "left") {
return (
- <ChevronLeftIcon
- className={cn(
- "size-4 text-zinc-600 dark:text-zinc-400",
- className,
- )}
- {...props}
- />
+ <ChevronLeftIcon className={cn("size-4", className)} {...props} />
);
}
if (orientation === "right") {
return (
<ChevronRightIcon
- className={cn(
- "size-4 text-zinc-600 dark:text-zinc-400",
- className,
- )}
+ className={cn("size-4", className)}
{...props}
/>
);
}
return (
- <ChevronDownIcon
- className={cn(
- "size-4 text-zinc-600 dark:text-zinc-400",
- className,
- )}
- {...props}
- />
+ <ChevronDownIcon className={cn("size-4", className)} {...props} />
);
},
DayButton: CalendarDayButton,
@@ -218,7 +203,7 @@ function CalendarDayButton({
data-range-end={modifiers.range_end}
data-range-middle={modifiers.range_middle}
className={cn(
- "data-[selected-single=true]:bg-indigo-600 dark:data-[selected-single=true]:bg-indigo-500 data-[selected-single=true]:text-white dark:data-[selected-single=true]:text-white data-[range-middle=true]:bg-indigo-500/10 dark:data-[range-middle=true]:bg-indigo-500/20 data-[range-middle=true]:text-indigo-600 dark:data-[range-middle=true]:text-indigo-400 data-[range-start=true]:bg-indigo-600 dark:data-[range-start=true]:bg-indigo-500 data-[range-start=true]:text-white dark:data-[range-start=true]:text-white data-[range-end=true]:bg-indigo-600 dark:data-[range-end=true]:bg-indigo-500 data-[range-end=true]:text-white dark:data-[range-end=true]:text-white group-data-[focused=true]/day:border-indigo-500 dark:group-data-[focused=true]/day:border-indigo-400 group-data-[focused=true]/day:ring-indigo-500/20 dark:group-data-[focused=true]/day:ring-indigo-400/30 hover:bg-zinc-100 dark:hover:bg-zinc-800 hover:text-zinc-900 dark:hover:text-zinc-100 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",
+ "data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",
defaultClassNames.day,
className,
)}
diff --git a/apps/web/src/components/ui/collapsible.tsx b/apps/web/src/components/ui/collapsible.tsx
new file mode 100644
index 000000000..90935c6b2
--- /dev/null
+++ b/apps/web/src/components/ui/collapsible.tsx
@@ -0,0 +1,33 @@
+"use client";
+
+import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
+
+function Collapsible({
+ ...props
+}: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
+ return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />;
+}
+
+function CollapsibleTrigger({
+ ...props
+}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
+ return (
+ <CollapsiblePrimitive.CollapsibleTrigger
+ data-slot="collapsible-trigger"
+ {...props}
+ />
+ );
+}
+
+function CollapsibleContent({
+ ...props
+}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
+ return (
+ <CollapsiblePrimitive.CollapsibleContent
+ data-slot="collapsible-content"
+ {...props}
+ />
+ );
+}
+
+export { Collapsible, CollapsibleTrigger, CollapsibleContent };
diff --git a/apps/web/src/components/ui/command.tsx b/apps/web/src/components/ui/command.tsx
new file mode 100644
index 000000000..62d75073f
--- /dev/null
+++ b/apps/web/src/components/ui/command.tsx
@@ -0,0 +1,182 @@
+import { Command as CommandPrimitive } from "cmdk";
+import { SearchIcon } from "lucide-react";
+import type * as React from "react";
+
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogHeader,
+ DialogTitle,
+} from "@/components/ui/dialog";
+import { cn } from "@/lib/cn";
+
+function Command({
+ className,
+ ...props
+}: React.ComponentProps<typeof CommandPrimitive>) {
+ return (
+ <CommandPrimitive
+ data-slot="command"
+ className={cn(
+ "bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function CommandDialog({
+ title = "Command Palette",
+ description = "Search for a command to run...",
+ children,
+ className,
+ showCloseButton = true,
+ ...props
+}: React.ComponentProps<typeof Dialog> & {
+ title?: string;
+ description?: string;
+ className?: string;
+ showCloseButton?: boolean;
+}) {
+ return (
+ <Dialog {...props}>
+ <DialogHeader className="sr-only">
+ <DialogTitle>{title}</DialogTitle>
+ <DialogDescription>{description}</DialogDescription>
+ </DialogHeader>
+ <DialogContent
+ className={cn("overflow-hidden p-0", className)}
+ showCloseButton={showCloseButton}
+ >
+ <Command className="[&_[cmdk-group-heading]]:text-muted-foreground [&_[data-slot=command-input-wrapper]]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
+ {children}
+ </Command>
+ </DialogContent>
+ </Dialog>
+ );
+}
+
+function CommandInput({
+ className,
+ ...props
+}: React.ComponentProps<typeof CommandPrimitive.Input>) {
+ return (
+ <div
+ data-slot="command-input-wrapper"
+ className="flex h-9 items-center gap-2 border-b px-3"
+ >
+ <SearchIcon className="size-4 shrink-0 opacity-50" />
+ <CommandPrimitive.Input
+ data-slot="command-input"
+ className={cn(
+ "placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
+ className,
+ )}
+ {...props}
+ />
+ </div>
+ );
+}
+
+function CommandList({
+ className,
+ ...props
+}: React.ComponentProps<typeof CommandPrimitive.List>) {
+ return (
+ <CommandPrimitive.List
+ data-slot="command-list"
+ className={cn(
+ "max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function CommandEmpty({
+ ...props
+}: React.ComponentProps<typeof CommandPrimitive.Empty>) {
+ return (
+ <CommandPrimitive.Empty
+ data-slot="command-empty"
+ className="py-6 text-center text-sm"
+ {...props}
+ />
+ );
+}
+
+function CommandGroup({
+ className,
+ ...props
+}: React.ComponentProps<typeof CommandPrimitive.Group>) {
+ return (
+ <CommandPrimitive.Group
+ data-slot="command-group"
+ className={cn(
+ "text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function CommandSeparator({
+ className,
+ ...props
+}: React.ComponentProps<typeof CommandPrimitive.Separator>) {
+ return (
+ <CommandPrimitive.Separator
+ data-slot="command-separator"
+ className={cn("bg-border -mx-1 h-px", className)}
+ {...props}
+ />
+ );
+}
+
+function CommandItem({
+ className,
+ ...props
+}: React.ComponentProps<typeof CommandPrimitive.Item>) {
+ return (
+ <CommandPrimitive.Item
+ data-slot="command-item"
+ className={cn(
+ "data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function CommandShortcut({
+ className,
+ ...props
+}: React.ComponentProps<"span">) {
+ return (
+ <span
+ data-slot="command-shortcut"
+ className={cn(
+ "text-muted-foreground ml-auto text-xs tracking-widest",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+export {
+ Command,
+ CommandDialog,
+ CommandInput,
+ CommandList,
+ CommandEmpty,
+ CommandGroup,
+ CommandItem,
+ CommandShortcut,
+ CommandSeparator,
+};
diff --git a/apps/web/src/components/ui/context-menu.tsx b/apps/web/src/components/ui/context-menu.tsx
index 549c02e7f..f5454ae06 100644
--- a/apps/web/src/components/ui/context-menu.tsx
+++ b/apps/web/src/components/ui/context-menu.tsx
@@ -1,177 +1,235 @@
-import { cn } from "@/lib/cn";
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
-import { ChevronRight, Circle } from "lucide-react";
-import * as React from "react";
-
-const ContextMenu = ContextMenuPrimitive.Root;
-
-const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
-
-const ContextMenuGroup = ContextMenuPrimitive.Group;
-
-const ContextMenuPortal = ContextMenuPrimitive.Portal;
-
-const ContextMenuSub = ContextMenuPrimitive.Sub;
-
-const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
-
-const ContextMenuSubTrigger = React.forwardRef<
- React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
- inset?: boolean;
- }
->(({ className, inset, children, ...props }, ref) => (
- <ContextMenuPrimitive.SubTrigger
- ref={ref}
- className={cn(
- "flex cursor-default select-none items-center px-2 py-1 text-sm outline-none text-zinc-600 rounded-sm dark:text-zinc-400 focus:bg-zinc-100 dark:focus:bg-zinc-800 data-[state=open]:bg-zinc-100 dark:data-[state=open]:bg-zinc-800",
- inset && "pl-8",
- className,
- )}
- {...props}
- >
- {children}
- <ChevronRight className="ml-auto h-4 w-4" />
- </ContextMenuPrimitive.SubTrigger>
-));
-ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
-
-const ContextMenuSubContent = React.forwardRef<
- React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
->(({ className, ...props }, ref) => (
- <ContextMenuPrimitive.SubContent
- ref={ref}
- className={cn(
- "z-50 min-w-[8rem] overflow-hidden rounded-md border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",
- className,
- )}
- {...props}
- />
-));
-ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
-
-const ContextMenuContent = React.forwardRef<
- React.ElementRef<typeof ContextMenuPrimitive.Content>,
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
->(({ className, ...props }, ref) => (
- <ContextMenuPrimitive.Portal>
- <ContextMenuPrimitive.Content
- ref={ref}
+import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
+import type * as React from "react";
+
+import { cn } from "@/lib/cn";
+
+function ContextMenu({
+ ...props
+}: React.ComponentProps<typeof ContextMenuPrimitive.Root>) {
+ return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />;
+}
+
+function ContextMenuTrigger({
+ ...props
+}: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) {
+ return (
+ <ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" {...props} />
+ );
+}
+
+function ContextMenuGroup({
+ ...props
+}: React.ComponentProps<typeof ContextMenuPrimitive.Group>) {
+ return (
+ <ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />
+ );
+}
+
+function ContextMenuPortal({
+ ...props
+}: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) {
+ return (
+ <ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />
+ );
+}
+
+function ContextMenuSub({
+ ...props
+}: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) {
+ return <ContextMenuPrimitive.Sub data-slot="context-menu-sub" {...props} />;
+}
+
+function ContextMenuRadioGroup({
+ ...props
+}: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {
+ return (
+ <ContextMenuPrimitive.RadioGroup
+ data-slot="context-menu-radio-group"
+ {...props}
+ />
+ );
+}
+
+function ContextMenuSubTrigger({
+ className,
+ inset,
+ children,
+ ...props
+}: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {
+ inset?: boolean;
+}) {
+ return (
+ <ContextMenuPrimitive.SubTrigger
+ data-slot="context-menu-sub-trigger"
+ data-inset={inset}
className={cn(
- "z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border border-zinc-200 bg-white p-1 dark:border-zinc-800 dark:bg-zinc-900 shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",
+ "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ <ChevronRightIcon className="ml-auto" />
+ </ContextMenuPrimitive.SubTrigger>
+ );
+}
+
+function ContextMenuSubContent({
+ className,
+ ...props
+}: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {
+ return (
+ <ContextMenuPrimitive.SubContent
+ data-slot="context-menu-sub-content"
+ className={cn(
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
className,
)}
{...props}
/>
- </ContextMenuPrimitive.Portal>
-));
-ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
-
-const ContextMenuItem = React.forwardRef<
- React.ElementRef<typeof ContextMenuPrimitive.Item>,
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
- inset?: boolean;
- }
->(({ className, inset, ...props }, ref) => (
- <ContextMenuPrimitive.Item
- ref={ref}
- className={cn(
- "relative flex cursor-default select-none items-center focus:bg-accent rounded-sm px-2 py-1 text-sm outline-none text-zinc-600 dark:text-zinc-400 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
- inset && "pl-8",
- className,
- )}
- {...props}
- />
-));
-ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
-
-const ContextMenuCheckboxItem = React.forwardRef<
- React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
->(({ className, children, checked, ...props }, ref) => (
- <ContextMenuPrimitive.CheckboxItem
- ref={ref}
- className={cn(
- "relative flex cursor-default select-none items-center py-1 px-2 text-sm outline-none text-zinc-600 dark:text-zinc-400 hover:bg-indigo-50 focus:bg-zinc-100 dark:focus:bg-zinc-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[state=checked]:bg-indigo-50 data-[state=checked]:text-indigo-600 dark:data-[state=checked]:bg-indigo-500/10 dark:data-[state=checked]:text-indigo-400",
- className,
- )}
- checked={checked}
- {...props}
- >
- {children}
- </ContextMenuPrimitive.CheckboxItem>
-));
-ContextMenuCheckboxItem.displayName =
- ContextMenuPrimitive.CheckboxItem.displayName;
-
-const ContextMenuRadioItem = React.forwardRef<
- React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
->(({ className, children, ...props }, ref) => (
- <ContextMenuPrimitive.RadioItem
- ref={ref}
- className={cn(
- "relative flex cursor-default select-none items-center py-1 pl-8 pr-2 text-sm outline-none text-zinc-600 dark:text-zinc-400 hover:bg-indigo-50 focus:bg-indigo-50 focus:text-indigo-600 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
- className,
- )}
- {...props}
- >
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
- <ContextMenuPrimitive.ItemIndicator>
- <Circle className="h-4 w-4 fill-indigo-600 dark:fill-indigo-400" />
- </ContextMenuPrimitive.ItemIndicator>
- </span>
- {children}
- </ContextMenuPrimitive.RadioItem>
-));
-ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
-
-const ContextMenuLabel = React.forwardRef<
- React.ElementRef<typeof ContextMenuPrimitive.Label>,
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
- inset?: boolean;
- }
->(({ className, inset, ...props }, ref) => (
- <ContextMenuPrimitive.Label
- ref={ref}
- className={cn(
- "px-2 py-1 text-sm font-semibold text-zinc-500 dark:text-zinc-400",
- inset && "pl-8",
- className,
- )}
- {...props}
- />
-));
-ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
-
-const ContextMenuSeparator = React.forwardRef<
- React.ElementRef<typeof ContextMenuPrimitive.Separator>,
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
->(({ className, ...props }, ref) => (
- <ContextMenuPrimitive.Separator
- ref={ref}
- className={cn("-mx-1 my-1 h-px bg-zinc-200 dark:bg-zinc-800", className)}
- {...props}
- />
-));
-ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
-
-const ContextMenuShortcut = ({
+ );
+}
+
+function ContextMenuContent({
className,
...props
-}: React.HTMLAttributes<HTMLSpanElement>) => {
+}: React.ComponentProps<typeof ContextMenuPrimitive.Content>) {
+ return (
+ <ContextMenuPrimitive.Portal>
+ <ContextMenuPrimitive.Content
+ data-slot="context-menu-content"
+ className={cn(
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
+ className,
+ )}
+ {...props}
+ />
+ </ContextMenuPrimitive.Portal>
+ );
+}
+
+function ContextMenuItem({
+ className,
+ inset,
+ variant = "default",
+ ...props
+}: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
+ inset?: boolean;
+ variant?: "default" | "destructive";
+}) {
+ return (
+ <ContextMenuPrimitive.Item
+ data-slot="context-menu-item"
+ data-inset={inset}
+ data-variant={variant}
+ className={cn(
+ "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function ContextMenuCheckboxItem({
+ className,
+ children,
+ checked,
+ ...props
+}: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) {
+ return (
+ <ContextMenuPrimitive.CheckboxItem
+ data-slot="context-menu-checkbox-item"
+ className={cn(
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ className,
+ )}
+ checked={checked}
+ {...props}
+ >
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
+ <ContextMenuPrimitive.ItemIndicator>
+ <CheckIcon className="size-4" />
+ </ContextMenuPrimitive.ItemIndicator>
+ </span>
+ {children}
+ </ContextMenuPrimitive.CheckboxItem>
+ );
+}
+
+function ContextMenuRadioItem({
+ className,
+ children,
+ ...props
+}: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem>) {
+ return (
+ <ContextMenuPrimitive.RadioItem
+ data-slot="context-menu-radio-item"
+ className={cn(
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ className,
+ )}
+ {...props}
+ >
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
+ <ContextMenuPrimitive.ItemIndicator>
+ <CircleIcon className="size-2 fill-current" />
+ </ContextMenuPrimitive.ItemIndicator>
+ </span>
+ {children}
+ </ContextMenuPrimitive.RadioItem>
+ );
+}
+
+function ContextMenuLabel({
+ className,
+ inset,
+ ...props
+}: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {
+ inset?: boolean;
+}) {
+ return (
+ <ContextMenuPrimitive.Label
+ data-slot="context-menu-label"
+ data-inset={inset}
+ className={cn(
+ "text-foreground px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function ContextMenuSeparator({
+ className,
+ ...props
+}: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {
+ return (
+ <ContextMenuPrimitive.Separator
+ data-slot="context-menu-separator"
+ className={cn("bg-border -mx-1 my-1 h-px", className)}
+ {...props}
+ />
+ );
+}
+
+function ContextMenuShortcut({
+ className,
+ ...props
+}: React.ComponentProps<"span">) {
return (
<span
+ data-slot="context-menu-shortcut"
className={cn(
- "ml-auto text-sm tracking-widest text-zinc-500 dark:text-zinc-400",
+ "text-muted-foreground ml-auto text-xs tracking-widest",
className,
)}
{...props}
/>
);
-};
-ContextMenuShortcut.displayName = "ContextMenuShortcut";
+}
export {
ContextMenu,
diff --git a/apps/web/src/components/ui/dialog.tsx b/apps/web/src/components/ui/dialog.tsx
index 8857d72c1..f9f0b7921 100644
--- a/apps/web/src/components/ui/dialog.tsx
+++ b/apps/web/src/components/ui/dialog.tsx
@@ -1,120 +1,141 @@
import * as DialogPrimitive from "@radix-ui/react-dialog";
-import { X } from "lucide-react";
-import * as React from "react";
+import { XIcon } from "lucide-react";
+import type * as React from "react";
import { cn } from "@/lib/cn";
-const Dialog = DialogPrimitive.Root;
-
-const DialogTrigger = DialogPrimitive.Trigger;
+function Dialog({
+ ...props
+}: React.ComponentProps<typeof DialogPrimitive.Root>) {
+ return <DialogPrimitive.Root data-slot="dialog" {...props} />;
+}
-const DialogPortal = DialogPrimitive.Portal;
+function DialogTrigger({
+ ...props
+}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
+}
-const DialogClose = DialogPrimitive.Close;
+function DialogPortal({
+ ...props
+}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
+}
-const DialogOverlay = React.forwardRef<
- React.ElementRef<typeof DialogPrimitive.Overlay>,
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
->(({ className, ...props }, ref) => (
- <DialogPrimitive.Overlay
- ref={ref}
- className={cn(
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
- className,
- )}
- {...props}
- />
-));
-DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
+function DialogClose({
+ ...props
+}: React.ComponentProps<typeof DialogPrimitive.Close>) {
+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
+}
-const DialogContent = React.forwardRef<
- React.ElementRef<typeof DialogPrimitive.Content>,
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
->(({ className, children, ...props }, ref) => (
- <DialogPortal>
- <DialogOverlay />
- <DialogPrimitive.Content
- ref={ref}
+function DialogOverlay({
+ className,
+ ...props
+}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
+ return (
+ <DialogPrimitive.Overlay
+ data-slot="dialog-overlay"
className={cn(
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
className,
)}
{...props}
- >
- {children}
- <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
- <X className="h-4 w-4" />
- <span className="sr-only">Close</span>
- </DialogPrimitive.Close>
- </DialogPrimitive.Content>
- </DialogPortal>
-));
-DialogContent.displayName = DialogPrimitive.Content.displayName;
+ />
+ );
+}
-const DialogHeader = ({
+function DialogContent({
className,
+ children,
+ showCloseButton = true,
...props
-}: React.HTMLAttributes<HTMLDivElement>) => (
- <div
- className={cn(
- "flex flex-col space-y-1.5 text-center sm:text-left",
- className,
- )}
- {...props}
- />
-);
-DialogHeader.displayName = "DialogHeader";
+}: React.ComponentProps<typeof DialogPrimitive.Content> & {
+ showCloseButton?: boolean;
+}) {
+ return (
+ <DialogPortal data-slot="dialog-portal">
+ <DialogOverlay />
+ <DialogPrimitive.Content
+ data-slot="dialog-content"
+ className={cn(
+ "bg-card border border-border backdrop-blur-xl shadow-2xl data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] rounded-lg duration-200 sm:max-w-md",
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ {showCloseButton && (
+ <DialogPrimitive.Close
+ data-slot="dialog-close"
+ className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-3 right-3 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
+ >
+ <XIcon />
+ <span className="sr-only">Close</span>
+ </DialogPrimitive.Close>
+ )}
+ </DialogPrimitive.Content>
+ </DialogPortal>
+ );
+}
-const DialogFooter = ({
+function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="dialog-header"
+ className={cn("pb-6 px-6 pt-6", className)}
+ {...props}
+ />
+ );
+}
+
+function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="dialog-footer"
+ className={cn(
+ "flex items-center justify-end gap-3 pt-4 px-4 pb-4 border-t border-border",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function DialogTitle({
className,
...props
-}: React.HTMLAttributes<HTMLDivElement>) => (
- <div
- className={cn(
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
- className,
- )}
- {...props}
- />
-);
-DialogFooter.displayName = "DialogFooter";
-
-const DialogTitle = React.forwardRef<
- React.ElementRef<typeof DialogPrimitive.Title>,
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
->(({ className, ...props }, ref) => (
- <DialogPrimitive.Title
- ref={ref}
- className={cn(
- "text-lg font-semibold leading-none tracking-tight",
- className,
- )}
- {...props}
- />
-));
-DialogTitle.displayName = DialogPrimitive.Title.displayName;
+}: React.ComponentProps<typeof DialogPrimitive.Title>) {
+ return (
+ <DialogPrimitive.Title
+ data-slot="dialog-title"
+ className={cn("text-lg leading-none font-semibold", className)}
+ {...props}
+ />
+ );
+}
-const DialogDescription = React.forwardRef<
- React.ElementRef<typeof DialogPrimitive.Description>,
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
->(({ className, ...props }, ref) => (
- <DialogPrimitive.Description
- ref={ref}
- className={cn("text-sm text-muted-foreground", className)}
- {...props}
- />
-));
-DialogDescription.displayName = DialogPrimitive.Description.displayName;
+function DialogDescription({
+ className,
+ ...props
+}: React.ComponentProps<typeof DialogPrimitive.Description>) {
+ return (
+ <DialogPrimitive.Description
+ data-slot="dialog-description"
+ className={cn("text-muted-foreground text-sm", className)}
+ {...props}
+ />
+ );
+}
export {
Dialog,
- DialogPortal,
- DialogOverlay,
- DialogTrigger,
DialogClose,
DialogContent,
- DialogHeader,
+ DialogDescription,
DialogFooter,
+ DialogHeader,
+ DialogOverlay,
+ DialogPortal,
DialogTitle,
- DialogDescription,
+ DialogTrigger,
};
diff --git a/apps/web/src/components/ui/dropdown-menu.tsx b/apps/web/src/components/ui/dropdown-menu.tsx
new file mode 100644
index 000000000..ca87428e3
--- /dev/null
+++ b/apps/web/src/components/ui/dropdown-menu.tsx
@@ -0,0 +1,255 @@
+import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
+import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
+import type * as React from "react";
+
+import { cn } from "@/lib/cn";
+
+function DropdownMenu({
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
+ return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
+}
+
+function DropdownMenuPortal({
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
+ return (
+ <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
+ );
+}
+
+function DropdownMenuTrigger({
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
+ return (
+ <DropdownMenuPrimitive.Trigger
+ data-slot="dropdown-menu-trigger"
+ {...props}
+ />
+ );
+}
+
+function DropdownMenuContent({
+ className,
+ sideOffset = 4,
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
+ return (
+ <DropdownMenuPrimitive.Portal>
+ <DropdownMenuPrimitive.Content
+ data-slot="dropdown-menu-content"
+ sideOffset={sideOffset}
+ className={cn(
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
+ className,
+ )}
+ {...props}
+ />
+ </DropdownMenuPrimitive.Portal>
+ );
+}
+
+function DropdownMenuGroup({
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
+ return (
+ <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
+ );
+}
+
+function DropdownMenuItem({
+ className,
+ inset,
+ variant = "default",
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
+ inset?: boolean;
+ variant?: "default" | "destructive";
+}) {
+ return (
+ <DropdownMenuPrimitive.Item
+ data-slot="dropdown-menu-item"
+ data-inset={inset}
+ data-variant={variant}
+ className={cn(
+ "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function DropdownMenuCheckboxItem({
+ className,
+ children,
+ checked,
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
+ return (
+ <DropdownMenuPrimitive.CheckboxItem
+ data-slot="dropdown-menu-checkbox-item"
+ className={cn(
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ className,
+ )}
+ checked={checked}
+ {...props}
+ >
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
+ <DropdownMenuPrimitive.ItemIndicator>
+ <CheckIcon className="size-4" />
+ </DropdownMenuPrimitive.ItemIndicator>
+ </span>
+ {children}
+ </DropdownMenuPrimitive.CheckboxItem>
+ );
+}
+
+function DropdownMenuRadioGroup({
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
+ return (
+ <DropdownMenuPrimitive.RadioGroup
+ data-slot="dropdown-menu-radio-group"
+ {...props}
+ />
+ );
+}
+
+function DropdownMenuRadioItem({
+ className,
+ children,
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
+ return (
+ <DropdownMenuPrimitive.RadioItem
+ data-slot="dropdown-menu-radio-item"
+ className={cn(
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ className,
+ )}
+ {...props}
+ >
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
+ <DropdownMenuPrimitive.ItemIndicator>
+ <CircleIcon className="size-2 fill-current" />
+ </DropdownMenuPrimitive.ItemIndicator>
+ </span>
+ {children}
+ </DropdownMenuPrimitive.RadioItem>
+ );
+}
+
+function DropdownMenuLabel({
+ className,
+ inset,
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
+ inset?: boolean;
+}) {
+ return (
+ <DropdownMenuPrimitive.Label
+ data-slot="dropdown-menu-label"
+ data-inset={inset}
+ className={cn(
+ "px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function DropdownMenuSeparator({
+ className,
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
+ return (
+ <DropdownMenuPrimitive.Separator
+ data-slot="dropdown-menu-separator"
+ className={cn("bg-border -mx-1 my-1 h-px", className)}
+ {...props}
+ />
+ );
+}
+
+function DropdownMenuShortcut({
+ className,
+ ...props
+}: React.ComponentProps<"span">) {
+ return (
+ <span
+ data-slot="dropdown-menu-shortcut"
+ className={cn(
+ "text-muted-foreground ml-auto text-xs tracking-widest",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function DropdownMenuSub({
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
+ return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />;
+}
+
+function DropdownMenuSubTrigger({
+ className,
+ inset,
+ children,
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
+ inset?: boolean;
+}) {
+ return (
+ <DropdownMenuPrimitive.SubTrigger
+ data-slot="dropdown-menu-sub-trigger"
+ data-inset={inset}
+ className={cn(
+ "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ <ChevronRightIcon className="ml-auto size-4" />
+ </DropdownMenuPrimitive.SubTrigger>
+ );
+}
+
+function DropdownMenuSubContent({
+ className,
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
+ return (
+ <DropdownMenuPrimitive.SubContent
+ data-slot="dropdown-menu-sub-content"
+ className={cn(
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+export {
+ DropdownMenu,
+ DropdownMenuPortal,
+ DropdownMenuTrigger,
+ DropdownMenuContent,
+ DropdownMenuGroup,
+ DropdownMenuLabel,
+ DropdownMenuItem,
+ DropdownMenuCheckboxItem,
+ DropdownMenuRadioGroup,
+ DropdownMenuRadioItem,
+ DropdownMenuSeparator,
+ DropdownMenuShortcut,
+ DropdownMenuSub,
+ DropdownMenuSubTrigger,
+ DropdownMenuSubContent,
+};
diff --git a/apps/web/src/components/ui/input.tsx b/apps/web/src/components/ui/input.tsx
index 2cfeec4c9..017ee4f0b 100644
--- a/apps/web/src/components/ui/input.tsx
+++ b/apps/web/src/components/ui/input.tsx
@@ -1,22 +1,21 @@
-import * as React from "react";
+import type * as React from "react";
import { cn } from "@/lib/cn";
-const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"input">>(
- ({ className, type, ...props }, ref) => {
- return (
- <input
- type={type}
- className={cn(
- "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
- className,
- )}
- ref={ref}
- {...props}
- />
- );
- },
-);
-Input.displayName = "Input";
+function Input({ className, type, ...props }: React.ComponentProps<"input">) {
+ return (
+ <input
+ type={type}
+ data-slot="input"
+ className={cn(
+ "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
+ "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
export { Input };
diff --git a/apps/web/src/components/ui/kbd.tsx b/apps/web/src/components/ui/kbd.tsx
new file mode 100644
index 000000000..b604f8e21
--- /dev/null
+++ b/apps/web/src/components/ui/kbd.tsx
@@ -0,0 +1,48 @@
+import { cn } from "@/lib/cn";
+
+interface KbdProps {
+ children: React.ReactNode;
+ className?: string;
+}
+
+export function Kbd({ children, className }: KbdProps) {
+ return (
+ <kbd
+ className={cn(
+ "pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100",
+ className,
+ )}
+ >
+ {children}
+ </kbd>
+ );
+}
+
+interface KbdSequenceProps {
+ keys: string[];
+ separator?: string;
+ className?: string;
+}
+
+export function KbdSequence({
+ keys,
+ separator = "then",
+ className,
+}: KbdSequenceProps) {
+ const keyElements = keys.map((key, index) => ({
+ key: key,
+ position: index,
+ id: `${key}-pos${index}-${Math.random().toString(36).substr(2, 9)}`,
+ }));
+
+ return (
+ <span className={cn("flex items-center gap-1", className)}>
+ {keyElements.map((item) => (
+ <span key={item.id} className="flex items-center gap-1">
+ {item.position > 0 && <span className="text-xs">{separator}</span>}
+ <Kbd>{item.key}</Kbd>
+ </span>
+ ))}
+ </span>
+ );
+}
diff --git a/apps/web/src/components/ui/popover.tsx b/apps/web/src/components/ui/popover.tsx
index 9b4b9e03f..91dd7ca2c 100644
--- a/apps/web/src/components/ui/popover.tsx
+++ b/apps/web/src/components/ui/popover.tsx
@@ -28,7 +28,7 @@ function PopoverContent({
align={align}
sideOffset={sideOffset}
className={cn(
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-hidden",
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
className,
)}
{...props}
diff --git a/apps/web/src/components/ui/progress.tsx b/apps/web/src/components/ui/progress.tsx
new file mode 100644
index 000000000..e99f9850a
--- /dev/null
+++ b/apps/web/src/components/ui/progress.tsx
@@ -0,0 +1,29 @@
+import * as ProgressPrimitive from "@radix-ui/react-progress";
+import type * as React from "react";
+
+import { cn } from "@/lib/cn";
+
+function Progress({
+ className,
+ value,
+ ...props
+}: React.ComponentProps<typeof ProgressPrimitive.Root>) {
+ return (
+ <ProgressPrimitive.Root
+ data-slot="progress"
+ className={cn(
+ "bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",
+ className,
+ )}
+ {...props}
+ >
+ <ProgressPrimitive.Indicator
+ data-slot="progress-indicator"
+ className="bg-primary h-full w-full flex-1 transition-all"
+ style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
+ />
+ </ProgressPrimitive.Root>
+ );
+}
+
+export { Progress };
diff --git a/apps/web/src/components/ui/select.tsx b/apps/web/src/components/ui/select.tsx
index ecba3411a..e61afdff9 100644
--- a/apps/web/src/components/ui/select.tsx
+++ b/apps/web/src/components/ui/select.tsx
@@ -1,108 +1,183 @@
-import { cn } from "@/lib/cn";
-import { Check, ChevronDown } from "lucide-react";
+import * as SelectPrimitive from "@radix-ui/react-select";
+import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
import type * as React from "react";
-import { useEffect, useRef, useState } from "react";
-interface SelectOption {
- value: string;
- label: string;
- avatar?: string;
- icon?: React.ReactNode;
-}
+import { cn } from "@/lib/cn";
-interface SelectProps {
- value: string;
- onChange: (value: string) => void;
- options: SelectOption[];
- placeholder?: string;
- className?: string;
+function Select({
+ ...props
+}: React.ComponentProps<typeof SelectPrimitive.Root>) {
+ return <SelectPrimitive.Root data-slot="select" {...props} />;
}
-export function Select({
- value,
- onChange,
- options,
- placeholder = "Select option",
- className,
-}: SelectProps) {
- const [isOpen, setIsOpen] = useState(false);
- const containerRef = useRef<HTMLDivElement>(null);
-
- const selectedOption = options.find((option) => option.value === value);
+function SelectGroup({
+ ...props
+}: React.ComponentProps<typeof SelectPrimitive.Group>) {
+ return <SelectPrimitive.Group data-slot="select-group" {...props} />;
+}
- useEffect(() => {
- function handleClickOutside(event: MouseEvent) {
- if (
- containerRef.current &&
- !containerRef.current.contains(event.target as Node)
- ) {
- setIsOpen(false);
- }
- }
+function SelectValue({
+ ...props
+}: React.ComponentProps<typeof SelectPrimitive.Value>) {
+ return <SelectPrimitive.Value data-slot="select-value" {...props} />;
+}
- document.addEventListener("mousedown", handleClickOutside);
- return () => document.removeEventListener("mousedown", handleClickOutside);
- }, []);
+function SelectTrigger({
+ className,
+ size = "default",
+ children,
+ ...props
+}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
+ size?: "sm" | "default";
+}) {
+ return (
+ <SelectPrimitive.Trigger
+ data-slot="select-trigger"
+ data-size={size}
+ className={cn(
+ "border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ <SelectPrimitive.Icon asChild>
+ <ChevronDownIcon className="size-4 opacity-50" />
+ </SelectPrimitive.Icon>
+ </SelectPrimitive.Trigger>
+ );
+}
+function SelectContent({
+ className,
+ children,
+ position = "popper",
+ ...props
+}: React.ComponentProps<typeof SelectPrimitive.Content>) {
return (
- <div className="relative" ref={containerRef}>
- <button
- type="button"
- onClick={() => setIsOpen(!isOpen)}
+ <SelectPrimitive.Portal>
+ <SelectPrimitive.Content
+ data-slot="select-content"
className={cn(
- "w-full flex items-center justify-between rounded-md border px-3 py-2 text-sm",
- "focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:focus:ring-indigo-400",
- "bg-white dark:bg-zinc-800/50 border-zinc-200 dark:border-zinc-700/50",
- "text-zinc-900 dark:text-zinc-100",
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
+ position === "popper" &&
+ "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
className,
)}
+ position={position}
+ {...props}
>
- <div className="flex items-center gap-2 min-w-0">
- {selectedOption ? (
- <>
- {selectedOption.icon}
- <span className="truncate">{selectedOption.label}</span>
- </>
- ) : (
- <span className="text-zinc-500 dark:text-zinc-400">
- {placeholder}
- </span>
+ <SelectScrollUpButton />
+ <SelectPrimitive.Viewport
+ className={cn(
+ "p-1",
+ position === "popper" &&
+ "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1",
)}
- </div>
- <ChevronDown className="w-4 h-4 text-zinc-500 dark:text-zinc-400" />
- </button>
+ >
+ {children}
+ </SelectPrimitive.Viewport>
+ <SelectScrollDownButton />
+ </SelectPrimitive.Content>
+ </SelectPrimitive.Portal>
+ );
+}
+
+function SelectLabel({
+ className,
+ ...props
+}: React.ComponentProps<typeof SelectPrimitive.Label>) {
+ return (
+ <SelectPrimitive.Label
+ data-slot="select-label"
+ className={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
+ {...props}
+ />
+ );
+}
- {isOpen && (
- <div className="absolute z-50 w-full mt-1 py-1 rounded-md shadow-lg bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700/50">
- {options.map((option) => (
- <button
- key={option.value}
- type="button"
- onClick={() => {
- onChange(option.value);
- setIsOpen(false);
- }}
- className={cn(
- "w-full flex items-center gap-2 px-3 py-2 text-sm",
- "hover:bg-zinc-100 dark:hover:bg-zinc-700/50",
- value === option.value &&
- "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400",
- )}
- >
- {option.avatar && (
- <img
- src={option.avatar}
- alt={option.label}
- className="w-5 h-5 rounded-full object-cover"
- />
- )}
- {option.icon}
- <span className="flex-1 text-left truncate">{option.label}</span>
- {value === option.value && <Check className="w-4 h-4" />}
- </button>
- ))}
- </div>
+function SelectItem({
+ className,
+ children,
+ ...props
+}: React.ComponentProps<typeof SelectPrimitive.Item>) {
+ return (
+ <SelectPrimitive.Item
+ data-slot="select-item"
+ className={cn(
+ "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
+ className,
+ )}
+ {...props}
+ >
+ <span className="absolute right-2 flex size-3.5 items-center justify-center">
+ <SelectPrimitive.ItemIndicator>
+ <CheckIcon className="size-4" />
+ </SelectPrimitive.ItemIndicator>
+ </span>
+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
+ </SelectPrimitive.Item>
+ );
+}
+
+function SelectSeparator({
+ className,
+ ...props
+}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
+ return (
+ <SelectPrimitive.Separator
+ data-slot="select-separator"
+ className={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)}
+ {...props}
+ />
+ );
+}
+
+function SelectScrollUpButton({
+ className,
+ ...props
+}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
+ return (
+ <SelectPrimitive.ScrollUpButton
+ data-slot="select-scroll-up-button"
+ className={cn(
+ "flex cursor-default items-center justify-center py-1",
+ className,
+ )}
+ {...props}
+ >
+ <ChevronUpIcon className="size-4" />
+ </SelectPrimitive.ScrollUpButton>
+ );
+}
+
+function SelectScrollDownButton({
+ className,
+ ...props
+}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
+ return (
+ <SelectPrimitive.ScrollDownButton
+ data-slot="select-scroll-down-button"
+ className={cn(
+ "flex cursor-default items-center justify-center py-1",
+ className,
)}
- </div>
+ {...props}
+ >
+ <ChevronDownIcon className="size-4" />
+ </SelectPrimitive.ScrollDownButton>
);
}
+
+export {
+ Select,
+ SelectContent,
+ SelectGroup,
+ SelectItem,
+ SelectLabel,
+ SelectScrollDownButton,
+ SelectScrollUpButton,
+ SelectSeparator,
+ SelectTrigger,
+ SelectValue,
+};
diff --git a/apps/web/src/components/ui/separator.tsx b/apps/web/src/components/ui/separator.tsx
new file mode 100644
index 000000000..19778fffd
--- /dev/null
+++ b/apps/web/src/components/ui/separator.tsx
@@ -0,0 +1,26 @@
+import * as SeparatorPrimitive from "@radix-ui/react-separator";
+import type * as React from "react";
+
+import { cn } from "@/lib/cn";
+
+function Separator({
+ className,
+ orientation = "horizontal",
+ decorative = true,
+ ...props
+}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
+ return (
+ <SeparatorPrimitive.Root
+ data-slot="separator"
+ decorative={decorative}
+ orientation={orientation}
+ className={cn(
+ "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+export { Separator };
diff --git a/apps/web/src/components/ui/sheet.tsx b/apps/web/src/components/ui/sheet.tsx
new file mode 100644
index 000000000..7c9ceb399
--- /dev/null
+++ b/apps/web/src/components/ui/sheet.tsx
@@ -0,0 +1,137 @@
+import * as SheetPrimitive from "@radix-ui/react-dialog";
+import { XIcon } from "lucide-react";
+import type * as React from "react";
+
+import { cn } from "@/lib/cn";
+
+function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
+ return <SheetPrimitive.Root data-slot="sheet" {...props} />;
+}
+
+function SheetTrigger({
+ ...props
+}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
+ return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
+}
+
+function SheetClose({
+ ...props
+}: React.ComponentProps<typeof SheetPrimitive.Close>) {
+ return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
+}
+
+function SheetPortal({
+ ...props
+}: React.ComponentProps<typeof SheetPrimitive.Portal>) {
+ return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
+}
+
+function SheetOverlay({
+ className,
+ ...props
+}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
+ return (
+ <SheetPrimitive.Overlay
+ data-slot="sheet-overlay"
+ className={cn(
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function SheetContent({
+ className,
+ children,
+ side = "right",
+ ...props
+}: React.ComponentProps<typeof SheetPrimitive.Content> & {
+ side?: "top" | "right" | "bottom" | "left";
+}) {
+ return (
+ <SheetPortal>
+ <SheetOverlay />
+ <SheetPrimitive.Content
+ data-slot="sheet-content"
+ className={cn(
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
+ side === "right" &&
+ "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
+ side === "left" &&
+ "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
+ side === "top" &&
+ "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
+ side === "bottom" &&
+ "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ <SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
+ <XIcon className="size-4" />
+ <span className="sr-only">Close</span>
+ </SheetPrimitive.Close>
+ </SheetPrimitive.Content>
+ </SheetPortal>
+ );
+}
+
+function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="sheet-header"
+ className={cn("flex flex-col gap-1.5 p-4", className)}
+ {...props}
+ />
+ );
+}
+
+function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="sheet-footer"
+ className={cn("mt-auto flex flex-col gap-2 p-4", className)}
+ {...props}
+ />
+ );
+}
+
+function SheetTitle({
+ className,
+ ...props
+}: React.ComponentProps<typeof SheetPrimitive.Title>) {
+ return (
+ <SheetPrimitive.Title
+ data-slot="sheet-title"
+ className={cn("text-foreground font-semibold", className)}
+ {...props}
+ />
+ );
+}
+
+function SheetDescription({
+ className,
+ ...props
+}: React.ComponentProps<typeof SheetPrimitive.Description>) {
+ return (
+ <SheetPrimitive.Description
+ data-slot="sheet-description"
+ className={cn("text-muted-foreground text-sm", className)}
+ {...props}
+ />
+ );
+}
+
+export {
+ Sheet,
+ SheetTrigger,
+ SheetClose,
+ SheetContent,
+ SheetHeader,
+ SheetFooter,
+ SheetTitle,
+ SheetDescription,
+};
diff --git a/apps/web/src/components/ui/sidebar.tsx b/apps/web/src/components/ui/sidebar.tsx
new file mode 100644
index 000000000..fb4819bae
--- /dev/null
+++ b/apps/web/src/components/ui/sidebar.tsx
@@ -0,0 +1,753 @@
+import { Slot } from "@radix-ui/react-slot";
+import { type VariantProps, cva } from "class-variance-authority";
+import { PanelLeftIcon } from "lucide-react";
+import * as React from "react";
+
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { Separator } from "@/components/ui/separator";
+import {
+ Sheet,
+ SheetContent,
+ SheetDescription,
+ SheetHeader,
+ SheetTitle,
+} from "@/components/ui/sheet";
+import { Skeleton } from "@/components/ui/skeleton";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
+import { shortcuts } from "@/constants/shortcuts";
+import { useIsMobile } from "@/hooks/use-mobile";
+import { cn } from "@/lib/cn";
+import { KbdSequence } from "./kbd";
+
+const SIDEBAR_COOKIE_NAME = "sidebar_state";
+const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
+const SIDEBAR_WIDTH = "16rem";
+const SIDEBAR_WIDTH_MOBILE = "18rem";
+const SIDEBAR_WIDTH_ICON = "3rem";
+
+type SidebarContextProps = {
+ state: "expanded" | "collapsed";
+ open: boolean;
+ setOpen: (open: boolean) => void;
+ openMobile: boolean;
+ setOpenMobile: (open: boolean) => void;
+ isMobile: boolean;
+ toggleSidebar: () => void;
+};
+
+const SidebarContext = React.createContext<SidebarContextProps | null>(null);
+
+function useSidebar() {
+ const context = React.useContext(SidebarContext);
+ if (!context) {
+ throw new Error("useSidebar must be used within a SidebarProvider.");
+ }
+
+ return context;
+}
+
+function SidebarProvider({
+ defaultOpen = true,
+ open: openProp,
+ onOpenChange: setOpenProp,
+ className,
+ style,
+ children,
+ ...props
+}: React.ComponentProps<"div"> & {
+ defaultOpen?: boolean;
+ open?: boolean;
+ onOpenChange?: (open: boolean) => void;
+}) {
+ const isMobile = useIsMobile();
+ const [openMobile, setOpenMobile] = React.useState(false);
+
+ // This is the internal state of the sidebar.
+ // We use openProp and setOpenProp for control from outside the component.
+ const [_open, _setOpen] = React.useState(defaultOpen);
+ const open = openProp ?? _open;
+ const setOpen = React.useCallback(
+ (value: boolean | ((value: boolean) => boolean)) => {
+ const openState = typeof value === "function" ? value(open) : value;
+ if (setOpenProp) {
+ setOpenProp(openState);
+ } else {
+ _setOpen(openState);
+ }
+
+ // This sets the cookie to keep the sidebar state.
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
+ },
+ [setOpenProp, open],
+ );
+
+ // Helper to toggle the sidebar.
+ // biome-ignore lint/correctness/useExhaustiveDependencies: we need to use the setOpenMobile function
+ const toggleSidebar = React.useCallback(() => {
+ return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
+ }, [isMobile, setOpen, setOpenMobile]);
+
+ React.useEffect(() => {
+ const handleKeyDown = (event: KeyboardEvent) => {
+ if (
+ event.key === "[" &&
+ !event.metaKey &&
+ !event.ctrlKey &&
+ !event.altKey &&
+ !event.shiftKey
+ ) {
+ const target = event.target as HTMLElement;
+ if (
+ target.tagName !== "INPUT" &&
+ target.tagName !== "TEXTAREA" &&
+ !target.isContentEditable
+ ) {
+ event.preventDefault();
+ toggleSidebar();
+ }
+ }
+ };
+
+ window.addEventListener("keydown", handleKeyDown);
+ return () => window.removeEventListener("keydown", handleKeyDown);
+ }, [toggleSidebar]);
+
+ // We add a state so that we can do data-state="expanded" or "collapsed".
+ // This makes it easier to style the sidebar with Tailwind classes.
+ const state = open ? "expanded" : "collapsed";
+
+ // biome-ignore lint/correctness/useExhaustiveDependencies: we need to use the setOpenMobile function
+ const contextValue = React.useMemo<SidebarContextProps>(
+ () => ({
+ state,
+ open,
+ setOpen,
+ isMobile,
+ openMobile,
+ setOpenMobile,
+ toggleSidebar,
+ }),
+ [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],
+ );
+
+ return (
+ <SidebarContext.Provider value={contextValue}>
+ <TooltipProvider delayDuration={0}>
+ <div
+ data-slot="sidebar-wrapper"
+ style={
+ {
+ "--sidebar-width": SIDEBAR_WIDTH,
+ "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
+ ...style,
+ } as React.CSSProperties
+ }
+ className={cn(
+ "group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ </div>
+ </TooltipProvider>
+ </SidebarContext.Provider>
+ );
+}
+
+function Sidebar({
+ side = "left",
+ variant = "sidebar",
+ collapsible = "offcanvas",
+ className,
+ children,
+ ...props
+}: React.ComponentProps<"div"> & {
+ side?: "left" | "right";
+ variant?: "sidebar" | "floating" | "inset";
+ collapsible?: "offcanvas" | "icon" | "none";
+}) {
+ const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
+
+ if (collapsible === "none") {
+ return (
+ <div
+ data-slot="sidebar"
+ className={cn(
+ "bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ </div>
+ );
+ }
+
+ if (isMobile) {
+ return (
+ <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
+ <SheetContent
+ data-sidebar="sidebar"
+ data-slot="sidebar"
+ data-mobile="true"
+ className="bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden"
+ style={
+ {
+ "--sidebar-width": SIDEBAR_WIDTH_MOBILE,
+ } as React.CSSProperties
+ }
+ side={side}
+ >
+ <SheetHeader className="sr-only">
+ <SheetTitle>Sidebar</SheetTitle>
+ <SheetDescription>Displays the mobile sidebar.</SheetDescription>
+ </SheetHeader>
+ <div className="flex h-full w-full flex-col">{children}</div>
+ </SheetContent>
+ </Sheet>
+ );
+ }
+
+ return (
+ <div
+ className="group peer text-sidebar-foreground hidden md:block"
+ data-state={state}
+ data-collapsible={state === "collapsed" ? collapsible : ""}
+ data-variant={variant}
+ data-side={side}
+ data-slot="sidebar"
+ >
+ {/* This is what handles the sidebar gap on desktop */}
+ <div
+ data-slot="sidebar-gap"
+ className={cn(
+ "relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",
+ "group-data-[collapsible=offcanvas]:w-0",
+ "group-data-[side=right]:rotate-180",
+ variant === "floating" || variant === "inset"
+ ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]"
+ : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)",
+ )}
+ />
+ <div
+ data-slot="sidebar-container"
+ className={cn(
+ "fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
+ side === "left"
+ ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
+ : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
+ // Adjust the padding for floating and inset variants.
+ variant === "floating" || variant === "inset"
+ ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
+ : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
+ className,
+ )}
+ {...props}
+ >
+ <div
+ data-sidebar="sidebar"
+ data-slot="sidebar-inner"
+ className="bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm"
+ >
+ {children}
+ </div>
+ </div>
+ </div>
+ );
+}
+
+function SidebarTrigger({
+ className,
+ onClick,
+ ...props
+}: React.ComponentProps<typeof Button>) {
+ const { toggleSidebar } = useSidebar();
+
+ return (
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ data-sidebar="trigger"
+ data-slot="sidebar-trigger"
+ variant="ghost"
+ size="icon"
+ className={cn("size-7", className)}
+ onClick={(event) => {
+ onClick?.(event);
+ toggleSidebar();
+ }}
+ {...props}
+ >
+ <PanelLeftIcon />
+ <span className="sr-only">Toggle Sidebar</span>
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent
+ side="bottom"
+ className="bg-popover text-popover-foreground border"
+ >
+ <div className="flex items-center gap-2 text-xs">
+ <span>Toggle sidebar</span>
+ <KbdSequence
+ keys={[shortcuts.sidebar.prefix, shortcuts.sidebar.toggle]}
+ />
+ </div>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ );
+}
+
+function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {
+ const { toggleSidebar } = useSidebar();
+
+ return (
+ <button
+ data-sidebar="rail"
+ data-slot="sidebar-rail"
+ aria-label="Toggle Sidebar"
+ tabIndex={-1}
+ onClick={toggleSidebar}
+ title="Toggle Sidebar"
+ className={cn(
+ "hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex",
+ "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
+ "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
+ "hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
+ "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
+ "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function SidebarInset({ className, ...props }: React.ComponentProps<"main">) {
+ return (
+ <main
+ data-slot="sidebar-inset"
+ className={cn(
+ "bg-background relative flex w-full flex-1 flex-col",
+ "md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function SidebarInput({
+ className,
+ ...props
+}: React.ComponentProps<typeof Input>) {
+ return (
+ <Input
+ data-slot="sidebar-input"
+ data-sidebar="input"
+ className={cn("bg-background h-8 w-full shadow-none", className)}
+ {...props}
+ />
+ );
+}
+
+function SidebarHeader({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="sidebar-header"
+ data-sidebar="header"
+ className={cn("flex flex-col gap-2 p-2", className)}
+ {...props}
+ />
+ );
+}
+
+function SidebarFooter({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="sidebar-footer"
+ data-sidebar="footer"
+ className={cn("flex flex-col gap-2 p-2", className)}
+ {...props}
+ />
+ );
+}
+
+function SidebarSeparator({
+ className,
+ ...props
+}: React.ComponentProps<typeof Separator>) {
+ return (
+ <Separator
+ data-slot="sidebar-separator"
+ data-sidebar="separator"
+ className={cn("bg-sidebar-border mx-2 w-auto", className)}
+ {...props}
+ />
+ );
+}
+
+function SidebarContent({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="sidebar-content"
+ data-sidebar="content"
+ className={cn(
+ "flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function SidebarGroup({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="sidebar-group"
+ data-sidebar="group"
+ className={cn("relative flex w-full min-w-0 flex-col p-2", className)}
+ {...props}
+ />
+ );
+}
+
+function SidebarGroupLabel({
+ className,
+ asChild = false,
+ ...props
+}: React.ComponentProps<"div"> & { asChild?: boolean }) {
+ const Comp = asChild ? Slot : "div";
+
+ return (
+ <Comp
+ data-slot="sidebar-group-label"
+ data-sidebar="group-label"
+ className={cn(
+ "text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
+ "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function SidebarGroupAction({
+ className,
+ asChild = false,
+ ...props
+}: React.ComponentProps<"button"> & { asChild?: boolean }) {
+ const Comp = asChild ? Slot : "button";
+
+ return (
+ <Comp
+ data-slot="sidebar-group-action"
+ data-sidebar="group-action"
+ className={cn(
+ "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
+ // Increases the hit area of the button on mobile.
+ "after:absolute after:-inset-2 md:after:hidden",
+ "group-data-[collapsible=icon]:hidden",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function SidebarGroupContent({
+ className,
+ ...props
+}: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="sidebar-group-content"
+ data-sidebar="group-content"
+ className={cn("w-full text-sm", className)}
+ {...props}
+ />
+ );
+}
+
+function SidebarMenu({ className, ...props }: React.ComponentProps<"ul">) {
+ return (
+ <ul
+ data-slot="sidebar-menu"
+ data-sidebar="menu"
+ className={cn("flex w-full min-w-0 flex-col gap-1", className)}
+ {...props}
+ />
+ );
+}
+
+function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {
+ return (
+ <li
+ data-slot="sidebar-menu-item"
+ data-sidebar="menu-item"
+ className={cn("group/menu-item relative", className)}
+ {...props}
+ />
+ );
+}
+
+const sidebarMenuButtonVariants = cva(
+ "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
+ {
+ variants: {
+ variant: {
+ default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
+ outline:
+ "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]",
+ },
+ size: {
+ default: "h-8 text-sm",
+ sm: "h-7 text-xs",
+ lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ size: "default",
+ },
+ },
+);
+
+function SidebarMenuButton({
+ asChild = false,
+ isActive = false,
+ variant = "default",
+ size = "default",
+ tooltip,
+ className,
+ ...props
+}: React.ComponentProps<"button"> & {
+ asChild?: boolean;
+ isActive?: boolean;
+ tooltip?: string | React.ComponentProps<typeof TooltipContent>;
+} & VariantProps<typeof sidebarMenuButtonVariants>) {
+ const Comp = asChild ? Slot : "button";
+ const { isMobile, state } = useSidebar();
+
+ const button = (
+ <Comp
+ data-slot="sidebar-menu-button"
+ data-sidebar="menu-button"
+ data-size={size}
+ data-active={isActive}
+ className={cn(sidebarMenuButtonVariants({ variant, size }), className)}
+ {...props}
+ />
+ );
+
+ if (!tooltip) {
+ return button;
+ }
+
+ if (typeof tooltip === "string") {
+ tooltip = {
+ children: tooltip,
+ };
+ }
+
+ return (
+ <Tooltip>
+ <TooltipTrigger asChild>{button}</TooltipTrigger>
+ <TooltipContent
+ side="right"
+ align="center"
+ hidden={state !== "collapsed" || isMobile}
+ {...tooltip}
+ />
+ </Tooltip>
+ );
+}
+
+function SidebarMenuAction({
+ className,
+ asChild = false,
+ showOnHover = false,
+ ...props
+}: React.ComponentProps<"button"> & {
+ asChild?: boolean;
+ showOnHover?: boolean;
+}) {
+ const Comp = asChild ? Slot : "button";
+
+ return (
+ <Comp
+ data-slot="sidebar-menu-action"
+ data-sidebar="menu-action"
+ className={cn(
+ "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
+ // Increases the hit area of the button on mobile.
+ "after:absolute after:-inset-2 md:after:hidden",
+ "peer-data-[size=sm]/menu-button:top-1",
+ "peer-data-[size=default]/menu-button:top-1.5",
+ "peer-data-[size=lg]/menu-button:top-2.5",
+ "group-data-[collapsible=icon]:hidden",
+ showOnHover &&
+ "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function SidebarMenuBadge({
+ className,
+ ...props
+}: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="sidebar-menu-badge"
+ data-sidebar="menu-badge"
+ className={cn(
+ "text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none",
+ "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
+ "peer-data-[size=sm]/menu-button:top-1",
+ "peer-data-[size=default]/menu-button:top-1.5",
+ "peer-data-[size=lg]/menu-button:top-2.5",
+ "group-data-[collapsible=icon]:hidden",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function SidebarMenuSkeleton({
+ className,
+ showIcon = false,
+ ...props
+}: React.ComponentProps<"div"> & {
+ showIcon?: boolean;
+}) {
+ // Random width between 50 to 90%.
+ const width = React.useMemo(() => {
+ return `${Math.floor(Math.random() * 40) + 50}%`;
+ }, []);
+
+ return (
+ <div
+ data-slot="sidebar-menu-skeleton"
+ data-sidebar="menu-skeleton"
+ className={cn("flex h-8 items-center gap-2 rounded-md px-2", className)}
+ {...props}
+ >
+ {showIcon && (
+ <Skeleton
+ className="size-4 rounded-md"
+ data-sidebar="menu-skeleton-icon"
+ />
+ )}
+ <Skeleton
+ className="h-4 max-w-(--skeleton-width) flex-1"
+ data-sidebar="menu-skeleton-text"
+ style={
+ {
+ "--skeleton-width": width,
+ } as React.CSSProperties
+ }
+ />
+ </div>
+ );
+}
+
+function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">) {
+ return (
+ <ul
+ data-slot="sidebar-menu-sub"
+ data-sidebar="menu-sub"
+ className={cn(
+ "border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5",
+ "group-data-[collapsible=icon]:hidden",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function SidebarMenuSubItem({
+ className,
+ ...props
+}: React.ComponentProps<"li">) {
+ return (
+ <li
+ data-slot="sidebar-menu-sub-item"
+ data-sidebar="menu-sub-item"
+ className={cn("group/menu-sub-item relative", className)}
+ {...props}
+ />
+ );
+}
+
+function SidebarMenuSubButton({
+ asChild = false,
+ size = "md",
+ isActive = false,
+ className,
+ ...props
+}: React.ComponentProps<"a"> & {
+ asChild?: boolean;
+ size?: "sm" | "md";
+ isActive?: boolean;
+}) {
+ const Comp = asChild ? Slot : "a";
+
+ return (
+ <Comp
+ data-slot="sidebar-menu-sub-button"
+ data-sidebar="menu-sub-button"
+ data-size={size}
+ data-active={isActive}
+ className={cn(
+ "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
+ "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
+ size === "sm" && "text-xs",
+ size === "md" && "text-sm",
+ "group-data-[collapsible=icon]:hidden",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+export {
+ Sidebar,
+ SidebarContent,
+ SidebarFooter,
+ SidebarGroup,
+ SidebarGroupAction,
+ SidebarGroupContent,
+ SidebarGroupLabel,
+ SidebarHeader,
+ SidebarInput,
+ SidebarInset,
+ SidebarMenu,
+ SidebarMenuAction,
+ SidebarMenuBadge,
+ SidebarMenuButton,
+ SidebarMenuItem,
+ SidebarMenuSkeleton,
+ SidebarMenuSub,
+ SidebarMenuSubButton,
+ SidebarMenuSubItem,
+ SidebarProvider,
+ SidebarRail,
+ SidebarSeparator,
+ SidebarTrigger,
+ useSidebar,
+};
diff --git a/apps/web/src/components/ui/skeleton.tsx b/apps/web/src/components/ui/skeleton.tsx
new file mode 100644
index 000000000..9ad04384d
--- /dev/null
+++ b/apps/web/src/components/ui/skeleton.tsx
@@ -0,0 +1,13 @@
+import { cn } from "@/lib/cn";
+
+function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="skeleton"
+ className={cn("bg-accent animate-pulse rounded-md", className)}
+ {...props}
+ />
+ );
+}
+
+export { Skeleton };
diff --git a/apps/web/src/components/ui/table.tsx b/apps/web/src/components/ui/table.tsx
new file mode 100644
index 000000000..1c3304c20
--- /dev/null
+++ b/apps/web/src/components/ui/table.tsx
@@ -0,0 +1,114 @@
+import type * as React from "react";
+
+import { cn } from "@/lib/cn";
+
+function Table({ className, ...props }: React.ComponentProps<"table">) {
+ return (
+ <div
+ data-slot="table-container"
+ className="relative w-full overflow-x-auto"
+ >
+ <table
+ data-slot="table"
+ className={cn("w-full caption-bottom text-sm", className)}
+ {...props}
+ />
+ </div>
+ );
+}
+
+function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
+ return (
+ <thead
+ data-slot="table-header"
+ className={cn("[&_tr]:border-b", className)}
+ {...props}
+ />
+ );
+}
+
+function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
+ return (
+ <tbody
+ data-slot="table-body"
+ className={cn("[&_tr:last-child]:border-0", className)}
+ {...props}
+ />
+ );
+}
+
+function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
+ return (
+ <tfoot
+ data-slot="table-footer"
+ className={cn(
+ "bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
+ return (
+ <tr
+ data-slot="table-row"
+ className={cn(
+ "hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function TableHead({ className, ...props }: React.ComponentProps<"th">) {
+ return (
+ <th
+ data-slot="table-head"
+ className={cn(
+ "text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function TableCell({ className, ...props }: React.ComponentProps<"td">) {
+ return (
+ <td
+ data-slot="table-cell"
+ className={cn(
+ "p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function TableCaption({
+ className,
+ ...props
+}: React.ComponentProps<"caption">) {
+ return (
+ <caption
+ data-slot="table-caption"
+ className={cn("text-muted-foreground mt-4 text-sm", className)}
+ {...props}
+ />
+ );
+}
+
+export {
+ Table,
+ TableHeader,
+ TableBody,
+ TableFooter,
+ TableHead,
+ TableRow,
+ TableCell,
+ TableCaption,
+};
diff --git a/apps/web/src/components/ui/textarea.tsx b/apps/web/src/components/ui/textarea.tsx
new file mode 100644
index 000000000..0f3162d1d
--- /dev/null
+++ b/apps/web/src/components/ui/textarea.tsx
@@ -0,0 +1,17 @@
+import { cn } from "@/lib/cn";
+import type * as React from "react";
+
+function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
+ return (
+ <textarea
+ data-slot="textarea"
+ className={cn(
+ "border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+export { Textarea };
diff --git a/apps/web/src/components/ui/tooltip.tsx b/apps/web/src/components/ui/tooltip.tsx
index 584dd9b21..02d61ab94 100644
--- a/apps/web/src/components/ui/tooltip.tsx
+++ b/apps/web/src/components/ui/tooltip.tsx
@@ -1,30 +1,60 @@
+"use client";
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
-import * as React from "react";
+import type * as React from "react";
import { cn } from "@/lib/cn";
-const TooltipProvider = TooltipPrimitive.Provider;
+function TooltipProvider({
+ delayDuration = 500,
+ ...props
+}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
+ return (
+ <TooltipPrimitive.Provider
+ data-slot="tooltip-provider"
+ delayDuration={delayDuration}
+ {...props}
+ />
+ );
+}
-const Tooltip = TooltipPrimitive.Root;
+function Tooltip({
+ ...props
+}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
+ return (
+ <TooltipProvider>
+ <TooltipPrimitive.Root data-slot="tooltip" {...props} />
+ </TooltipProvider>
+ );
+}
-const TooltipTrigger = TooltipPrimitive.Trigger;
+function TooltipTrigger({
+ ...props
+}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
+ return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
+}
-const TooltipContent = React.forwardRef<
- React.ElementRef<typeof TooltipPrimitive.Content>,
- React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
->(({ className, sideOffset = 4, ...props }, ref) => (
- <TooltipPrimitive.Portal>
- <TooltipPrimitive.Content
- ref={ref}
- sideOffset={sideOffset}
- className={cn(
- "z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
- className,
- )}
- {...props}
- />
- </TooltipPrimitive.Portal>
-));
-TooltipContent.displayName = TooltipPrimitive.Content.displayName;
+function TooltipContent({
+ className,
+ sideOffset = 0,
+ children,
+ ...props
+}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
+ return (
+ <TooltipPrimitive.Portal>
+ <TooltipPrimitive.Content
+ data-slot="tooltip-content"
+ sideOffset={sideOffset || 10}
+ className={cn(
+ "bg-popover text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ </TooltipPrimitive.Content>
+ </TooltipPrimitive.Portal>
+ );
+}
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
diff --git a/apps/web/src/components/workspace-switcher.tsx b/apps/web/src/components/workspace-switcher.tsx
new file mode 100644
index 000000000..e14437e41
--- /dev/null
+++ b/apps/web/src/components/workspace-switcher.tsx
@@ -0,0 +1,179 @@
+import { useNavigate } from "@tanstack/react-router";
+import { ChevronsUpDown, Plus } from "lucide-react";
+import * as React from "react";
+
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu";
+import {
+ SidebarMenu,
+ SidebarMenuButton,
+ SidebarMenuItem,
+ useSidebar,
+} from "@/components/ui/sidebar";
+import { shortcuts } from "@/constants/shortcuts";
+import useGetWorkspaces from "@/hooks/queries/workspace/use-get-workspaces";
+import {
+ getModifierKeyText,
+ useRegisterShortcuts,
+} from "@/hooks/use-keyboard-shortcuts";
+import { useUserPreferencesStore } from "@/store/user-preferences";
+import useWorkspaceStore from "@/store/workspace";
+import type { Workspace } from "@/types/workspace";
+import CreateWorkspaceModal from "./shared/modals/create-workspace-modal";
+
+export function WorkspaceSwitcher() {
+ const { isMobile } = useSidebar();
+ const { workspace, setWorkspace } = useWorkspaceStore();
+ const { setActiveWorkspaceId } = useUserPreferencesStore();
+ const { data: workspaces } = useGetWorkspaces();
+ const navigate = useNavigate();
+ const [isOpen, setIsOpen] = React.useState(false);
+ const [isCreateWorkspaceModalOpen, setIsCreateWorkspaceModalOpen] =
+ React.useState(false);
+
+ const handleWorkspaceChange = React.useCallback(
+ (selectedWorkspace: Workspace) => {
+ setWorkspace(selectedWorkspace);
+ setActiveWorkspaceId(selectedWorkspace.id);
+ navigate({
+ to: "/dashboard/workspace/$workspaceId",
+ params: { workspaceId: selectedWorkspace.id },
+ });
+ },
+ [setWorkspace, setActiveWorkspaceId, navigate],
+ );
+
+ React.useEffect(() => {
+ if (!isOpen) return;
+
+ const handleKeyDown = (event: KeyboardEvent) => {
+ if (!workspaces || workspaces.length === 0) return;
+
+ if (
+ (event.metaKey || event.ctrlKey) &&
+ event.key >= "1" &&
+ event.key <= "9"
+ ) {
+ event.preventDefault();
+ const index = Number.parseInt(event.key) - 1;
+ if (index < workspaces.length) {
+ handleWorkspaceChange(workspaces[index]);
+ setIsOpen(false);
+ }
+ }
+ };
+
+ window.addEventListener("keydown", handleKeyDown);
+ return () => window.removeEventListener("keydown", handleKeyDown);
+ }, [isOpen, workspaces, handleWorkspaceChange]);
+
+ useRegisterShortcuts({
+ sequentialShortcuts: {
+ [shortcuts.workspace.prefix]: {
+ [shortcuts.workspace.switch]: () => {
+ setIsOpen(true);
+ },
+ [shortcuts.workspace.create]: () => {
+ setIsCreateWorkspaceModalOpen(true);
+ },
+ },
+ },
+ });
+
+ if (!workspace) {
+ return null;
+ }
+
+ return (
+ <SidebarMenu>
+ <SidebarMenuItem>
+ <DropdownMenu open={isOpen} onOpenChange={setIsOpen}>
+ <DropdownMenuTrigger asChild>
+ <SidebarMenuButton
+ size="lg"
+ className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
+ >
+ <div
+ className="bg-indigo-600 text-white flex aspect-square size-8 items-center justify-center rounded-lg"
+ style={{ backgroundColor: "#5463ff" }}
+ >
+ <span className="text-sm font-semibold">
+ {workspace.name.charAt(0).toUpperCase()}
+ </span>
+ </div>
+ <div className="grid flex-1 text-left text-sm leading-tight">
+ <span className="truncate font-medium">{workspace.name}</span>
+ <span className="truncate text-xs text-sidebar-foreground/70">
+ {workspaces?.length || 0} workspace
+ {workspaces?.length !== 1 ? "s" : ""}
+ </span>
+ </div>
+ <ChevronsUpDown className="ml-auto" />
+ </SidebarMenuButton>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent
+ className="w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg"
+ align="start"
+ side={isMobile ? "bottom" : "right"}
+ sideOffset={4}
+ >
+ <DropdownMenuLabel className="text-muted-foreground text-xs">
+ Workspaces
+ </DropdownMenuLabel>
+ {workspaces?.map((ws: Workspace, index: number) => (
+ <DropdownMenuItem
+ key={ws.id}
+ onClick={() => {
+ handleWorkspaceChange(ws);
+ setIsOpen(false);
+ }}
+ className="gap-2 p-2"
+ >
+ <div
+ className="flex size-6 items-center justify-center rounded-md bg-indigo-600 dark:bg-indigo-400"
+ style={{ backgroundColor: "#5463ff" }}
+ >
+ <span className="text-xs font-medium text-white">
+ {ws.name.charAt(0).toUpperCase()}
+ </span>
+ </div>
+ {ws.name}
+ <span className="ml-auto text-xs text-muted-foreground">
+ {getModifierKeyText()} {index > 8 ? "0" : index + 1}
+ </span>
+ </DropdownMenuItem>
+ ))}
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ className="gap-2 p-2"
+ onClick={() => {
+ setIsCreateWorkspaceModalOpen(true);
+ }}
+ >
+ <div
+ className="flex size-6 items-center justify-center rounded-md bg-indigo-600 dark:bg-indigo-400"
+ style={{ backgroundColor: "#5463ff" }}
+ >
+ <Plus className="size-4 text-white" />
+ </div>
+ <div className="text-muted-foreground font-medium">
+ Add workspace
+ </div>
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </SidebarMenuItem>
+
+ <CreateWorkspaceModal
+ open={isCreateWorkspaceModalOpen}
+ onClose={() => setIsCreateWorkspaceModalOpen(false)}
+ />
+ </SidebarMenu>
+ );
+}
diff --git a/apps/web/src/components/workspace/empty-state.tsx b/apps/web/src/components/workspace/empty-state.tsx
deleted file mode 100644
index 6a873c7b1..000000000
--- a/apps/web/src/components/workspace/empty-state.tsx
+++ /dev/null
@@ -1,58 +0,0 @@
-import CreateWorkspaceModal from "../shared/modals/create-workspace-modal";
-
-import { LayoutGrid, Plus } from "lucide-react";
-import { useState } from "react";
-
-function EmptyWorkspaceState() {
- const [isCreateWorkspaceOpen, setIsCreateWorkspaceOpen] = useState(false);
-
- return (
- <div className="flex w-full items-center justify-center h-screen flex-col bg-zinc-50 dark:bg-zinc-950">
- <div className="max-w-md w-full px-8">
- <div className="text-center mb-8">
- <div className="w-14 h-14 mb-4 rounded-full bg-indigo-50 dark:bg-indigo-500/10 flex items-center justify-center mx-auto">
- <LayoutGrid className="w-7 h-7 text-indigo-500 dark:text-indigo-400" />
- </div>
- <h1 className="text-xl font-semibold text-zinc-900 dark:text-zinc-100 mb-2">
- Create your first workspace
- </h1>
- <p className="text-zinc-500 dark:text-zinc-400 text-center max-w-md mb-6">
- Get started by creating a workspace to organize your projects and
- collaborate with your team.
- </p>
- </div>
-
- <div className="space-y-4">
- <div className="p-4 rounded-lg border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-900">
- <div className="flex items-center gap-3 mb-3">
- <div className="w-8 h-8 rounded-full bg-indigo-50 dark:bg-indigo-500/10 flex items-center justify-center">
- <Plus className="w-4 h-4 text-indigo-500 dark:text-indigo-400" />
- </div>
- <div className="flex-1">
- <h3 className="text-sm font-medium text-zinc-900 dark:text-zinc-100">
- New Workspace
- </h3>
- <p className="text-xs text-zinc-500 dark:text-zinc-400">
- Create a workspace for your team
- </p>
- </div>
- </div>
- <button
- type="button"
- onClick={() => setIsCreateWorkspaceOpen(true)}
- className="w-full px-4 py-2 bg-indigo-50 hover:bg-indigo-100 dark:bg-indigo-500/10 dark:hover:bg-indigo-500/20 text-indigo-600 dark:text-indigo-400 rounded-lg transition-colors font-medium inline-flex items-center justify-center gap-2 text-sm"
- >
- Create Workspace
- </button>
- </div>
- </div>
- </div>
- <CreateWorkspaceModal
- open={isCreateWorkspaceOpen}
- onClose={() => setIsCreateWorkspaceOpen(false)}
- />
- </div>
- );
-}
-
-export default EmptyWorkspaceState;
diff --git a/apps/web/src/components/workspace/select-workspace-state.tsx b/apps/web/src/components/workspace/select-workspace-state.tsx
deleted file mode 100644
index 88ddf784a..000000000
--- a/apps/web/src/components/workspace/select-workspace-state.tsx
+++ /dev/null
@@ -1,52 +0,0 @@
-import { motion } from "framer-motion";
-import { ArrowLeft, LayoutGrid } from "lucide-react";
-
-function SelectWorkspaceState() {
- return (
- <div className="flex-1 h-screen flex items-center justify-center bg-zinc-50 dark:bg-zinc-950">
- <motion.div
- className="max-w-md w-full px-8 flex flex-col items-center"
- initial={{ opacity: 0, y: 20 }}
- animate={{ opacity: 1, y: 0 }}
- transition={{ duration: 0.3 }}
- >
- <div className="text-center mb-8">
- <div className="relative w-16 h-16 mb-4 mx-auto">
- <motion.div
- className="w-16 h-16 rounded-2xl bg-indigo-50 dark:bg-indigo-500/10 flex items-center justify-center"
- animate={{ x: [-10, 0, -10] }}
- transition={{
- duration: 2,
- repeat: Number.POSITIVE_INFINITY,
- ease: "easeInOut",
- }}
- >
- <LayoutGrid className="w-8 h-8 text-indigo-500 dark:text-indigo-400" />
- </motion.div>
- <motion.div
- className="absolute -left-4 top-1/2 -translate-y-1/2"
- animate={{ x: [-5, 0, -5] }}
- transition={{
- duration: 2,
- repeat: Number.POSITIVE_INFINITY,
- ease: "easeInOut",
- delay: 0.5,
- }}
- >
- <ArrowLeft className="w-5 h-5 text-indigo-400 dark:text-indigo-300" />
- </motion.div>
- </div>
- <h1 className="text-2xl font-semibold text-zinc-900 dark:text-zinc-100 mb-3">
- Select a Workspace
- </h1>
- <p className="text-zinc-500 dark:text-zinc-400 text-center max-w-md">
- Choose a workspace from the dropdown in the sidebar to start
- managing your projects.
- </p>
- </div>
- </motion.div>
- </div>
- );
-}
-
-export default SelectWorkspaceState;
diff --git a/apps/web/src/constants/shortcuts.ts b/apps/web/src/constants/shortcuts.ts
new file mode 100644
index 000000000..cf116a85f
--- /dev/null
+++ b/apps/web/src/constants/shortcuts.ts
@@ -0,0 +1,33 @@
+import { getModifierKeyText } from "@/hooks/use-keyboard-shortcuts";
+
+export const shortcuts = {
+ project: {
+ prefix: "p",
+ create: "c",
+ list: "l",
+ },
+ workspace: {
+ prefix: "w",
+ switch: "s",
+ create: "c",
+ },
+ notification: {
+ prefix: "n",
+ open: "o",
+ },
+ sidebar: {
+ prefix: getModifierKeyText(),
+ toggle: "b",
+ },
+ palette: {
+ prefix: getModifierKeyText(),
+ open: "k",
+ },
+ search: {
+ prefix: "/",
+ },
+ task: {
+ prefix: "t",
+ create: "c",
+ },
+} as const;
diff --git a/apps/web/src/fetchers/workspace/create-workspace.ts b/apps/web/src/fetchers/workspace/create-workspace.ts
index 694adedc4..7498a20a4 100644
--- a/apps/web/src/fetchers/workspace/create-workspace.ts
+++ b/apps/web/src/fetchers/workspace/create-workspace.ts
@@ -1,13 +1,16 @@
import { client } from "@kaneo/libs";
import type { InferRequestType } from "hono/client";
-type CreateWorkspaceRequest = InferRequestType<
+export type CreateWorkspaceRequest = InferRequestType<
typeof client.workspace.$post
>["json"];
-const createWorkspace = async ({ name }: CreateWorkspaceRequest) => {
+const createWorkspace = async ({
+ name,
+ description,
+}: CreateWorkspaceRequest) => {
const response = await client.workspace.$post({
- json: { name },
+ json: { name, description },
});
if (!response.ok) {
diff --git a/apps/web/src/hooks/mutations/task/use-update-task.ts b/apps/web/src/hooks/mutations/task/use-update-task.ts
index b6819490d..32cfa4d6c 100644
--- a/apps/web/src/hooks/mutations/task/use-update-task.ts
+++ b/apps/web/src/hooks/mutations/task/use-update-task.ts
@@ -11,12 +11,15 @@ function useUpdateTask() {
queryClient.invalidateQueries({
queryKey: ["task", variables.id],
});
- queryClient.refetchQueries({
+ queryClient.invalidateQueries({
queryKey: ["tasks", variables.projectId],
});
- queryClient.refetchQueries({
+ queryClient.invalidateQueries({
queryKey: ["notifications"],
});
+ queryClient.invalidateQueries({
+ queryKey: ["projects"],
+ });
},
});
}
diff --git a/apps/web/src/hooks/queries/workspace/use-create-workspace.ts b/apps/web/src/hooks/queries/workspace/use-create-workspace.ts
index 3695f8ca8..95a29be85 100644
--- a/apps/web/src/hooks/queries/workspace/use-create-workspace.ts
+++ b/apps/web/src/hooks/queries/workspace/use-create-workspace.ts
@@ -1,9 +1,12 @@
-import createWorkspace from "@/fetchers/workspace/create-workspace";
+import createWorkspace, {
+ type CreateWorkspaceRequest,
+} from "@/fetchers/workspace/create-workspace";
import { useMutation } from "@tanstack/react-query";
-function useCreateWorkspace({ name }: { name: string }) {
+function useCreateWorkspace() {
return useMutation({
- mutationFn: () => createWorkspace({ name }),
+ mutationFn: ({ name, description }: CreateWorkspaceRequest) =>
+ createWorkspace({ name, description }),
});
}
diff --git a/apps/web/src/hooks/use-keyboard-shortcuts.ts b/apps/web/src/hooks/use-keyboard-shortcuts.ts
new file mode 100644
index 000000000..30d58c00a
--- /dev/null
+++ b/apps/web/src/hooks/use-keyboard-shortcuts.ts
@@ -0,0 +1,346 @@
+import React, {
+ createContext,
+ useContext,
+ useCallback,
+ useEffect,
+ useState,
+} from "react";
+
+export function getModifierKeyText(): string {
+ if (typeof window === "undefined") return "";
+ return navigator.platform.toLowerCase().includes("mac") ? "⌘" : "Ctrl";
+}
+
+type ShortcutHandler = () => void;
+type ShortcutKey = string;
+type PrefixKey = string;
+type SequentialKey = string;
+
+interface KeyboardShortcutsContextType {
+ registerShortcut: (key: ShortcutKey, handler: ShortcutHandler) => void;
+ registerSequentialShortcut: (
+ prefix: PrefixKey,
+ key: SequentialKey,
+ handler: ShortcutHandler,
+ ) => void;
+ registerModifierShortcut: (
+ modifierKey: string,
+ key: string,
+ handler: ShortcutHandler,
+ ) => void;
+ unregisterShortcut: (key: ShortcutKey) => void;
+ unregisterSequentialShortcut: (prefix: PrefixKey, key: SequentialKey) => void;
+ unregisterModifierShortcut: (modifierKey: string, key: string) => void;
+ activePrefix: string | null;
+}
+
+const KeyboardShortcutsContext =
+ createContext<KeyboardShortcutsContextType | null>(null);
+
+export function useKeyboardShortcuts() {
+ const context = useContext(KeyboardShortcutsContext);
+ if (!context) {
+ throw new Error(
+ "useKeyboardShortcuts must be used within a KeyboardShortcutsProvider",
+ );
+ }
+ return context;
+}
+
+export function KeyboardShortcutsProvider({
+ children,
+}: { children: React.ReactNode }) {
+ const [shortcuts, setShortcuts] = useState<Map<string, ShortcutHandler>>(
+ new Map(),
+ );
+ const [sequentialShortcuts, setSequentialShortcuts] = useState<
+ Map<string, Map<string, ShortcutHandler>>
+ >(new Map());
+ const [modifierShortcuts, setModifierShortcuts] = useState<
+ Map<string, ShortcutHandler>
+ >(new Map());
+ const [activePrefix, setActivePrefix] = useState<string | null>(null);
+ const [prefixTimeout, setPrefixTimeout] = useState<number | null>(null);
+
+ const resetPrefix = useCallback(() => {
+ setActivePrefix(null);
+ if (prefixTimeout) {
+ window.clearTimeout(prefixTimeout);
+ setPrefixTimeout(null);
+ }
+ }, [prefixTimeout]);
+
+ const setPrefixWithTimeout = useCallback(
+ (prefix: string) => {
+ if (prefixTimeout) {
+ window.clearTimeout(prefixTimeout);
+ }
+
+ setActivePrefix(prefix);
+
+ const timeout = window.setTimeout(() => {
+ setActivePrefix(null);
+ setPrefixTimeout(null);
+ }, 2000);
+
+ setPrefixTimeout(timeout);
+ },
+ [prefixTimeout],
+ );
+
+ const registerShortcut = useCallback(
+ (key: string, handler: ShortcutHandler) => {
+ setShortcuts((prev) => new Map(prev).set(key, handler));
+ },
+ [],
+ );
+
+ const registerSequentialShortcut = useCallback(
+ (prefix: string, key: string, handler: ShortcutHandler) => {
+ setSequentialShortcuts((prev) => {
+ const newMap = new Map(prev);
+ if (!newMap.has(prefix)) {
+ newMap.set(prefix, new Map());
+ }
+ const prefixMap = newMap.get(prefix);
+ if (prefixMap) {
+ prefixMap.set(key, handler);
+ }
+ return newMap;
+ });
+ },
+ [],
+ );
+
+ const registerModifierShortcut = useCallback(
+ (modifierKey: string, key: string, handler: ShortcutHandler) => {
+ const shortcutKey = `${modifierKey}+${key.toLowerCase()}`;
+ setModifierShortcuts((prev) => new Map(prev).set(shortcutKey, handler));
+ },
+ [],
+ );
+
+ const unregisterShortcut = useCallback((key: string) => {
+ setShortcuts((prev) => {
+ const newMap = new Map(prev);
+ newMap.delete(key);
+ return newMap;
+ });
+ }, []);
+
+ const unregisterSequentialShortcut = useCallback(
+ (prefix: string, key: string) => {
+ setSequentialShortcuts((prev) => {
+ const newMap = new Map(prev);
+ if (newMap.has(prefix)) {
+ const prefixMap = newMap.get(prefix);
+ if (prefixMap) {
+ prefixMap.delete(key);
+ if (prefixMap.size === 0) {
+ newMap.delete(prefix);
+ }
+ }
+ }
+ return newMap;
+ });
+ },
+ [],
+ );
+
+ const unregisterModifierShortcut = useCallback(
+ (modifierKey: string, key: string) => {
+ const shortcutKey = `${modifierKey}+${key.toLowerCase()}`;
+ setModifierShortcuts((prev) => {
+ const newMap = new Map(prev);
+ newMap.delete(shortcutKey);
+ return newMap;
+ });
+ },
+ [],
+ );
+
+ const handleKeyPress = useCallback(
+ (event: KeyboardEvent) => {
+ const target = event.target as HTMLElement;
+ if (
+ target.tagName === "INPUT" ||
+ target.tagName === "TEXTAREA" ||
+ target.contentEditable === "true"
+ ) {
+ return;
+ }
+
+ const key = event.key.toLowerCase();
+
+ if (event.ctrlKey || event.metaKey || event.altKey || event.shiftKey) {
+ const modifierKey = event.metaKey
+ ? "⌘"
+ : event.ctrlKey
+ ? "Ctrl"
+ : event.altKey
+ ? "Alt"
+ : "Shift";
+ const shortcutKey = `${modifierKey}+${key}`;
+
+ if (modifierShortcuts.has(shortcutKey)) {
+ event.preventDefault();
+ const handler = modifierShortcuts.get(shortcutKey);
+ if (handler) {
+ handler();
+ }
+ return;
+ }
+ return;
+ }
+
+ if (activePrefix && sequentialShortcuts.has(activePrefix)) {
+ const prefixMap = sequentialShortcuts.get(activePrefix);
+ if (prefixMap?.has(key)) {
+ event.preventDefault();
+ const handler = prefixMap.get(key);
+ if (handler) {
+ handler();
+ }
+ resetPrefix();
+ return;
+ }
+ }
+
+ if (shortcuts.has(key)) {
+ event.preventDefault();
+ const handler = shortcuts.get(key);
+ if (handler) {
+ handler();
+ }
+ } else if (sequentialShortcuts.has(key)) {
+ event.preventDefault();
+ setPrefixWithTimeout(key);
+ }
+ },
+ [
+ activePrefix,
+ shortcuts,
+ sequentialShortcuts,
+ modifierShortcuts,
+ resetPrefix,
+ setPrefixWithTimeout,
+ ],
+ );
+
+ useEffect(() => {
+ document.addEventListener("keydown", handleKeyPress);
+ return () => {
+ document.removeEventListener("keydown", handleKeyPress);
+ if (prefixTimeout) {
+ window.clearTimeout(prefixTimeout);
+ }
+ };
+ }, [handleKeyPress, prefixTimeout]);
+
+ useEffect(() => {
+ return () => {
+ if (prefixTimeout) {
+ window.clearTimeout(prefixTimeout);
+ }
+ };
+ }, [prefixTimeout]);
+
+ const value = {
+ registerShortcut,
+ registerSequentialShortcut,
+ registerModifierShortcut,
+ unregisterShortcut,
+ unregisterSequentialShortcut,
+ unregisterModifierShortcut,
+ activePrefix,
+ };
+
+ return React.createElement(
+ KeyboardShortcutsContext.Provider,
+ { value },
+ children,
+ );
+}
+
+export function useRegisterShortcuts(shortcutsConfig: {
+ shortcuts?: { [key: string]: ShortcutHandler };
+ sequentialShortcuts?: {
+ [prefix: string]: { [key: string]: ShortcutHandler };
+ };
+ modifierShortcuts?: {
+ [modifierKey: string]: { [key: string]: ShortcutHandler };
+ };
+}) {
+ const {
+ registerShortcut,
+ registerSequentialShortcut,
+ registerModifierShortcut,
+ unregisterShortcut,
+ unregisterSequentialShortcut,
+ unregisterModifierShortcut,
+ } = useKeyboardShortcuts();
+
+ useEffect(() => {
+ if (shortcutsConfig.shortcuts) {
+ for (const [key, handler] of Object.entries(shortcutsConfig.shortcuts)) {
+ registerShortcut(key, handler);
+ }
+ }
+
+ if (shortcutsConfig.sequentialShortcuts) {
+ for (const [prefix, prefixMap] of Object.entries(
+ shortcutsConfig.sequentialShortcuts,
+ )) {
+ for (const [key, handler] of Object.entries(prefixMap)) {
+ registerSequentialShortcut(prefix, key, handler);
+ }
+ }
+ }
+
+ if (shortcutsConfig.modifierShortcuts) {
+ for (const [modifierKey, keyMap] of Object.entries(
+ shortcutsConfig.modifierShortcuts,
+ )) {
+ for (const [key, handler] of Object.entries(keyMap)) {
+ registerModifierShortcut(modifierKey, key, handler);
+ }
+ }
+ }
+
+ return () => {
+ if (shortcutsConfig.shortcuts) {
+ for (const key of Object.keys(shortcutsConfig.shortcuts)) {
+ unregisterShortcut(key);
+ }
+ }
+
+ if (shortcutsConfig.sequentialShortcuts) {
+ for (const [prefix, prefixMap] of Object.entries(
+ shortcutsConfig.sequentialShortcuts,
+ )) {
+ for (const key of Object.keys(prefixMap)) {
+ unregisterSequentialShortcut(prefix, key);
+ }
+ }
+ }
+
+ if (shortcutsConfig.modifierShortcuts) {
+ for (const [modifierKey, keyMap] of Object.entries(
+ shortcutsConfig.modifierShortcuts,
+ )) {
+ for (const key of Object.keys(keyMap)) {
+ unregisterModifierShortcut(modifierKey, key);
+ }
+ }
+ }
+ };
+ }, [
+ registerShortcut,
+ registerSequentialShortcut,
+ registerModifierShortcut,
+ unregisterShortcut,
+ unregisterSequentialShortcut,
+ unregisterModifierShortcut,
+ shortcutsConfig,
+ ]);
+}
diff --git a/apps/web/src/hooks/use-mobile.ts b/apps/web/src/hooks/use-mobile.ts
new file mode 100644
index 000000000..a93d58393
--- /dev/null
+++ b/apps/web/src/hooks/use-mobile.ts
@@ -0,0 +1,21 @@
+import * as React from "react";
+
+const MOBILE_BREAKPOINT = 768;
+
+export function useIsMobile() {
+ const [isMobile, setIsMobile] = React.useState<boolean | undefined>(
+ undefined,
+ );
+
+ React.useEffect(() => {
+ const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
+ const onChange = () => {
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
+ };
+ mql.addEventListener("change", onChange);
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
+ return () => mql.removeEventListener("change", onChange);
+ }, []);
+
+ return !!isMobile;
+}
diff --git a/apps/web/src/hooks/use-task-filters.ts b/apps/web/src/hooks/use-task-filters.ts
new file mode 100644
index 000000000..d7637ef37
--- /dev/null
+++ b/apps/web/src/hooks/use-task-filters.ts
@@ -0,0 +1,113 @@
+import type { ProjectWithTasks } from "@/types/project";
+import type Task from "@/types/task";
+import { addWeeks, endOfWeek, isWithinInterval, startOfWeek } from "date-fns";
+import { useState } from "react";
+
+export interface BoardFilters {
+ status: string | null;
+ priority: string | null;
+ assignee: string | null;
+ dueDate: string | null;
+}
+
+export function useTaskFilters(project: ProjectWithTasks | null | undefined) {
+ const [filters, setFilters] = useState<BoardFilters>({
+ status: null,
+ priority: null,
+ assignee: null,
+ dueDate: null,
+ });
+
+ const filterTasks = (tasks: Task[]): Task[] => {
+ return tasks.filter((task) => {
+ if (filters.status && task.status !== filters.status) {
+ return false;
+ }
+
+ if (filters.priority && task.priority !== filters.priority) {
+ return false;
+ }
+
+ if (filters.assignee && task.userEmail !== filters.assignee) {
+ return false;
+ }
+
+ if (filters.dueDate && task.dueDate) {
+ const today = new Date();
+ const taskDate = new Date(task.dueDate);
+
+ switch (filters.dueDate) {
+ case "Due this week": {
+ const weekStart = startOfWeek(today);
+ const weekEnd = endOfWeek(today);
+ if (
+ !isWithinInterval(taskDate, { start: weekStart, end: weekEnd })
+ ) {
+ return false;
+ }
+ break;
+ }
+ case "Due next week": {
+ const nextWeekStart = startOfWeek(addWeeks(today, 1));
+ const nextWeekEnd = endOfWeek(addWeeks(today, 1));
+ if (
+ !isWithinInterval(taskDate, {
+ start: nextWeekStart,
+ end: nextWeekEnd,
+ })
+ ) {
+ return false;
+ }
+ break;
+ }
+ case "No due date": {
+ return false;
+ }
+ }
+ }
+
+ if (filters.dueDate === "No due date" && task.dueDate) {
+ return false;
+ }
+
+ return true;
+ });
+ };
+
+ const filteredProject = project
+ ? {
+ ...project,
+ columns:
+ project.columns?.map((column) => ({
+ ...column,
+ tasks: filterTasks(column.tasks),
+ })) ?? [],
+ }
+ : null;
+
+ const hasActiveFilters = Object.values(filters).some(
+ (filter) => filter !== null,
+ );
+
+ const clearFilters = () => {
+ setFilters({
+ status: null,
+ priority: null,
+ assignee: null,
+ dueDate: null,
+ });
+ };
+
+ const updateFilter = (key: keyof BoardFilters, value: string | null) => {
+ setFilters((prev) => ({ ...prev, [key]: value }));
+ };
+
+ return {
+ filters,
+ setFilters,
+ updateFilter,
+ filteredProject,
+ hasActiveFilters,
+ clearFilters,
+ };
+}
diff --git a/apps/web/src/hooks/use-user-preferences-effects.ts b/apps/web/src/hooks/use-user-preferences-effects.ts
new file mode 100644
index 000000000..1e281668f
--- /dev/null
+++ b/apps/web/src/hooks/use-user-preferences-effects.ts
@@ -0,0 +1,37 @@
+import { useUserPreferencesStore } from "@/store/user-preferences";
+import { useEffect } from "react";
+
+export function useUserPreferencesEffects() {
+ const { compactMode, theme } = useUserPreferencesStore();
+
+ useEffect(() => {
+ const root = document.documentElement;
+
+ if (compactMode) {
+ root.classList.add("compact-mode");
+ } else {
+ root.classList.remove("compact-mode");
+ }
+
+ return () => {
+ root.classList.remove("compact-mode");
+ };
+ }, [compactMode]);
+
+ useEffect(() => {
+ const root = document.documentElement;
+
+ root.classList.remove("theme-light", "theme-dark", "theme-system");
+
+ root.classList.add(`theme-${theme}`);
+
+ return () => {
+ root.classList.remove("theme-light", "theme-dark", "theme-system");
+ };
+ }, [theme]);
+
+ return {
+ compactMode,
+ theme,
+ };
+}
diff --git a/apps/web/src/index.css b/apps/web/src/index.css
index 4dda4996a..22394287f 100644
--- a/apps/web/src/index.css
+++ b/apps/web/src/index.css
@@ -7,107 +7,107 @@
@custom-variant dark (&:is(.dark *));
-@theme {
- --color-border: hsl(var(--border));
- --color-input: hsl(var(--input));
- --color-ring: hsl(var(--ring));
- --color-background: hsl(var(--background));
- --color-foreground: hsl(var(--foreground));
-
- --color-primary: hsl(var(--primary));
- --color-primary-foreground: hsl(var(--primary-foreground));
-
- --color-secondary: hsl(var(--secondary));
- --color-secondary-foreground: hsl(var(--secondary-foreground));
-
- --color-destructive: hsl(var(--destructive));
- --color-destructive-foreground: hsl(var(--destructive-foreground));
-
- --color-muted: hsl(var(--muted));
- --color-muted-foreground: hsl(var(--muted-foreground));
-
- --color-accent: hsl(var(--accent));
- --color-accent-foreground: hsl(var(--accent-foreground));
-
- --color-popover: hsl(var(--popover));
- --color-popover-foreground: hsl(var(--popover-foreground));
-
- --color-card: hsl(var(--card));
- --color-card-foreground: hsl(var(--card-foreground));
-
- --radius-lg: var(--radius);
- --radius-md: calc(var(--radius) - 2px);
- --radius-sm: calc(var(--radius) - 4px);
-
-}
-
-/*
- The default border color has changed to `currentColor` in Tailwind CSS v4,
- so we've added these compatibility styles to make sure everything still
- looks the same as it did with Tailwind CSS v3.
-
- If we ever want to remove these styles, we need to add an explicit border
- color utility to any element that depends on these defaults.
-*/
-@layer base {
- *,
- ::after,
- ::before,
- ::backdrop,
- ::file-selector-button {
- border-color: var(--color-gray-200, currentColor);
- }
- button {
- cursor: pointer;
- }
-}
-
@layer base {
:root {
color-scheme: light;
- --background: 0 0% 100%;
- --foreground: 240 10% 3.9%;
- --card: 0 0% 100%;
- --card-foreground: 240 10% 3.9%;
- --popover: 0 0% 100%;
- --popover-foreground: 240 10% 3.9%;
- --primary: 240 5.9% 10%;
- --primary-foreground: 0 0% 98%;
- --secondary: 240 4.8% 95.9%;
- --secondary-foreground: 240 5.9% 10%;
- --muted: 240 4.8% 95.9%;
- --muted-foreground: 240 3.8% 46.1%;
- --accent: 240 4.8% 95.9%;
- --accent-foreground: 240 5.9% 10%;
- --destructive: 0 84.2% 60.2%;
- --destructive-foreground: 0 0% 98%;
- --border: 240 5.9% 90%;
- --input: 240 5.9% 90%;
- --ring: 240 5.9% 10%;
+ --background: oklch(0.9881 0 0);
+ --foreground: oklch(0.1881 0.0060 285.8056);
+ --card: oklch(1.0000 0 0);
+ --card-foreground: oklch(0.1881 0.0060 285.8056);
+ --card-gradient: linear-gradient(to bottom right, oklch(1.0000 0 0), oklch(1.0000 0 0), oklch(0.9881 0 0));
+ --popover: oklch(0.9881 0 0);
+ --popover-foreground: oklch(0.1881 0.0060 285.8056);
+ --primary: oklch(0.5820 0.2289 272.7771);
+ --primary-foreground: oklch(0.9851 0 0);
+ --secondary: oklch(0.9524 0.0013 286.3747);
+ --secondary-foreground: oklch(0.1881 0.0060 285.8056);
+ --muted: oklch(0.9674 0.0013 286.3752);
+ --muted-foreground: oklch(0.5343 0.0139 285.9192);
+ --accent: oklch(0.9524 0.0013 286.3747);
+ --accent-foreground: oklch(0.1881 0.0060 285.8056);
+ --destructive: oklch(0.5785 0.2138 27.1723);
+ --destructive-foreground: oklch(0.9851 0 0);
+ --border: oklch(0.8714 0.0068 286.2574);
+ --input: oklch(0.8714 0.0068 286.2574);
+ --ring: oklch(0.5820 0.2289 272.7771);
+ --chart-1: oklch(0.8688 0.1348 154.6144);
+ --chart-2: oklch(0.5820 0.2289 272.7771);
+ --chart-3: oklch(0.7118 0.0129 286.0665);
+ --chart-4: oklch(0.9197 0.0040 286.3202);
+ --chart-5: oklch(0.5343 0.0139 285.9192);
+ --sidebar: oklch(0.9794 0.0013 286.3747);
+ --sidebar-foreground: oklch(0.1881 0.0060 285.8056);
+ --sidebar-primary: oklch(0.5820 0.2289 272.7771);
+ --sidebar-primary-foreground: oklch(1.0000 0 0);
+ --sidebar-accent: oklch(0.9674 0.0013 286.3752);
+ --sidebar-accent-foreground: oklch(0.1881 0.0060 285.8056);
+ --sidebar-border: oklch(0.8714 0.0068 286.2574);
+ --sidebar-ring: oklch(0.5820 0.2289 272.7771);
+ --font-sans: 'Inter', system-ui, sans-serif;
+ --font-serif: 'Georgia', serif;
+ --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
--radius: 0.5rem;
+ --shadow-2xs: 0px 1px 2px 0px hsl(0 0% 0% / 0.09);
+ --shadow-xs: 0px 1px 2px 0px hsl(0 0% 0% / 0.09);
+ --shadow-sm: 0px 1px 2px 0px hsl(0 0% 0% / 0.18), 0px 1px 2px -1px hsl(0 0% 0% / 0.18);
+ --shadow: 0px 1px 2px 0px hsl(0 0% 0% / 0.18), 0px 1px 2px -1px hsl(0 0% 0% / 0.18);
+ --shadow-md: 0px 1px 2px 0px hsl(0 0% 0% / 0.18), 0px 2px 4px -1px hsl(0 0% 0% / 0.18);
+ --shadow-lg: 0px 1px 2px 0px hsl(0 0% 0% / 0.18), 0px 4px 6px -1px hsl(0 0% 0% / 0.18);
+ --shadow-xl: 0px 1px 2px 0px hsl(0 0% 0% / 0.18), 0px 8px 10px -1px hsl(0 0% 0% / 0.18);
+ --shadow-2xl: 0px 1px 2px 0px hsl(0 0% 0% / 0.45);
+ --tracking-normal: 0em;
+ --spacing: 0.25rem;
}
.dark {
color-scheme: dark;
- --background: 240 10% 3.9%;
- --foreground: 0 0% 98%;
- --card: 240 10% 3.9%;
- --card-foreground: 0 0% 98%;
- --popover: 240 10% 3.9%;
- --popover-foreground: 0 0% 98%;
- --primary: 0 0% 98%;
- --primary-foreground: 240 5.9% 10%;
- --secondary: 240 3.7% 15.9%;
- --secondary-foreground: 0 0% 98%;
- --muted: 240 3.7% 15.9%;
- --muted-foreground: 240 5% 64.9%;
- --accent: 240 3.7% 15.9%;
- --accent-foreground: 0 0% 98%;
- --destructive: 0 62.8% 30.6%;
- --destructive-foreground: 0 0% 98%;
- --border: 240 3.7% 15.9%;
- --input: 240 3.7% 15.9%;
- --ring: 240 4.9% 83.9%;
+ --background: oklch(0.1252 0.0018 286.1313);
+ --foreground: oklch(0.9674 0.0013 286.3752);
+ --card: oklch(0.1717 0.0018 286.2103);
+ --card-foreground: oklch(0.9674 0.0013 286.3752);
+ --card-gradient: linear-gradient(to bottom right, rgb(24 24 27), rgb(24 24 27), rgb(39 39 42));
+ --popover: oklch(0.2100 0.0025 286.1774);
+ --popover-foreground: oklch(0.9674 0.0013 286.3752);
+ --primary: oklch(0.5820 0.2289 272.7771);
+ --primary-foreground: oklch(0.1252 0.0018 286.1313);
+ --secondary: oklch(0.2120 0.0047 285.9459);
+ --secondary-foreground: oklch(0.9674 0.0013 286.3752);
+ --muted: oklch(0.1903 0.0049 285.8852);
+ --muted-foreground: oklch(0.6879 0.0091 286.1398);
+ --accent: oklch(0.2332 0.0046 285.9939);
+ --accent-foreground: oklch(0.9674 0.0013 286.3752);
+ --destructive: oklch(0.5618 0.1955 26.2182);
+ --destructive-foreground: oklch(0.9674 0.0013 286.3752);
+ --border: oklch(0.2947 0.0061 285.9873);
+ --input: oklch(0.2539 0.0045 286.0326);
+ --ring: oklch(0.5820 0.2289 272.7771);
+ --chart-1: oklch(0.7362 0.0089 286.1606);
+ --chart-2: oklch(0.5820 0.2289 272.7771);
+ --chart-3: oklch(0.6944 0.0090 286.1428);
+ --chart-4: oklch(0.4356 0.0103 285.9442);
+ --chart-5: oklch(0.5213 0.0129 285.9271);
+ --sidebar: oklch(0.1903 0.0049 285.8852);
+ --sidebar-foreground: oklch(0.9674 0.0013 286.3752);
+ --sidebar-primary: oklch(0.5820 0.2289 272.7771);
+ --sidebar-primary-foreground: oklch(0.1903 0.0049 285.8852);
+ --sidebar-accent: oklch(0.2332 0.0046 285.9939);
+ --sidebar-accent-foreground: oklch(0.9674 0.0013 286.3752);
+ --sidebar-border: oklch(0.2947 0.0061 285.9873);
+ --sidebar-ring: oklch(0.5820 0.2289 272.7771);
+ --font-sans: 'Inter', system-ui, sans-serif;
+ --font-serif: 'Georgia', serif;
+ --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
+ --radius: 0.5rem;
+ --shadow-2xs: 0px 1px 2px 0px hsl(0 0% 0% / 0.09);
+ --shadow-xs: 0px 1px 2px 0px hsl(0 0% 0% / 0.09);
+ --shadow-sm: 0px 1px 2px 0px hsl(0 0% 0% / 0.18), 0px 1px 2px -1px hsl(0 0% 0% / 0.18);
+ --shadow: 0px 1px 2px 0px hsl(0 0% 0% / 0.18), 0px 1px 2px -1px hsl(0 0% 0% / 0.18);
+ --shadow-md: 0px 1px 2px 0px hsl(0 0% 0% / 0.18), 0px 2px 4px -1px hsl(0 0% 0% / 0.18);
+ --shadow-lg: 0px 1px 2px 0px hsl(0 0% 0% / 0.18), 0px 4px 6px -1px hsl(0 0% 0% / 0.18);
+ --shadow-xl: 0px 1px 2px 0px hsl(0 0% 0% / 0.18), 0px 8px 10px -1px hsl(0 0% 0% / 0.18);
+ --shadow-2xl: 0px 1px 2px 0px hsl(0 0% 0% / 0.45);
+ --tracking-normal: 0em;
+ --spacing: 0.25rem;
}
* {
@@ -120,27 +120,195 @@
}
*::-webkit-scrollbar-thumb {
- background-color: theme('colors.zinc.300');
+ background-color: hsl(var(--muted));
border-radius: 9999px;
}
.dark *::-webkit-scrollbar-thumb {
- background-color: theme('colors.zinc.700');
+ background-color: hsl(var(--muted));
}
*::-webkit-scrollbar-track {
background-color: transparent;
}
-}
-@layer base {
+ *,
+ ::after,
+ ::before,
+ ::backdrop,
+ ::file-selector-button {
+ border-color: var(--color-border, currentColor);
+ }
+
+ button {
+ cursor: pointer;
+ }
+
body {
- @apply text-zinc-900
+ @apply bg-background text-foreground;
}
-
- .dark {
- body {
- @apply text-zinc-300
+}
+
+@theme inline {
+ --color-background: var(--background);
+ --color-foreground: var(--foreground);
+ --color-card: var(--card);
+ --color-card-foreground: var(--card-foreground);
+ --color-card-gradient: var(--card-gradient);
+ --color-popover: var(--popover);
+ --color-popover-foreground: var(--popover-foreground);
+ --color-primary: var(--primary);
+ --color-primary-foreground: var(--primary-foreground);
+ --color-secondary: var(--secondary);
+ --color-secondary-foreground: var(--secondary-foreground);
+ --color-muted: var(--muted);
+ --color-muted-foreground: var(--muted-foreground);
+ --color-accent: var(--accent);
+ --color-accent-foreground: var(--accent-foreground);
+ --color-destructive: var(--destructive);
+ --color-destructive-foreground: var(--destructive-foreground);
+ --color-border: var(--border);
+ --color-input: var(--input);
+ --color-ring: var(--ring);
+ --color-chart-1: var(--chart-1);
+ --color-chart-2: var(--chart-2);
+ --color-chart-3: var(--chart-3);
+ --color-chart-4: var(--chart-4);
+ --color-chart-5: var(--chart-5);
+ --color-sidebar: var(--sidebar);
+ --color-sidebar-foreground: var(--sidebar-foreground);
+ --color-sidebar-primary: var(--sidebar-primary);
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
+ --color-sidebar-accent: var(--sidebar-accent);
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
+ --color-sidebar-border: var(--sidebar-border);
+ --color-sidebar-ring: var(--sidebar-ring);
+
+ --font-sans: var(--font-sans);
+ --font-mono: var(--font-mono);
+ --font-serif: var(--font-serif);
+
+ --radius-sm: calc(var(--radius) - 4px);
+ --radius-md: calc(var(--radius) - 2px);
+ --radius-lg: var(--radius);
+ --radius-xl: calc(var(--radius) + 4px);
+
+ --shadow-2xs: var(--shadow-2xs);
+ --shadow-xs: var(--shadow-xs);
+ --shadow-sm: var(--shadow-sm);
+ --shadow: var(--shadow);
+ --shadow-md: var(--shadow-md);
+ --shadow-lg: var(--shadow-lg);
+ --shadow-xl: var(--shadow-xl);
+ --shadow-2xl: var(--shadow-2xl);
+
+ --tracking-normal: var(--tracking-normal);
+ --spacing: var(--spacing);
+}
+
+@layer utilities {
+ .bg-card-gradient {
+ background: var(--card-gradient);
+ }
+
+ .line-clamp-2 {
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+ }
+
+ .line-clamp-3 {
+ display: -webkit-box;
+ -webkit-line-clamp: 3;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+ }
+}
+
+/* View Transitions for Theme Switching */
+@supports (view-transition-name: none) {
+ ::view-transition-old(root),
+ ::view-transition-new(root) {
+ animation: none;
+ mix-blend-mode: normal;
+ }
+
+ ::view-transition-old(root) {
+ /* Ensure the outgoing view (old theme) is beneath */
+ z-index: 0;
+ }
+
+ ::view-transition-new(root) {
+ /* Ensure the incoming view (new theme) is always on top */
+ z-index: 1;
+ /* Apply the reveal animation */
+ animation: reveal 0.4s ease-in-out forwards;
+ }
+
+ @keyframes reveal {
+ from {
+ /* Use CSS variables for the origin, defaulting to center if not set */
+ clip-path: circle(0% at var(--x, 50%) var(--y, 50%));
+ opacity: 0.7;
+ }
+ to {
+ /* Use CSS variables for the origin, defaulting to center if not set */
+ clip-path: circle(150% at var(--x, 50%) var(--y, 50%));
+ opacity: 1;
}
}
}
+
+/* Reduced motion preference */
+@media (prefers-reduced-motion: reduce) {
+ ::view-transition-new(root) {
+ animation-duration: 0.1s !important;
+ }
+}
+
+/* User Preferences CSS */
+
+/* Compact Mode - Reduce padding and spacing throughout the app */
+.compact-mode {
+ --spacing-factor: 0.75;
+}
+
+.compact-mode [data-sidebar="sidebar"] {
+ --sidebar-width: calc(var(--spacing) * 52);
+}
+
+.compact-mode .p-1 { padding: calc(0.25rem * var(--spacing-factor, 1)); }
+.compact-mode .p-2 { padding: calc(0.5rem * var(--spacing-factor, 1)); }
+.compact-mode .p-3 { padding: calc(0.75rem * var(--spacing-factor, 1)); }
+.compact-mode .p-4 { padding: calc(1rem * var(--spacing-factor, 1)); }
+.compact-mode .p-6 { padding: calc(1.5rem * var(--spacing-factor, 1)); }
+
+.compact-mode .gap-1 { gap: calc(0.25rem * var(--spacing-factor, 1)); }
+.compact-mode .gap-2 { gap: calc(0.5rem * var(--spacing-factor, 1)); }
+.compact-mode .gap-3 { gap: calc(0.75rem * var(--spacing-factor, 1)); }
+.compact-mode .gap-4 { gap: calc(1rem * var(--spacing-factor, 1)); }
+
+.compact-mode .space-y-1 > * + * { margin-top: calc(0.25rem * var(--spacing-factor, 1)); }
+.compact-mode .space-y-2 > * + * { margin-top: calc(0.5rem * var(--spacing-factor, 1)); }
+.compact-mode .space-y-3 > * + * { margin-top: calc(0.75rem * var(--spacing-factor, 1)); }
+.compact-mode .space-y-4 > * + * { margin-top: calc(1rem * var(--spacing-factor, 1)); }
+
+/* Theme-specific overrides */
+.theme-light {
+ --primary-accent: oklch(0.5820 0.2289 272.7771);
+}
+
+.theme-dark {
+ --primary-accent: oklch(0.6820 0.1989 272.7771);
+}
+
+.theme-system {
+ --primary-accent: oklch(0.5820 0.2289 272.7771);
+}
+
+@media (prefers-color-scheme: dark) {
+ .theme-system {
+ --primary-accent: oklch(0.6820 0.1989 272.7771);
+ }
+}
diff --git a/apps/web/src/lib/column.ts b/apps/web/src/lib/column.ts
new file mode 100644
index 000000000..c5da67487
--- /dev/null
+++ b/apps/web/src/lib/column.ts
@@ -0,0 +1,31 @@
+import { CheckCircle, Circle, Clock, Eye } from "lucide-react";
+
+export const getColumnIcon = (columnId: string) => {
+ switch (columnId) {
+ case "to-do":
+ return Circle;
+ case "in-progress":
+ return Clock;
+ case "in-review":
+ return Eye;
+ case "done":
+ return CheckCircle;
+ default:
+ return Circle;
+ }
+};
+
+export const getColumnIconColor = (columnId: string) => {
+ switch (columnId) {
+ case "to-do":
+ return "text-zinc-400 dark:text-zinc-500";
+ case "in-progress":
+ return "text-yellow-500 dark:text-yellow-400";
+ case "in-review":
+ return "text-blue-500 dark:text-blue-400";
+ case "done":
+ return "text-green-500 dark:text-green-400";
+ default:
+ return "text-zinc-400 dark:text-zinc-500";
+ }
+};
diff --git a/apps/web/src/lib/due-date-status.ts b/apps/web/src/lib/due-date-status.ts
new file mode 100644
index 000000000..ff162c9de
--- /dev/null
+++ b/apps/web/src/lib/due-date-status.ts
@@ -0,0 +1,36 @@
+export type DueDateStatus =
+ | "overdue"
+ | "due-soon"
+ | "far-future"
+ | "no-due-date";
+
+export function getDueDateStatus(dueDate: string | null): DueDateStatus {
+ if (!dueDate) return "no-due-date";
+
+ const now = new Date();
+ const due = new Date(dueDate);
+ const diffInDays = Math.ceil(
+ (due.getTime() - now.getTime()) / (1000 * 60 * 60 * 24),
+ );
+
+ if (diffInDays < 0) return "overdue";
+ if (diffInDays <= 3) return "due-soon";
+ return "far-future";
+}
+
+export const dueDateStatusColors = {
+ overdue: "text-red-500 dark:text-red-400 bg-red-50/50 dark:bg-red-950/20",
+ "due-soon":
+ "text-orange-500 dark:text-orange-400 bg-orange-50/50 dark:bg-orange-950/20",
+ "far-future":
+ "text-zinc-500 dark:text-zinc-400 bg-zinc-50/50 dark:bg-zinc-800/30",
+ "no-due-date":
+ "text-zinc-500 dark:text-zinc-400 bg-zinc-50/50 dark:bg-zinc-800/30",
+} as const;
+
+export const dueDateStatusIcons = {
+ overdue: "calendar-x",
+ "due-soon": "calendar-clock",
+ "far-future": "calendar",
+ "no-due-date": "calendar",
+} as const;
diff --git a/apps/web/src/lib/get-click-coordinates.ts b/apps/web/src/lib/get-click-coordinates.ts
new file mode 100644
index 000000000..c774d7823
--- /dev/null
+++ b/apps/web/src/lib/get-click-coordinates.ts
@@ -0,0 +1,37 @@
+import type { MouseEvent } from "react";
+
+/**
+ * Get click coordinates relative to the viewport as percentages.
+ * Useful for positioning animations like circular reveals.
+ *
+ * @param event - The mouse event from a click handler
+ * @returns Object with x and y coordinates as percentages (0-100)
+ */
+export function getClickCoordinates(event: MouseEvent<HTMLElement>): {
+ x: number;
+ y: number;
+} {
+ const rect = event.currentTarget.getBoundingClientRect();
+ const x = ((rect.left + rect.width / 2) / window.innerWidth) * 100;
+ const y = ((rect.top + rect.height / 2) / window.innerHeight) * 100;
+
+ return { x, y };
+}
+
+/**
+ * Get coordinates from an element's center position.
+ * Useful for programmatic animations without click events.
+ *
+ * @param element - The HTML element to get coordinates from
+ * @returns Object with x and y coordinates as percentages (0-100)
+ */
+export function getElementCoordinates(element: HTMLElement): {
+ x: number;
+ y: number;
+} {
+ const rect = element.getBoundingClientRect();
+ const x = ((rect.left + rect.width / 2) / window.innerWidth) * 100;
+ const y = ((rect.top + rect.height / 2) / window.innerHeight) * 100;
+
+ return { x, y };
+}
diff --git a/apps/web/src/main.tsx b/apps/web/src/main.tsx
index 1f41740ba..22f761405 100644
--- a/apps/web/src/main.tsx
+++ b/apps/web/src/main.tsx
@@ -7,6 +7,7 @@ import "@/index.css";
import AuthProvider from "./components/providers/auth-provider";
import useAuth from "./components/providers/auth-provider/hooks/use-auth";
import { ThemeProvider } from "./components/providers/theme-provider";
+import { KeyboardShortcutsProvider } from "./hooks/use-keyboard-shortcuts";
import { routeTree } from "./routeTree.gen";
const router = createRouter({
@@ -39,7 +40,9 @@ if (!rootElement.innerHTML) {
<QueryClientProvider client={queryClient}>
<ThemeProvider>
<AuthProvider>
- <App />
+ <KeyboardShortcutsProvider>
+ <App />
+ </KeyboardShortcutsProvider>
</AuthProvider>
</ThemeProvider>
</QueryClientProvider>
diff --git a/apps/web/src/routeTree.gen.ts b/apps/web/src/routeTree.gen.ts
index 824ffda69..bae8e661c 100644
--- a/apps/web/src/routeTree.gen.ts
+++ b/apps/web/src/routeTree.gen.ts
@@ -8,30 +8,26 @@
// You should NOT make any changes in this file as it will be overwritten.
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
-import { createFileRoute } from '@tanstack/react-router'
-
import { Route as rootRouteImport } from './routes/__root'
import { Route as DashboardRouteImport } from './routes/dashboard'
import { Route as IndexRouteImport } from './routes/index'
import { Route as PublicProjectProjectIdRouteImport } from './routes/public-project.$projectId'
import { Route as DashboardSettingsRouteImport } from './routes/dashboard/settings'
+import { Route as DashboardSplatRouteImport } from './routes/dashboard/$'
import { Route as AuthSignUpRouteImport } from './routes/auth/sign-up'
import { Route as AuthSignInRouteImport } from './routes/auth/sign-in'
+import { Route as DashboardWorkspaceCreateRouteImport } from './routes/dashboard/workspace/create'
import { Route as DashboardWorkspaceWorkspaceIdRouteImport } from './routes/dashboard/workspace/$workspaceId'
import { Route as DashboardSettingsAppearanceRouteImport } from './routes/dashboard/settings/appearance'
-import { Route as DashboardWorkspaceSettingsWorkspaceIdIndexRouteImport } from './routes/dashboard/workspace-settings/$workspaceId/index'
-import { Route as DashboardTeamsWorkspaceIdLayoutRouteImport } from './routes/dashboard/teams/$workspaceId/_layout'
-import { Route as DashboardWorkspaceWorkspaceIdProjectProjectIdRouteImport } from './routes/dashboard/workspace/$workspaceId/project/$projectId'
-import { Route as DashboardTeamsWorkspaceIdLayoutRolesRouteImport } from './routes/dashboard/teams/$workspaceId/_layout.roles'
-import { Route as DashboardTeamsWorkspaceIdLayoutMembersRouteImport } from './routes/dashboard/teams/$workspaceId/_layout.members'
+import { Route as DashboardWorkspaceWorkspaceIdIndexRouteImport } from './routes/dashboard/workspace/$workspaceId/index'
+import { Route as DashboardWorkspaceWorkspaceIdSettingsRouteImport } from './routes/dashboard/workspace/$workspaceId/settings'
+import { Route as DashboardWorkspaceWorkspaceIdSearchRouteImport } from './routes/dashboard/workspace/$workspaceId/search'
+import { Route as DashboardWorkspaceWorkspaceIdMembersRouteImport } from './routes/dashboard/workspace/$workspaceId/members'
+import { Route as DashboardWorkspaceWorkspaceIdProjectProjectIdIndexRouteImport } from './routes/dashboard/workspace/$workspaceId/project/$projectId/index'
import { Route as DashboardWorkspaceWorkspaceIdProjectProjectIdSettingsRouteImport } from './routes/dashboard/workspace/$workspaceId/project/$projectId/settings'
import { Route as DashboardWorkspaceWorkspaceIdProjectProjectIdBoardRouteImport } from './routes/dashboard/workspace/$workspaceId/project/$projectId/board'
import { Route as DashboardWorkspaceWorkspaceIdProjectProjectIdBacklogRouteImport } from './routes/dashboard/workspace/$workspaceId/project/$projectId/backlog'
-import { Route as DashboardWorkspaceWorkspaceIdProjectProjectIdTaskTaskIdRouteImport } from './routes/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId'
-
-const DashboardTeamsWorkspaceIdRouteImport = createFileRoute(
- '/dashboard/teams/$workspaceId',
-)()
+import { Route as DashboardWorkspaceWorkspaceIdProjectProjectIdTaskTaskIdRouteImport } from './routes/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_'
const DashboardRoute = DashboardRouteImport.update({
id: '/dashboard',
@@ -53,6 +49,11 @@ const DashboardSettingsRoute = DashboardSettingsRouteImport.update({
path: '/settings',
getParentRoute: () => DashboardRoute,
} as any)
+const DashboardSplatRoute = DashboardSplatRouteImport.update({
+ id: '/$',
+ path: '/$',
+ getParentRoute: () => DashboardRoute,
+} as any)
const AuthSignUpRoute = AuthSignUpRouteImport.update({
id: '/auth/sign-up',
path: '/auth/sign-up',
@@ -63,10 +64,10 @@ const AuthSignInRoute = AuthSignInRouteImport.update({
path: '/auth/sign-in',
getParentRoute: () => rootRouteImport,
} as any)
-const DashboardTeamsWorkspaceIdRoute =
- DashboardTeamsWorkspaceIdRouteImport.update({
- id: '/teams/$workspaceId',
- path: '/teams/$workspaceId',
+const DashboardWorkspaceCreateRoute =
+ DashboardWorkspaceCreateRouteImport.update({
+ id: '/workspace/create',
+ path: '/workspace/create',
getParentRoute: () => DashboardRoute,
} as any)
const DashboardWorkspaceWorkspaceIdRoute =
@@ -81,58 +82,59 @@ const DashboardSettingsAppearanceRoute =
path: '/appearance',
getParentRoute: () => DashboardSettingsRoute,
} as any)
-const DashboardWorkspaceSettingsWorkspaceIdIndexRoute =
- DashboardWorkspaceSettingsWorkspaceIdIndexRouteImport.update({
- id: '/workspace-settings/$workspaceId/',
- path: '/workspace-settings/$workspaceId/',
- getParentRoute: () => DashboardRoute,
- } as any)
-const DashboardTeamsWorkspaceIdLayoutRoute =
- DashboardTeamsWorkspaceIdLayoutRouteImport.update({
- id: '/_layout',
- getParentRoute: () => DashboardTeamsWorkspaceIdRoute,
+const DashboardWorkspaceWorkspaceIdIndexRoute =
+ DashboardWorkspaceWorkspaceIdIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => DashboardWorkspaceWorkspaceIdRoute,
} as any)
-const DashboardWorkspaceWorkspaceIdProjectProjectIdRoute =
- DashboardWorkspaceWorkspaceIdProjectProjectIdRouteImport.update({
- id: '/project/$projectId',
- path: '/project/$projectId',
+const DashboardWorkspaceWorkspaceIdSettingsRoute =
+ DashboardWorkspaceWorkspaceIdSettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
getParentRoute: () => DashboardWorkspaceWorkspaceIdRoute,
} as any)
-const DashboardTeamsWorkspaceIdLayoutRolesRoute =
- DashboardTeamsWorkspaceIdLayoutRolesRouteImport.update({
- id: '/roles',
- path: '/roles',
- getParentRoute: () => DashboardTeamsWorkspaceIdLayoutRoute,
+const DashboardWorkspaceWorkspaceIdSearchRoute =
+ DashboardWorkspaceWorkspaceIdSearchRouteImport.update({
+ id: '/search',
+ path: '/search',
+ getParentRoute: () => DashboardWorkspaceWorkspaceIdRoute,
} as any)
-const DashboardTeamsWorkspaceIdLayoutMembersRoute =
- DashboardTeamsWorkspaceIdLayoutMembersRouteImport.update({
+const DashboardWorkspaceWorkspaceIdMembersRoute =
+ DashboardWorkspaceWorkspaceIdMembersRouteImport.update({
id: '/members',
path: '/members',
- getParentRoute: () => DashboardTeamsWorkspaceIdLayoutRoute,
+ getParentRoute: () => DashboardWorkspaceWorkspaceIdRoute,
+ } as any)
+const DashboardWorkspaceWorkspaceIdProjectProjectIdIndexRoute =
+ DashboardWorkspaceWorkspaceIdProjectProjectIdIndexRouteImport.update({
+ id: '/project/$projectId/',
+ path: '/project/$projectId/',
+ getParentRoute: () => DashboardWorkspaceWorkspaceIdRoute,
} as any)
const DashboardWorkspaceWorkspaceIdProjectProjectIdSettingsRoute =
DashboardWorkspaceWorkspaceIdProjectProjectIdSettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => DashboardWorkspaceWorkspaceIdProjectProjectIdRoute,
+ id: '/project/$projectId/settings',
+ path: '/project/$projectId/settings',
+ getParentRoute: () => DashboardWorkspaceWorkspaceIdRoute,
} as any)
const DashboardWorkspaceWorkspaceIdProjectProjectIdBoardRoute =
DashboardWorkspaceWorkspaceIdProjectProjectIdBoardRouteImport.update({
- id: '/board',
- path: '/board',
- getParentRoute: () => DashboardWorkspaceWorkspaceIdProjectProjectIdRoute,
+ id: '/project/$projectId/board',
+ path: '/project/$projectId/board',
+ getParentRoute: () => DashboardWorkspaceWorkspaceIdRoute,
} as any)
const DashboardWorkspaceWorkspaceIdProjectProjectIdBacklogRoute =
DashboardWorkspaceWorkspaceIdProjectProjectIdBacklogRouteImport.update({
- id: '/backlog',
- path: '/backlog',
- getParentRoute: () => DashboardWorkspaceWorkspaceIdProjectProjectIdRoute,
+ id: '/project/$projectId/backlog',
+ path: '/project/$projectId/backlog',
+ getParentRoute: () => DashboardWorkspaceWorkspaceIdRoute,
} as any)
const DashboardWorkspaceWorkspaceIdProjectProjectIdTaskTaskIdRoute =
DashboardWorkspaceWorkspaceIdProjectProjectIdTaskTaskIdRouteImport.update({
- id: '/task/$taskId',
- path: '/task/$taskId',
- getParentRoute: () => DashboardWorkspaceWorkspaceIdProjectProjectIdRoute,
+ id: '/project/$projectId/task/$taskId_',
+ path: '/project/$projectId/task/$taskId',
+ getParentRoute: () => DashboardWorkspaceWorkspaceIdRoute,
} as any)
export interface FileRoutesByFullPath {
@@ -140,18 +142,20 @@ export interface FileRoutesByFullPath {
'/dashboard': typeof DashboardRouteWithChildren
'/auth/sign-in': typeof AuthSignInRoute
'/auth/sign-up': typeof AuthSignUpRoute
+ '/dashboard/$': typeof DashboardSplatRoute
'/dashboard/settings': typeof DashboardSettingsRouteWithChildren
'/public-project/$projectId': typeof PublicProjectProjectIdRoute
'/dashboard/settings/appearance': typeof DashboardSettingsAppearanceRoute
'/dashboard/workspace/$workspaceId': typeof DashboardWorkspaceWorkspaceIdRouteWithChildren
- '/dashboard/teams/$workspaceId': typeof DashboardTeamsWorkspaceIdLayoutRouteWithChildren
- '/dashboard/workspace-settings/$workspaceId': typeof DashboardWorkspaceSettingsWorkspaceIdIndexRoute
- '/dashboard/teams/$workspaceId/members': typeof DashboardTeamsWorkspaceIdLayoutMembersRoute
- '/dashboard/teams/$workspaceId/roles': typeof DashboardTeamsWorkspaceIdLayoutRolesRoute
- '/dashboard/workspace/$workspaceId/project/$projectId': typeof DashboardWorkspaceWorkspaceIdProjectProjectIdRouteWithChildren
+ '/dashboard/workspace/create': typeof DashboardWorkspaceCreateRoute
+ '/dashboard/workspace/$workspaceId/members': typeof DashboardWorkspaceWorkspaceIdMembersRoute
+ '/dashboard/workspace/$workspaceId/search': typeof DashboardWorkspaceWorkspaceIdSearchRoute
+ '/dashboard/workspace/$workspaceId/settings': typeof DashboardWorkspaceWorkspaceIdSettingsRoute
+ '/dashboard/workspace/$workspaceId/': typeof DashboardWorkspaceWorkspaceIdIndexRoute
'/dashboard/workspace/$workspaceId/project/$projectId/backlog': typeof DashboardWorkspaceWorkspaceIdProjectProjectIdBacklogRoute
'/dashboard/workspace/$workspaceId/project/$projectId/board': typeof DashboardWorkspaceWorkspaceIdProjectProjectIdBoardRoute
'/dashboard/workspace/$workspaceId/project/$projectId/settings': typeof DashboardWorkspaceWorkspaceIdProjectProjectIdSettingsRoute
+ '/dashboard/workspace/$workspaceId/project/$projectId': typeof DashboardWorkspaceWorkspaceIdProjectProjectIdIndexRoute
'/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId': typeof DashboardWorkspaceWorkspaceIdProjectProjectIdTaskTaskIdRoute
}
export interface FileRoutesByTo {
@@ -159,18 +163,19 @@ export interface FileRoutesByTo {
'/dashboard': typeof DashboardRouteWithChildren
'/auth/sign-in': typeof AuthSignInRoute
'/auth/sign-up': typeof AuthSignUpRoute
+ '/dashboard/$': typeof DashboardSplatRoute
'/dashboard/settings': typeof DashboardSettingsRouteWithChildren
'/public-project/$projectId': typeof PublicProjectProjectIdRoute
'/dashboard/settings/appearance': typeof DashboardSettingsAppearanceRoute
- '/dashboard/workspace/$workspaceId': typeof DashboardWorkspaceWorkspaceIdRouteWithChildren
- '/dashboard/teams/$workspaceId': typeof DashboardTeamsWorkspaceIdLayoutRouteWithChildren
- '/dashboard/workspace-settings/$workspaceId': typeof DashboardWorkspaceSettingsWorkspaceIdIndexRoute
- '/dashboard/teams/$workspaceId/members': typeof DashboardTeamsWorkspaceIdLayoutMembersRoute
- '/dashboard/teams/$workspaceId/roles': typeof DashboardTeamsWorkspaceIdLayoutRolesRoute
- '/dashboard/workspace/$workspaceId/project/$projectId': typeof DashboardWorkspaceWorkspaceIdProjectProjectIdRouteWithChildren
+ '/dashboard/workspace/create': typeof DashboardWorkspaceCreateRoute
+ '/dashboard/workspace/$workspaceId/members': typeof DashboardWorkspaceWorkspaceIdMembersRoute
+ '/dashboard/workspace/$workspaceId/search': typeof DashboardWorkspaceWorkspaceIdSearchRoute
+ '/dashboard/workspace/$workspaceId/settings': typeof DashboardWorkspaceWorkspaceIdSettingsRoute
+ '/dashboard/workspace/$workspaceId': typeof DashboardWorkspaceWorkspaceIdIndexRoute
'/dashboard/workspace/$workspaceId/project/$projectId/backlog': typeof DashboardWorkspaceWorkspaceIdProjectProjectIdBacklogRoute
'/dashboard/workspace/$workspaceId/project/$projectId/board': typeof DashboardWorkspaceWorkspaceIdProjectProjectIdBoardRoute
'/dashboard/workspace/$workspaceId/project/$projectId/settings': typeof DashboardWorkspaceWorkspaceIdProjectProjectIdSettingsRoute
+ '/dashboard/workspace/$workspaceId/project/$projectId': typeof DashboardWorkspaceWorkspaceIdProjectProjectIdIndexRoute
'/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId': typeof DashboardWorkspaceWorkspaceIdProjectProjectIdTaskTaskIdRoute
}
export interface FileRoutesById {
@@ -179,20 +184,21 @@ export interface FileRoutesById {
'/dashboard': typeof DashboardRouteWithChildren
'/auth/sign-in': typeof AuthSignInRoute
'/auth/sign-up': typeof AuthSignUpRoute
+ '/dashboard/$': typeof DashboardSplatRoute
'/dashboard/settings': typeof DashboardSettingsRouteWithChildren
'/public-project/$projectId': typeof PublicProjectProjectIdRoute
'/dashboard/settings/appearance': typeof DashboardSettingsAppearanceRoute
'/dashboard/workspace/$workspaceId': typeof DashboardWorkspaceWorkspaceIdRouteWithChildren
- '/dashboard/teams/$workspaceId': typeof DashboardTeamsWorkspaceIdRouteWithChildren
- '/dashboard/teams/$workspaceId/_layout': typeof DashboardTeamsWorkspaceIdLayoutRouteWithChildren
- '/dashboard/workspace-settings/$workspaceId/': typeof DashboardWorkspaceSettingsWorkspaceIdIndexRoute
- '/dashboard/teams/$workspaceId/_layout/members': typeof DashboardTeamsWorkspaceIdLayoutMembersRoute
- '/dashboard/teams/$workspaceId/_layout/roles': typeof DashboardTeamsWorkspaceIdLayoutRolesRoute
- '/dashboard/workspace/$workspaceId/project/$projectId': typeof DashboardWorkspaceWorkspaceIdProjectProjectIdRouteWithChildren
+ '/dashboard/workspace/create': typeof DashboardWorkspaceCreateRoute
+ '/dashboard/workspace/$workspaceId/members': typeof DashboardWorkspaceWorkspaceIdMembersRoute
+ '/dashboard/workspace/$workspaceId/search': typeof DashboardWorkspaceWorkspaceIdSearchRoute
+ '/dashboard/workspace/$workspaceId/settings': typeof DashboardWorkspaceWorkspaceIdSettingsRoute
+ '/dashboard/workspace/$workspaceId/': typeof DashboardWorkspaceWorkspaceIdIndexRoute
'/dashboard/workspace/$workspaceId/project/$projectId/backlog': typeof DashboardWorkspaceWorkspaceIdProjectProjectIdBacklogRoute
'/dashboard/workspace/$workspaceId/project/$projectId/board': typeof DashboardWorkspaceWorkspaceIdProjectProjectIdBoardRoute
'/dashboard/workspace/$workspaceId/project/$projectId/settings': typeof DashboardWorkspaceWorkspaceIdProjectProjectIdSettingsRoute
- '/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId': typeof DashboardWorkspaceWorkspaceIdProjectProjectIdTaskTaskIdRoute
+ '/dashboard/workspace/$workspaceId/project/$projectId/': typeof DashboardWorkspaceWorkspaceIdProjectProjectIdIndexRoute
+ '/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_': typeof DashboardWorkspaceWorkspaceIdProjectProjectIdTaskTaskIdRoute
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
@@ -201,18 +207,20 @@ export interface FileRouteTypes {
| '/dashboard'
| '/auth/sign-in'
| '/auth/sign-up'
+ | '/dashboard/$'
| '/dashboard/settings'
| '/public-project/$projectId'
| '/dashboard/settings/appearance'
| '/dashboard/workspace/$workspaceId'
- | '/dashboard/teams/$workspaceId'
- | '/dashboard/workspace-settings/$workspaceId'
- | '/dashboard/teams/$workspaceId/members'
- | '/dashboard/teams/$workspaceId/roles'
- | '/dashboard/workspace/$workspaceId/project/$projectId'
+ | '/dashboard/workspace/create'
+ | '/dashboard/workspace/$workspaceId/members'
+ | '/dashboard/workspace/$workspaceId/search'
+ | '/dashboard/workspace/$workspaceId/settings'
+ | '/dashboard/workspace/$workspaceId/'
| '/dashboard/workspace/$workspaceId/project/$projectId/backlog'
| '/dashboard/workspace/$workspaceId/project/$projectId/board'
| '/dashboard/workspace/$workspaceId/project/$projectId/settings'
+ | '/dashboard/workspace/$workspaceId/project/$projectId'
| '/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId'
fileRoutesByTo: FileRoutesByTo
to:
@@ -220,18 +228,19 @@ export interface FileRouteTypes {
| '/dashboard'
| '/auth/sign-in'
| '/auth/sign-up'
+ | '/dashboard/$'
| '/dashboard/settings'
| '/public-project/$projectId'
| '/dashboard/settings/appearance'
+ | '/dashboard/workspace/create'
+ | '/dashboard/workspace/$workspaceId/members'
+ | '/dashboard/workspace/$workspaceId/search'
+ | '/dashboard/workspace/$workspaceId/settings'
| '/dashboard/workspace/$workspaceId'
- | '/dashboard/teams/$workspaceId'
- | '/dashboard/workspace-settings/$workspaceId'
- | '/dashboard/teams/$workspaceId/members'
- | '/dashboard/teams/$workspaceId/roles'
- | '/dashboard/workspace/$workspaceId/project/$projectId'
| '/dashboard/workspace/$workspaceId/project/$projectId/backlog'
| '/dashboard/workspace/$workspaceId/project/$projectId/board'
| '/dashboard/workspace/$workspaceId/project/$projectId/settings'
+ | '/dashboard/workspace/$workspaceId/project/$projectId'
| '/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId'
id:
| '__root__'
@@ -239,20 +248,21 @@ export interface FileRouteTypes {
| '/dashboard'
| '/auth/sign-in'
| '/auth/sign-up'
+ | '/dashboard/$'
| '/dashboard/settings'
| '/public-project/$projectId'
| '/dashboard/settings/appearance'
| '/dashboard/workspace/$workspaceId'
- | '/dashboard/teams/$workspaceId'
- | '/dashboard/teams/$workspaceId/_layout'
- | '/dashboard/workspace-settings/$workspaceId/'
- | '/dashboard/teams/$workspaceId/_layout/members'
- | '/dashboard/teams/$workspaceId/_layout/roles'
- | '/dashboard/workspace/$workspaceId/project/$projectId'
+ | '/dashboard/workspace/create'
+ | '/dashboard/workspace/$workspaceId/members'
+ | '/dashboard/workspace/$workspaceId/search'
+ | '/dashboard/workspace/$workspaceId/settings'
+ | '/dashboard/workspace/$workspaceId/'
| '/dashboard/workspace/$workspaceId/project/$projectId/backlog'
| '/dashboard/workspace/$workspaceId/project/$projectId/board'
| '/dashboard/workspace/$workspaceId/project/$projectId/settings'
- | '/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId'
+ | '/dashboard/workspace/$workspaceId/project/$projectId/'
+ | '/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -293,6 +303,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof DashboardSettingsRouteImport
parentRoute: typeof DashboardRoute
}
+ '/dashboard/$': {
+ id: '/dashboard/$'
+ path: '/$'
+ fullPath: '/dashboard/$'
+ preLoaderRoute: typeof DashboardSplatRouteImport
+ parentRoute: typeof DashboardRoute
+ }
'/auth/sign-up': {
id: '/auth/sign-up'
path: '/auth/sign-up'
@@ -307,11 +324,11 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AuthSignInRouteImport
parentRoute: typeof rootRouteImport
}
- '/dashboard/teams/$workspaceId': {
- id: '/dashboard/teams/$workspaceId'
- path: '/teams/$workspaceId'
- fullPath: '/dashboard/teams/$workspaceId'
- preLoaderRoute: typeof DashboardTeamsWorkspaceIdRouteImport
+ '/dashboard/workspace/create': {
+ id: '/dashboard/workspace/create'
+ path: '/workspace/create'
+ fullPath: '/dashboard/workspace/create'
+ preLoaderRoute: typeof DashboardWorkspaceCreateRouteImport
parentRoute: typeof DashboardRoute
}
'/dashboard/workspace/$workspaceId': {
@@ -328,68 +345,68 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof DashboardSettingsAppearanceRouteImport
parentRoute: typeof DashboardSettingsRoute
}
- '/dashboard/workspace-settings/$workspaceId/': {
- id: '/dashboard/workspace-settings/$workspaceId/'
- path: '/workspace-settings/$workspaceId'
- fullPath: '/dashboard/workspace-settings/$workspaceId'
- preLoaderRoute: typeof DashboardWorkspaceSettingsWorkspaceIdIndexRouteImport
- parentRoute: typeof DashboardRoute
- }
- '/dashboard/teams/$workspaceId/_layout': {
- id: '/dashboard/teams/$workspaceId/_layout'
- path: '/teams/$workspaceId'
- fullPath: '/dashboard/teams/$workspaceId'
- preLoaderRoute: typeof DashboardTeamsWorkspaceIdLayoutRouteImport
- parentRoute: typeof DashboardTeamsWorkspaceIdRoute
+ '/dashboard/workspace/$workspaceId/': {
+ id: '/dashboard/workspace/$workspaceId/'
+ path: '/'
+ fullPath: '/dashboard/workspace/$workspaceId/'
+ preLoaderRoute: typeof DashboardWorkspaceWorkspaceIdIndexRouteImport
+ parentRoute: typeof DashboardWorkspaceWorkspaceIdRoute
}
- '/dashboard/workspace/$workspaceId/project/$projectId': {
- id: '/dashboard/workspace/$workspaceId/project/$projectId'
- path: '/project/$projectId'
- fullPath: '/dashboard/workspace/$workspaceId/project/$projectId'
- preLoaderRoute: typeof DashboardWorkspaceWorkspaceIdProjectProjectIdRouteImport
+ '/dashboard/workspace/$workspaceId/settings': {
+ id: '/dashboard/workspace/$workspaceId/settings'
+ path: '/settings'
+ fullPath: '/dashboard/workspace/$workspaceId/settings'
+ preLoaderRoute: typeof DashboardWorkspaceWorkspaceIdSettingsRouteImport
parentRoute: typeof DashboardWorkspaceWorkspaceIdRoute
}
- '/dashboard/teams/$workspaceId/_layout/roles': {
- id: '/dashboard/teams/$workspaceId/_layout/roles'
- path: '/roles'
- fullPath: '/dashboard/teams/$workspaceId/roles'
- preLoaderRoute: typeof DashboardTeamsWorkspaceIdLayoutRolesRouteImport
- parentRoute: typeof DashboardTeamsWorkspaceIdLayoutRoute
+ '/dashboard/workspace/$workspaceId/search': {
+ id: '/dashboard/workspace/$workspaceId/search'
+ path: '/search'
+ fullPath: '/dashboard/workspace/$workspaceId/search'
+ preLoaderRoute: typeof DashboardWorkspaceWorkspaceIdSearchRouteImport
+ parentRoute: typeof DashboardWorkspaceWorkspaceIdRoute
}
- '/dashboard/teams/$workspaceId/_layout/members': {
- id: '/dashboard/teams/$workspaceId/_layout/members'
+ '/dashboard/workspace/$workspaceId/members': {
+ id: '/dashboard/workspace/$workspaceId/members'
path: '/members'
- fullPath: '/dashboard/teams/$workspaceId/members'
- preLoaderRoute: typeof DashboardTeamsWorkspaceIdLayoutMembersRouteImport
- parentRoute: typeof DashboardTeamsWorkspaceIdLayoutRoute
+ fullPath: '/dashboard/workspace/$workspaceId/members'
+ preLoaderRoute: typeof DashboardWorkspaceWorkspaceIdMembersRouteImport
+ parentRoute: typeof DashboardWorkspaceWorkspaceIdRoute
+ }
+ '/dashboard/workspace/$workspaceId/project/$projectId/': {
+ id: '/dashboard/workspace/$workspaceId/project/$projectId/'
+ path: '/project/$projectId'
+ fullPath: '/dashboard/workspace/$workspaceId/project/$projectId'
+ preLoaderRoute: typeof DashboardWorkspaceWorkspaceIdProjectProjectIdIndexRouteImport
+ parentRoute: typeof DashboardWorkspaceWorkspaceIdRoute
}
'/dashboard/workspace/$workspaceId/project/$projectId/settings': {
id: '/dashboard/workspace/$workspaceId/project/$projectId/settings'
- path: '/settings'
+ path: '/project/$projectId/settings'
fullPath: '/dashboard/workspace/$workspaceId/project/$projectId/settings'
preLoaderRoute: typeof DashboardWorkspaceWorkspaceIdProjectProjectIdSettingsRouteImport
- parentRoute: typeof DashboardWorkspaceWorkspaceIdProjectProjectIdRoute
+ parentRoute: typeof DashboardWorkspaceWorkspaceIdRoute
}
'/dashboard/workspace/$workspaceId/project/$projectId/board': {
id: '/dashboard/workspace/$workspaceId/project/$projectId/board'
- path: '/board'
+ path: '/project/$projectId/board'
fullPath: '/dashboard/workspace/$workspaceId/project/$projectId/board'
preLoaderRoute: typeof DashboardWorkspaceWorkspaceIdProjectProjectIdBoardRouteImport
- parentRoute: typeof DashboardWorkspaceWorkspaceIdProjectProjectIdRoute
+ parentRoute: typeof DashboardWorkspaceWorkspaceIdRoute
}
'/dashboard/workspace/$workspaceId/project/$projectId/backlog': {
id: '/dashboard/workspace/$workspaceId/project/$projectId/backlog'
- path: '/backlog'
+ path: '/project/$projectId/backlog'
fullPath: '/dashboard/workspace/$workspaceId/project/$projectId/backlog'
preLoaderRoute: typeof DashboardWorkspaceWorkspaceIdProjectProjectIdBacklogRouteImport
- parentRoute: typeof DashboardWorkspaceWorkspaceIdProjectProjectIdRoute
+ parentRoute: typeof DashboardWorkspaceWorkspaceIdRoute
}
- '/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId': {
- id: '/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId'
- path: '/task/$taskId'
+ '/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_': {
+ id: '/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_'
+ path: '/project/$projectId/task/$taskId'
fullPath: '/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId'
preLoaderRoute: typeof DashboardWorkspaceWorkspaceIdProjectProjectIdTaskTaskIdRouteImport
- parentRoute: typeof DashboardWorkspaceWorkspaceIdProjectProjectIdRoute
+ parentRoute: typeof DashboardWorkspaceWorkspaceIdRoute
}
}
}
@@ -405,92 +422,58 @@ const DashboardSettingsRouteChildren: DashboardSettingsRouteChildren = {
const DashboardSettingsRouteWithChildren =
DashboardSettingsRoute._addFileChildren(DashboardSettingsRouteChildren)
-interface DashboardWorkspaceWorkspaceIdProjectProjectIdRouteChildren {
+interface DashboardWorkspaceWorkspaceIdRouteChildren {
+ DashboardWorkspaceWorkspaceIdMembersRoute: typeof DashboardWorkspaceWorkspaceIdMembersRoute
+ DashboardWorkspaceWorkspaceIdSearchRoute: typeof DashboardWorkspaceWorkspaceIdSearchRoute
+ DashboardWorkspaceWorkspaceIdSettingsRoute: typeof DashboardWorkspaceWorkspaceIdSettingsRoute
+ DashboardWorkspaceWorkspaceIdIndexRoute: typeof DashboardWorkspaceWorkspaceIdIndexRoute
DashboardWorkspaceWorkspaceIdProjectProjectIdBacklogRoute: typeof DashboardWorkspaceWorkspaceIdProjectProjectIdBacklogRoute
DashboardWorkspaceWorkspaceIdProjectProjectIdBoardRoute: typeof DashboardWorkspaceWorkspaceIdProjectProjectIdBoardRoute
DashboardWorkspaceWorkspaceIdProjectProjectIdSettingsRoute: typeof DashboardWorkspaceWorkspaceIdProjectProjectIdSettingsRoute
+ DashboardWorkspaceWorkspaceIdProjectProjectIdIndexRoute: typeof DashboardWorkspaceWorkspaceIdProjectProjectIdIndexRoute
DashboardWorkspaceWorkspaceIdProjectProjectIdTaskTaskIdRoute: typeof DashboardWorkspaceWorkspaceIdProjectProjectIdTaskTaskIdRoute
}
-const DashboardWorkspaceWorkspaceIdProjectProjectIdRouteChildren: DashboardWorkspaceWorkspaceIdProjectProjectIdRouteChildren =
+const DashboardWorkspaceWorkspaceIdRouteChildren: DashboardWorkspaceWorkspaceIdRouteChildren =
{
+ DashboardWorkspaceWorkspaceIdMembersRoute:
+ DashboardWorkspaceWorkspaceIdMembersRoute,
+ DashboardWorkspaceWorkspaceIdSearchRoute:
+ DashboardWorkspaceWorkspaceIdSearchRoute,
+ DashboardWorkspaceWorkspaceIdSettingsRoute:
+ DashboardWorkspaceWorkspaceIdSettingsRoute,
+ DashboardWorkspaceWorkspaceIdIndexRoute:
+ DashboardWorkspaceWorkspaceIdIndexRoute,
DashboardWorkspaceWorkspaceIdProjectProjectIdBacklogRoute:
DashboardWorkspaceWorkspaceIdProjectProjectIdBacklogRoute,
DashboardWorkspaceWorkspaceIdProjectProjectIdBoardRoute:
DashboardWorkspaceWorkspaceIdProjectProjectIdBoardRoute,
DashboardWorkspaceWorkspaceIdProjectProjectIdSettingsRoute:
DashboardWorkspaceWorkspaceIdProjectProjectIdSettingsRoute,
+ DashboardWorkspaceWorkspaceIdProjectProjectIdIndexRoute:
+ DashboardWorkspaceWorkspaceIdProjectProjectIdIndexRoute,
DashboardWorkspaceWorkspaceIdProjectProjectIdTaskTaskIdRoute:
DashboardWorkspaceWorkspaceIdProjectProjectIdTaskTaskIdRoute,
}
-const DashboardWorkspaceWorkspaceIdProjectProjectIdRouteWithChildren =
- DashboardWorkspaceWorkspaceIdProjectProjectIdRoute._addFileChildren(
- DashboardWorkspaceWorkspaceIdProjectProjectIdRouteChildren,
- )
-
-interface DashboardWorkspaceWorkspaceIdRouteChildren {
- DashboardWorkspaceWorkspaceIdProjectProjectIdRoute: typeof DashboardWorkspaceWorkspaceIdProjectProjectIdRouteWithChildren
-}
-
-const DashboardWorkspaceWorkspaceIdRouteChildren: DashboardWorkspaceWorkspaceIdRouteChildren =
- {
- DashboardWorkspaceWorkspaceIdProjectProjectIdRoute:
- DashboardWorkspaceWorkspaceIdProjectProjectIdRouteWithChildren,
- }
-
const DashboardWorkspaceWorkspaceIdRouteWithChildren =
DashboardWorkspaceWorkspaceIdRoute._addFileChildren(
DashboardWorkspaceWorkspaceIdRouteChildren,
)
-interface DashboardTeamsWorkspaceIdLayoutRouteChildren {
- DashboardTeamsWorkspaceIdLayoutMembersRoute: typeof DashboardTeamsWorkspaceIdLayoutMembersRoute
- DashboardTeamsWorkspaceIdLayoutRolesRoute: typeof DashboardTeamsWorkspaceIdLayoutRolesRoute
-}
-
-const DashboardTeamsWorkspaceIdLayoutRouteChildren: DashboardTeamsWorkspaceIdLayoutRouteChildren =
- {
- DashboardTeamsWorkspaceIdLayoutMembersRoute:
- DashboardTeamsWorkspaceIdLayoutMembersRoute,
- DashboardTeamsWorkspaceIdLayoutRolesRoute:
- DashboardTeamsWorkspaceIdLayoutRolesRoute,
- }
-
-const DashboardTeamsWorkspaceIdLayoutRouteWithChildren =
- DashboardTeamsWorkspaceIdLayoutRoute._addFileChildren(
- DashboardTeamsWorkspaceIdLayoutRouteChildren,
- )
-
-interface DashboardTeamsWorkspaceIdRouteChildren {
- DashboardTeamsWorkspaceIdLayoutRoute: typeof DashboardTeamsWorkspaceIdLayoutRouteWithChildren
-}
-
-const DashboardTeamsWorkspaceIdRouteChildren: DashboardTeamsWorkspaceIdRouteChildren =
- {
- DashboardTeamsWorkspaceIdLayoutRoute:
- DashboardTeamsWorkspaceIdLayoutRouteWithChildren,
- }
-
-const DashboardTeamsWorkspaceIdRouteWithChildren =
- DashboardTeamsWorkspaceIdRoute._addFileChildren(
- DashboardTeamsWorkspaceIdRouteChildren,
- )
-
interface DashboardRouteChildren {
+ DashboardSplatRoute: typeof DashboardSplatRoute
DashboardSettingsRoute: typeof DashboardSettingsRouteWithChildren
DashboardWorkspaceWorkspaceIdRoute: typeof DashboardWorkspaceWorkspaceIdRouteWithChildren
- DashboardTeamsWorkspaceIdRoute: typeof DashboardTeamsWorkspaceIdRouteWithChildren
- DashboardWorkspaceSettingsWorkspaceIdIndexRoute: typeof DashboardWorkspaceSettingsWorkspaceIdIndexRoute
+ DashboardWorkspaceCreateRoute: typeof DashboardWorkspaceCreateRoute
}
const DashboardRouteChildren: DashboardRouteChildren = {
+ DashboardSplatRoute: DashboardSplatRoute,
DashboardSettingsRoute: DashboardSettingsRouteWithChildren,
DashboardWorkspaceWorkspaceIdRoute:
DashboardWorkspaceWorkspaceIdRouteWithChildren,
- DashboardTeamsWorkspaceIdRoute: DashboardTeamsWorkspaceIdRouteWithChildren,
- DashboardWorkspaceSettingsWorkspaceIdIndexRoute:
- DashboardWorkspaceSettingsWorkspaceIdIndexRoute,
+ DashboardWorkspaceCreateRoute: DashboardWorkspaceCreateRoute,
}
const DashboardRouteWithChildren = DashboardRoute._addFileChildren(
diff --git a/apps/web/src/routes/__root.tsx b/apps/web/src/routes/__root.tsx
index 1b5440783..3c83270fb 100644
--- a/apps/web/src/routes/__root.tsx
+++ b/apps/web/src/routes/__root.tsx
@@ -1,5 +1,6 @@
-import { CommandPalette } from "@/components/command-palette";
-import useTheme from "@/components/providers/theme-provider/hooks/use-theme";
+import CommandPalette from "@/components/command-palette";
+import SearchCommandMenu from "@/components/search-command-menu";
+import { useUserPreferencesStore } from "@/store/user-preferences";
import type { LoggedInUser } from "@/types/user";
import type { QueryClient } from "@tanstack/react-query";
import {
@@ -8,6 +9,7 @@ import {
redirect,
useLocation,
} from "@tanstack/react-router";
+import { useState } from "react";
import { Toaster } from "sonner";
export const Route = createRootRouteWithContext<{
@@ -40,15 +42,21 @@ export const Route = createRootRouteWithContext<{
});
function RootComponent() {
- const { theme } = useTheme();
+ const { theme } = useUserPreferencesStore();
const location = useLocation();
const isPublicProject = location.pathname.includes("public-project");
+ const [searchOpen, setSearchOpen] = useState(false);
return (
<>
- <div className="flex w-full h-svh overflow-x-hidden overflow-y-hidden flex-row bg-zinc-50 dark:bg-zinc-950 scrollbar-thin scrollbar-thumb-zinc-700 scrollbar-track-zinc-900">
+ <div className="flex w-full h-svh overflow-x-hidden overflow-y-hidden flex-row scrollbar-thin scrollbar-thumb-zinc-700 scrollbar-track-zinc-900 bg-sidebar">
<Outlet />
- {!isPublicProject && <CommandPalette />}
+ {!isPublicProject && (
+ <>
+ <CommandPalette />
+ <SearchCommandMenu open={searchOpen} setOpen={setSearchOpen} />
+ </>
+ )}
</div>
<Toaster
position="bottom-right"
diff --git a/apps/web/src/routes/dashboard.tsx b/apps/web/src/routes/dashboard.tsx
index a12923eff..d261e01ad 100644
--- a/apps/web/src/routes/dashboard.tsx
+++ b/apps/web/src/routes/dashboard.tsx
@@ -1,17 +1,13 @@
-import { Sidebar } from "@/components/common/sidebar";
import { DemoAlert } from "@/components/demo-alert";
import PageTitle from "@/components/page-title";
-import EmptyWorkspaceState from "@/components/workspace/empty-state";
-import SelectWorkspaceState from "@/components/workspace/select-workspace-state";
+import { SidebarProvider } from "@/components/ui/sidebar";
import { isDemoMode } from "@/constants/urls";
+import getWorkspaces from "@/fetchers/workspace/get-workspaces";
import useGetWorkspaces from "@/hooks/queries/workspace/use-get-workspaces";
+import { useUserPreferencesStore } from "@/store/user-preferences";
import useWorkspaceStore from "@/store/workspace";
-import {
- Outlet,
- createFileRoute,
- redirect,
- useRouterState,
-} from "@tanstack/react-router";
+import { Outlet, createFileRoute, redirect } from "@tanstack/react-router";
+import { useEffect } from "react";
export const Route = createFileRoute("/dashboard")({
component: DashboardIndexRouteComponent,
@@ -21,35 +17,55 @@ export const Route = createFileRoute("/dashboard")({
to: "/auth/sign-in",
});
}
+
+ const workspaces = await getWorkspaces();
+
+ if (workspaces.length === 0) {
+ throw redirect({
+ to: "/dashboard/workspace/create",
+ });
+ }
},
});
function DashboardIndexRouteComponent() {
- const { workspace } = useWorkspaceStore();
+ const { workspace, setWorkspace } = useWorkspaceStore();
const { data: workspaces } = useGetWorkspaces();
- const location = useRouterState({ select: (s) => s.location.pathname });
-
- const hasNoWorkspacesAndNoSelectedWorkspace =
- workspaces?.length === 0 && !workspace;
+ const { activeWorkspaceId, setActiveWorkspaceId } = useUserPreferencesStore();
- const isOnWorkspaceRoute = location === "/dashboard";
+ useEffect(() => {
+ if (workspaces && workspaces.length > 0 && !workspace) {
+ if (
+ activeWorkspaceId &&
+ workspaces.some((ws) => ws.id === activeWorkspaceId)
+ ) {
+ const activeWorkspace = workspaces.find(
+ (ws) => ws.id === activeWorkspaceId,
+ );
+ if (activeWorkspace) {
+ setWorkspace(activeWorkspace);
+ }
+ } else {
+ const firstWorkspace = workspaces[0];
+ setActiveWorkspaceId(firstWorkspace.id);
+ setWorkspace(firstWorkspace);
+ }
+ }
+ }, [
+ workspaces,
+ workspace,
+ activeWorkspaceId,
+ setActiveWorkspaceId,
+ setWorkspace,
+ ]);
return (
<>
- <PageTitle title="Dashboard" hideAppName={!workspace?.name} />
- <Sidebar />
- <main className="w-full overflow-auto scroll-smooth flex flex-col">
+ <SidebarProvider>
+ <PageTitle title="Dashboard" hideAppName={!workspace?.name} />
{isDemoMode && <DemoAlert />}
- {isOnWorkspaceRoute && (
- <>
- {hasNoWorkspacesAndNoSelectedWorkspace && <EmptyWorkspaceState />}
- {!workspace && workspaces && workspaces.length > 0 && (
- <SelectWorkspaceState />
- )}
- </>
- )}
<Outlet />
- </main>
+ </SidebarProvider>
</>
);
}
diff --git a/apps/web/src/routes/dashboard/$.tsx b/apps/web/src/routes/dashboard/$.tsx
new file mode 100644
index 000000000..6390ea2dc
--- /dev/null
+++ b/apps/web/src/routes/dashboard/$.tsx
@@ -0,0 +1,41 @@
+import useGetWorkspaces from "@/hooks/queries/workspace/use-get-workspaces";
+import { useUserPreferencesStore } from "@/store/user-preferences";
+import { createFileRoute, useNavigate } from "@tanstack/react-router";
+import { useEffect } from "react";
+
+export const Route = createFileRoute("/dashboard/$")({
+ component: CatchAllComponent,
+});
+
+function CatchAllComponent() {
+ const { data: workspaces } = useGetWorkspaces();
+ const { activeWorkspaceId, setActiveWorkspaceId } = useUserPreferencesStore();
+ const navigate = useNavigate();
+
+ useEffect(() => {
+ if (workspaces && workspaces.length > 0) {
+ if (
+ activeWorkspaceId &&
+ workspaces.some((ws) => ws.id === activeWorkspaceId)
+ ) {
+ navigate({
+ to: "/dashboard/workspace/$workspaceId",
+ params: {
+ workspaceId: activeWorkspaceId,
+ },
+ });
+ } else {
+ const firstWorkspace = workspaces[0];
+ setActiveWorkspaceId(firstWorkspace.id);
+ navigate({
+ to: "/dashboard/workspace/$workspaceId",
+ params: {
+ workspaceId: firstWorkspace.id,
+ },
+ });
+ }
+ }
+ }, [workspaces, activeWorkspaceId, setActiveWorkspaceId, navigate]);
+
+ return null;
+}
diff --git a/apps/web/src/routes/dashboard/settings.tsx b/apps/web/src/routes/dashboard/settings.tsx
index fce280464..68200012d 100644
--- a/apps/web/src/routes/dashboard/settings.tsx
+++ b/apps/web/src/routes/dashboard/settings.tsx
@@ -1,111 +1,9 @@
-import { Button } from "@/components/ui/button";
-import { cn } from "@/lib/cn";
-import {
- Link,
- Outlet,
- createFileRoute,
- useRouterState,
-} from "@tanstack/react-router";
-import { AnimatePresence, motion } from "framer-motion";
-import { Menu, Palette } from "lucide-react";
-import { useState } from "react";
+import { Outlet, createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/dashboard/settings")({
component: SettingsLayout,
});
function SettingsLayout() {
- const [isMobileNavOpen, setIsMobileNavOpen] = useState(false);
- const pathname = useRouterState({ select: (s) => s.location.pathname });
-
- return (
- <div className="flex-1 flex flex-col md:flex-row h-screen">
- <motion.div
- className="md:hidden border-b border-zinc-200 dark:border-zinc-800 p-4"
- initial={{ opacity: 0, y: -10 }}
- animate={{ opacity: 1, y: 0 }}
- transition={{ duration: 0.2 }}
- >
- <Button
- variant="outline"
- size="sm"
- onClick={() => setIsMobileNavOpen(!isMobileNavOpen)}
- className="flex items-center gap-2 group"
- >
- <Menu className="w-4 h-4 transition-transform duration-200 ease-in-out group-hover:rotate-90" />
- <span>{isMobileNavOpen ? "Close Menu" : "Menu"}</span>
- </Button>
- </motion.div>
-
- <AnimatePresence mode="wait">
- {(isMobileNavOpen || window.innerWidth >= 768) && (
- <motion.aside
- initial={{
- x: -50,
- opacity: 0,
- }}
- animate={{
- x: 0,
- opacity: 1,
- }}
- exit={{
- x: -50,
- opacity: 0,
- }}
- transition={{
- duration: 0.2,
- ease: "easeOut",
- }}
- className={cn(
- "border-b md:border-b-0 md:border-r border-zinc-200 dark:border-zinc-800",
- "md:w-64 bg-white dark:bg-zinc-950",
- "md:block",
- isMobileNavOpen ? "block" : "hidden",
- )}
- >
- <div className="p-4 md:p-6">
- <motion.h2
- initial={{ opacity: 0 }}
- animate={{ opacity: 1 }}
- transition={{ delay: 0.1 }}
- className="text-lg font-semibold text-zinc-900 dark:text-zinc-100 mb-4"
- >
- Settings
- </motion.h2>
- <nav className="space-y-1">
- <motion.div
- initial={{ opacity: 0, y: 10 }}
- animate={{ opacity: 1, y: 0 }}
- transition={{ delay: 0.2 }}
- >
- <Link
- to="/dashboard/settings/appearance"
- onClick={() => setIsMobileNavOpen(false)}
- className={cn(
- "flex items-center px-3 py-2 rounded-lg text-sm transition-colors",
- pathname.includes("/appearance")
- ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
- : "text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800",
- )}
- >
- <Palette className="w-4 h-4 mr-3" />
- Appearance
- </Link>
- </motion.div>
- </nav>
- </div>
- </motion.aside>
- )}
- </AnimatePresence>
-
- <motion.div
- className="flex-1 overflow-auto"
- initial={{ opacity: 0 }}
- animate={{ opacity: 1 }}
- transition={{ duration: 0.3 }}
- >
- <Outlet />
- </motion.div>
- </div>
- );
+ return <Outlet />;
}
diff --git a/apps/web/src/routes/dashboard/settings/appearance.tsx b/apps/web/src/routes/dashboard/settings/appearance.tsx
index 45ee1d957..f208e27b1 100644
--- a/apps/web/src/routes/dashboard/settings/appearance.tsx
+++ b/apps/web/src/routes/dashboard/settings/appearance.tsx
@@ -1,148 +1,226 @@
-import PageTitle from "@/components/page-title";
-import useTheme from "@/components/providers/theme-provider/hooks/use-theme";
+import { SettingsLayout, SettingsSection } from "@/components/settings-layout";
+import { Label } from "@/components/ui/label";
import { Switch } from "@/components/ui/switch";
import { cn } from "@/lib/cn";
import { useUserPreferencesStore } from "@/store/user-preferences";
import { createFileRoute } from "@tanstack/react-router";
import { motion } from "framer-motion";
-import { Monitor, Moon, Sun } from "lucide-react";
+import {
+ Calendar,
+ Eye,
+ Flag,
+ Hash,
+ Layout,
+ Monitor,
+ Moon,
+ Sun,
+ Tag,
+ Users,
+} from "lucide-react";
export const Route = createFileRoute("/dashboard/settings/appearance")({
- component: AppearanceSettings,
+ component: UserSettings,
});
-function AppearanceSettings() {
- const { theme: selectedTheme, setTheme: setSelectedTheme } = useTheme();
- const { isSidebarOpened, setIsSidebarOpened } = useUserPreferencesStore();
+function UserSettings() {
+ const {
+ theme: selectedTheme,
+ setTheme,
+ compactMode,
+ setCompactMode,
+ showTaskNumbers,
+ setShowTaskNumbers,
+ showAssignees,
+ setShowAssignees,
+ showDueDates,
+ setShowDueDates,
+ showLabels,
+ setShowLabels,
+ showPriority,
+ setShowPriority,
+ } = useUserPreferencesStore();
return (
- <>
- <PageTitle title="Appearance Settings" />
- <div className="w-full p-4 md:p-8 max-w-4xl mx-auto">
- <motion.div
- initial={{ opacity: 0, y: 20 }}
- animate={{ opacity: 1, y: 0 }}
- className="space-y-6 md:space-y-8"
- >
- <div>
- <h1 className="text-xl md:text-2xl font-semibold text-zinc-900 dark:text-zinc-100">
- Appearance
- </h1>
- <p className="text-sm text-zinc-500 dark:text-zinc-400 mt-1">
- Customize how Kaneo looks on your device.
- </p>
- </div>
+ <SettingsLayout
+ title="User"
+ className="pt-4 px-6"
+ description="Customize your personal preferences and appearance"
+ >
+ <SettingsSection
+ title="Theme"
+ description="Choose your preferred color scheme"
+ icon={<Sun className="w-4 h-4" />}
+ >
+ <div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
+ {[
+ {
+ id: "light",
+ name: "Light",
+ icon: Sun,
+ description: "Light mode for bright environments",
+ preview: "bg-white border-zinc-200",
+ },
+ {
+ id: "dark",
+ name: "Dark",
+ icon: Moon,
+ description: "Dark mode for low-light environments",
+ preview: "bg-zinc-900 border-zinc-700",
+ },
+ {
+ id: "system",
+ name: "System",
+ icon: Monitor,
+ description: "Follows your system preferences",
+ preview:
+ "bg-gradient-to-br from-white to-zinc-900 border-zinc-400",
+ },
+ ].map((theme) => (
+ <motion.button
+ key={theme.id}
+ onClick={() => {
+ setTheme(theme.id as "dark" | "light" | "system");
+ }}
+ type="button"
+ whileHover={{ scale: 1.02 }}
+ whileTap={{ scale: 0.98 }}
+ className={cn(
+ "relative overflow-hidden rounded-lg border-2 p-4 text-left transition-all duration-200",
+ selectedTheme === theme.id
+ ? "border-primary bg-primary/5 shadow-md ring-2 ring-primary/20"
+ : "border-border bg-card hover:border-primary/50 hover:shadow-sm",
+ )}
+ >
+ {selectedTheme === theme.id && (
+ <div className="absolute right-2 top-2 flex h-5 w-5 items-center justify-center rounded-full bg-primary">
+ <svg
+ className="h-3 w-3 text-primary-foreground"
+ fill="currentColor"
+ viewBox="0 0 20 20"
+ aria-label="Selected"
+ >
+ <title>Selected</title>
+ <path
+ fillRule="evenodd"
+ d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
+ clipRule="evenodd"
+ />
+ </svg>
+ </div>
+ )}
- <div className="bg-white dark:bg-zinc-900 rounded-lg border border-zinc-200 dark:border-zinc-800">
- <div className="p-4 md:p-6">
- <h2 className="text-sm font-medium text-zinc-900 dark:text-zinc-100 mb-1">
- Theme
- </h2>
- <p className="text-sm text-zinc-500 dark:text-zinc-400 mb-4 md:mb-6">
- Select your preferred theme for Kaneo's interface.
- </p>
+ <div className="space-y-3">
+ <div
+ className={cn("h-12 w-full rounded-md border", theme.preview)}
+ />
+ <div className="space-y-1">
+ <div className="flex items-center gap-2">
+ <theme.icon className="h-4 w-4 text-muted-foreground" />
+ <span className="font-medium text-sm">{theme.name}</span>
+ </div>
+ <p className="text-xs text-muted-foreground leading-relaxed">
+ {theme.description}
+ </p>
+ </div>
+ </div>
+ </motion.button>
+ ))}
+ </div>
+ </SettingsSection>
- <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 md:gap-4">
- {[
- {
- id: "light",
- name: "Light",
- icon: Sun,
- description: "Light mode for bright environments",
- },
- {
- id: "dark",
- name: "Dark",
- icon: Moon,
- description: "Dark mode for low-light environments",
- },
- {
- id: "system",
- name: "System",
- icon: Monitor,
- description: "Follows your system preferences",
- },
- ].map((theme) => (
- <button
- key={theme.id}
- onClick={() => {
- setSelectedTheme(theme.id as "dark" | "light" | "system");
- }}
- type="button"
- className={cn(
- "relative p-4 rounded-lg border transition-all duration-200 text-left",
- selectedTheme === theme.id
- ? "border-indigo-500 bg-indigo-50 dark:bg-indigo-500/10"
- : "border-zinc-200 dark:border-zinc-800 bg-white hover:border-zinc-300 dark:bg-zinc-900 dark:hover:border-zinc-700",
- )}
- >
- <div className="flex flex-col items-start">
- <div className="flex items-center gap-2 mb-2">
- <theme.icon
- className={cn(
- "w-5 h-5",
- selectedTheme === theme.id
- ? "text-indigo-500 dark:text-indigo-400"
- : "text-zinc-500 dark:text-zinc-400",
- )}
- />
- <span
- className={cn(
- "font-medium",
- selectedTheme === theme.id
- ? "text-indigo-500 dark:text-indigo-400"
- : "text-zinc-900 dark:text-zinc-100",
- )}
- >
- {theme.name}
- </span>
- </div>
- <p className="text-sm text-zinc-500 dark:text-zinc-400">
- {theme.description}
- </p>
- </div>
- </button>
- ))}
+ <SettingsSection
+ title="Layout & Interface"
+ description="Customize how the interface looks and behaves"
+ icon={<Layout className="w-4 h-4" />}
+ >
+ <div className="space-y-6">
+ <div className="rounded-lg border bg-card p-6">
+ <div className="flex items-center justify-between">
+ <div className="space-y-1">
+ <div className="flex items-center gap-2">
+ <Layout className="h-4 w-4 text-muted-foreground" />
+ <Label className="text-sm font-medium">Compact Mode</Label>
+ </div>
+ <p className="text-xs text-muted-foreground">
+ Reduce spacing and padding for a denser layout
+ </p>
</div>
+ <Switch checked={compactMode} onCheckedChange={setCompactMode} />
</div>
</div>
+ </div>
+ </SettingsSection>
- <div className="bg-white dark:bg-zinc-900 rounded-lg border border-zinc-200 dark:border-zinc-800">
- <div className="p-4 md:p-6">
- <h2 className="text-sm font-medium text-zinc-900 dark:text-zinc-100 mb-1">
- Interface Preferences
- </h2>
- <p className="text-sm text-zinc-500 dark:text-zinc-400 mb-4 md:mb-6">
- Customize your interface preferences.
- </p>
-
- <div className="space-y-4">
- <div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
- <div>
- <label
- htmlFor="sidebar-navigation"
- className="text-sm font-medium text-zinc-900 dark:text-zinc-100"
- >
- Sidebar navigation
- </label>
- <p className="text-sm text-zinc-500 dark:text-zinc-400">
- Show or hide the sidebar
- </p>
- </div>
- <div className="flex items-center">
- <Switch
- id="sidebar-navigation"
- checked={isSidebarOpened}
- onCheckedChange={() => setIsSidebarOpened()}
- className="data-[state=checked]:bg-indigo-500"
- />
+ <SettingsSection
+ title="Display Preferences"
+ description="Control what information is shown in your tasks"
+ icon={<Eye className="w-4 h-4" />}
+ >
+ <div className="grid grid-cols-1 gap-4 md:grid-cols-2">
+ {[
+ {
+ id: "taskNumbers",
+ label: "Task Numbers",
+ description: "Show task ID numbers (e.g., PROJ-123)",
+ icon: Hash,
+ checked: showTaskNumbers,
+ onChange: setShowTaskNumbers,
+ },
+ {
+ id: "assignees",
+ label: "Assignees",
+ description: "Show who is assigned to each task",
+ icon: Users,
+ checked: showAssignees,
+ onChange: setShowAssignees,
+ },
+ {
+ id: "priority",
+ label: "Priority",
+ description: "Show task priority indicators",
+ icon: Flag,
+ checked: showPriority,
+ onChange: setShowPriority,
+ },
+ {
+ id: "dueDates",
+ label: "Due Dates",
+ description: "Show task due dates and deadlines",
+ icon: Calendar,
+ checked: showDueDates,
+ onChange: setShowDueDates,
+ },
+ {
+ id: "labels",
+ label: "Labels",
+ description: "Show task labels and tags",
+ icon: Tag,
+ checked: showLabels,
+ onChange: setShowLabels,
+ },
+ ].map((setting) => (
+ <div key={setting.id} className="rounded-lg border bg-card p-4">
+ <div className="flex items-center justify-between">
+ <div className="space-y-1">
+ <div className="flex items-center gap-2">
+ <setting.icon className="h-4 w-4 text-muted-foreground" />
+ <Label className="text-sm font-medium">
+ {setting.label}
+ </Label>
</div>
+ <p className="text-xs text-muted-foreground">
+ {setting.description}
+ </p>
</div>
+ <Switch
+ checked={setting.checked}
+ onCheckedChange={setting.onChange}
+ />
</div>
</div>
- </div>
- </motion.div>
- </div>
- </>
+ ))}
+ </div>
+ </SettingsSection>
+ </SettingsLayout>
);
}
diff --git a/apps/web/src/routes/dashboard/teams/$workspaceId/_layout.members.tsx b/apps/web/src/routes/dashboard/teams/$workspaceId/_layout.members.tsx
deleted file mode 100644
index 001617486..000000000
--- a/apps/web/src/routes/dashboard/teams/$workspaceId/_layout.members.tsx
+++ /dev/null
@@ -1,70 +0,0 @@
-import InviteTeamMemberModal from "@/components/team/invite-team-member-modal";
-import MembersTable from "@/components/team/members-table";
-import { Button } from "@/components/ui/button";
-import useGetWorkspaceUsers from "@/hooks/queries/workspace-users/use-get-workspace-users";
-import { createFileRoute } from "@tanstack/react-router";
-import { motion } from "framer-motion";
-import { UserPlus } from "lucide-react";
-import { useState } from "react";
-
-export const Route = createFileRoute(
- "/dashboard/teams/$workspaceId/_layout/members",
-)({
- component: RouteComponent,
-});
-
-function RouteComponent() {
- const { workspaceId } = Route.useParams();
- const { data: users } = useGetWorkspaceUsers({ workspaceId });
- const [isInviteTeamMemberModalOpen, setIsInviteTeamMemberModalOpen] =
- useState(false);
-
- return (
- <motion.div
- className="flex-1 p-4 md:p-6"
- initial={{ opacity: 0, y: 20 }}
- animate={{ opacity: 1, y: 0 }}
- transition={{ duration: 0.2 }}
- >
- <div className="flex flex-col md:flex-row md:items-center justify-between gap-4 mb-6">
- <h1 className="text-xl md:text-2xl font-semibold text-zinc-900 dark:text-zinc-100">
- Team Members
- </h1>
-
- <Button
- onClick={() => setIsInviteTeamMemberModalOpen(true)}
- className="bg-indigo-600 text-white hover:bg-indigo-500 dark:bg-indigo-500 dark:hover:bg-indigo-400 w-full md:w-auto"
- >
- <UserPlus className="w-4 h-4 mr-2" />
- New Invitation
- </Button>
- </div>
-
- <div className="bg-white dark:bg-zinc-900 rounded-lg border border-zinc-200 dark:border-zinc-800 overflow-hidden">
- <div className="overflow-x-auto">
- <MembersTable users={users ?? []} />
-
- {users?.length === 0 && (
- <div className="py-12 text-center">
- <p className="text-zinc-500 dark:text-zinc-400">
- No team members found
- </p>
- </div>
- )}
- </div>
- </div>
-
- {/* TODO: Implement delete member */}
- {/* <DeleteTeamMemberModal
- userEmail={selectedMember?.userEmail ?? ""}
- open={isRemoveMemberModalOpen}
- onClose={() => setIsRemoveMemberModalOpen(false)}
- /> */}
-
- <InviteTeamMemberModal
- open={isInviteTeamMemberModalOpen}
- onClose={() => setIsInviteTeamMemberModalOpen(false)}
- />
- </motion.div>
- );
-}
diff --git a/apps/web/src/routes/dashboard/teams/$workspaceId/_layout.roles.tsx b/apps/web/src/routes/dashboard/teams/$workspaceId/_layout.roles.tsx
deleted file mode 100644
index e078b3f09..000000000
--- a/apps/web/src/routes/dashboard/teams/$workspaceId/_layout.roles.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import { createFileRoute } from "@tanstack/react-router";
-
-export const Route = createFileRoute(
- "/dashboard/teams/$workspaceId/_layout/roles",
-)({
- component: RouteComponent,
-});
-
-function RouteComponent() {
- return <div>Hello "/dashboard/workspace/$workspaceId/team/roles"!</div>;
-}
diff --git a/apps/web/src/routes/dashboard/teams/$workspaceId/_layout.tsx b/apps/web/src/routes/dashboard/teams/$workspaceId/_layout.tsx
deleted file mode 100644
index c76becc73..000000000
--- a/apps/web/src/routes/dashboard/teams/$workspaceId/_layout.tsx
+++ /dev/null
@@ -1,143 +0,0 @@
-import PageTitle from "@/components/page-title";
-import { Button } from "@/components/ui/button";
-import { cn } from "@/lib/cn";
-import {
- Link,
- Outlet,
- createFileRoute,
- useRouterState,
-} from "@tanstack/react-router";
-import { AnimatePresence, motion } from "framer-motion";
-import { Shield, Users } from "lucide-react";
-import { Menu } from "lucide-react";
-import { useState } from "react";
-
-export const Route = createFileRoute("/dashboard/teams/$workspaceId/_layout")({
- component: RouteComponent,
-});
-
-function RouteComponent() {
- const [isMobileNavOpen, setIsMobileNavOpen] = useState(false);
- const pathname = useRouterState({ select: (s) => s.location.pathname });
- const { workspaceId } = Route.useParams();
-
- return (
- <>
- <PageTitle title="Team Members" />
- <div className="flex-1 flex flex-col md:flex-row h-screen">
- <motion.div
- className="md:hidden border-b border-zinc-200 dark:border-zinc-800 p-4"
- initial={{ opacity: 0, y: -10 }}
- animate={{ opacity: 1, y: 0 }}
- transition={{ duration: 0.2 }}
- >
- <Button
- variant="outline"
- size="sm"
- onClick={() => setIsMobileNavOpen(!isMobileNavOpen)}
- className="flex items-center gap-2 group"
- >
- <Menu className="w-4 h-4 transition-transform duration-200 ease-in-out group-hover:rotate-90" />
- <span>{isMobileNavOpen ? "Close Menu" : "Menu"}</span>
- </Button>
- </motion.div>
-
- <AnimatePresence mode="wait">
- {(isMobileNavOpen || window.innerWidth >= 768) && (
- <motion.aside
- initial={{
- x: -50,
- opacity: 0,
- }}
- animate={{
- x: 0,
- opacity: 1,
- }}
- exit={{
- x: -50,
- opacity: 0,
- }}
- transition={{
- duration: 0.2,
- ease: "easeOut",
- }}
- className={cn(
- "border-b md:border-b-0 md:border-r border-zinc-200 dark:border-zinc-800",
- "md:w-64 bg-white dark:bg-zinc-950",
- "md:block", // Always show on desktop
- isMobileNavOpen ? "block" : "hidden", // Toggle on mobile
- )}
- >
- <div className="p-4 md:p-6">
- <motion.h2
- initial={{ opacity: 0 }}
- animate={{ opacity: 1 }}
- transition={{ delay: 0.1 }}
- className="text-lg font-semibold text-zinc-900 dark:text-zinc-100 mb-4"
- >
- Team
- </motion.h2>
- <nav className="space-y-1">
- <motion.div
- initial={{ opacity: 0, y: 10 }}
- animate={{ opacity: 1, y: 0 }}
- transition={{ delay: 0.2 }}
- >
- <Link
- className={cn(
- "flex items-center px-3 py-2 rounded-lg text-sm transition-all duration-200 ease-in-out",
- pathname.includes("/members")
- ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
- : "text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800",
- )}
- to="/dashboard/teams/$workspaceId/members"
- params={{
- workspaceId,
- }}
- onClick={() => setIsMobileNavOpen(false)}
- >
- <Users className="w-4 h-4 mr-3" />
- Members
- </Link>
- </motion.div>
-
- <motion.div
- initial={{ opacity: 0, y: 10 }}
- animate={{ opacity: 1, y: 0 }}
- transition={{ delay: 0.4 }}
- >
- <div
- className={cn(
- "flex items-center px-3 py-2 rounded-lg text-sm opacity-50 cursor-not-allowed transition-all duration-200 ease-in-out",
- "text-zinc-400 dark:text-zinc-600",
- )}
- >
- <Shield className="w-4 h-4 mr-3" />
- <span className="flex items-center gap-2">
- Roles
- <span className="text-[10px] font-medium px-1.5 py-0.5 rounded-full bg-zinc-100 dark:bg-zinc-800 text-zinc-500 dark:text-zinc-400">
- Soon
- </span>
- </span>
- </div>
- </motion.div>
- </nav>
- </div>
- </motion.aside>
- )}
- </AnimatePresence>
-
- <motion.div
- className="flex-1"
- initial={{ opacity: 0 }}
- animate={{ opacity: 1 }}
- transition={{ duration: 0.3 }}
- >
- <div className="h-full overflow-auto">
- <Outlet />
- </div>
- </motion.div>
- </div>
- </>
- );
-}
diff --git a/apps/web/src/routes/dashboard/workspace-settings/$workspaceId/index.tsx b/apps/web/src/routes/dashboard/workspace-settings/$workspaceId/index.tsx
deleted file mode 100644
index a7c0b3a8f..000000000
--- a/apps/web/src/routes/dashboard/workspace-settings/$workspaceId/index.tsx
+++ /dev/null
@@ -1,293 +0,0 @@
-import PageTitle from "@/components/page-title";
-import { Button } from "@/components/ui/button";
-import {
- Form,
- FormControl,
- FormField,
- FormItem,
- FormLabel,
- FormMessage,
-} from "@/components/ui/form";
-import { Input } from "@/components/ui/input";
-import useDeleteWorkspace from "@/hooks/mutations/workspace/use-delete-workspace";
-import useUpdateWorkspace from "@/hooks/mutations/workspace/use-update-workspace";
-import { useWorkspacePermission } from "@/hooks/useWorkspacePermission";
-import queryClient from "@/query-client";
-import useWorkspaceStore from "@/store/workspace";
-import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
-import { createFileRoute, useNavigate } from "@tanstack/react-router";
-import { AlertTriangle, ArrowLeft, Lock } from "lucide-react";
-import { useState } from "react";
-import { useForm } from "react-hook-form";
-import { toast } from "sonner";
-import { z } from "zod/v4";
-
-const workspaceFormSchema = z.object({
- name: z.string().min(1, "Workspace name is required"),
- description: z.string().min(1, "workspace description is required"),
-});
-
-type WorkspaceFormValues = z.infer<typeof workspaceFormSchema>;
-
-export const Route = createFileRoute(
- "/dashboard/workspace-settings/$workspaceId/",
-)({
- component: RouteComponent,
-});
-
-function RouteComponent() {
- const navigate = useNavigate();
- const { workspaceId } = Route.useParams();
- const [confirmWorkSpaceName, setConfirmWorkSpaceName] = useState("");
- const { isOwner } = useWorkspacePermission();
-
- const { workspace, setWorkspace } = useWorkspaceStore();
-
- const { mutateAsync: updateWorkspace, isPending } = useUpdateWorkspace();
- const { mutateAsync: deleteWorkspace, isPending: isDeleting } =
- useDeleteWorkspace();
-
- const form = useForm<WorkspaceFormValues>({
- resolver: standardSchemaResolver(workspaceFormSchema),
-
- defaultValues: {
- name: workspace?.name ?? "",
- description: workspace?.description ?? "",
- },
- });
-
- const onSubmit = async (data: WorkspaceFormValues) => {
- try {
- await updateWorkspace({
- id: workspaceId ?? "",
- name: data.name,
- description: data.description ?? "",
- });
-
- queryClient.invalidateQueries({
- queryKey: [`workspace-${workspaceId}`],
- });
- queryClient.invalidateQueries({
- queryKey: ["workspaces", workspace?.ownerEmail],
- });
-
- toast.success("Workspace updated successfully");
- } catch (error) {
- toast.error(
- error instanceof Error ? error.message : "Failed to update workspace",
- );
- }
- };
-
- const handleDeleteWorkspace = async () => {
- if (!workspace) return;
-
- if (confirmWorkSpaceName !== workspace.name) {
- toast.error("Workspace name does not match");
- return;
- }
-
- try {
- await deleteWorkspace({
- id: workspace.id,
- });
-
- queryClient.invalidateQueries({
- queryKey: ["workspace", workspace.id],
- });
- queryClient.invalidateQueries({
- queryKey: ["workspaces", workspace?.ownerEmail],
- });
-
- setWorkspace(undefined);
- navigate({
- to: "/dashboard",
- });
-
- toast.success("Workspace deleted successfully");
- setConfirmWorkSpaceName("");
- } catch (error) {
- toast.error(
- error instanceof Error ? error.message : "Failed to delete workspace",
- );
- }
- };
-
- if (!isOwner) {
- return (
- <div className="flex-1 p-6">
- <PageTitle title="Project Settings" />
- <div className="mt-6 max-w-2xl mx-auto">
- <div className="bg-white dark:bg-zinc-800/50 rounded-lg p-8 shadow-sm border border-zinc-200 dark:border-zinc-700/50 text-center">
- <div className="flex justify-center mb-4">
- <div className="w-16 h-16 rounded-full bg-amber-100 dark:bg-amber-900/30 flex items-center justify-center">
- <Lock className="w-8 h-8 text-amber-600 dark:text-amber-400" />
- </div>
- </div>
- <h2 className="text-xl font-semibold text-zinc-900 dark:text-zinc-100 mb-2">
- Permission Required
- </h2>
- <p className="text-zinc-500 dark:text-zinc-400 mb-6 max-w-md mx-auto">
- Only workspace owners can modify workspace settings. Please
- contact the workspace owner if you need to make changes.
- </p>
- <Button
- variant="outline"
- onClick={() =>
- navigate({
- to: "/dashboard/workspace/$workspaceId",
- params: {
- workspaceId: workspaceId ?? "",
- },
- })
- }
- className="gap-2"
- >
- <ArrowLeft className="w-4 h-4" />
- Back to Workspace
- </Button>
- </div>
- </div>
- </div>
- );
- }
-
- return (
- <>
- <PageTitle title={`${workspace?.name} Settings`} />
- <div className="h-full flex flex-col bg-white dark:bg-zinc-900 overflow-hidden">
- <header className="sticky top-0 z-10 flex items-center px-4 h-[65px] bg-white dark:bg-zinc-900 border-b border-zinc-200 dark:border-zinc-800">
- <div className="flex items-center gap-2 flex-1 min-w-0">
- <h1 className="text-lg font-semibold text-zinc-900 dark:text-zinc-100">
- Workspace Settings
- </h1>
- </div>
- </header>
-
- <div className="flex-1 overflow-y-auto p-4 md:p-8">
- <div className="max-w-4xl mx-auto space-y-6 md:space-y-8">
- <div className="bg-white dark:bg-zinc-900 rounded-lg border border-zinc-200 dark:border-zinc-800">
- <div className="p-4 md:p-6">
- <h2 className="text-sm font-medium text-zinc-900 dark:text-zinc-100 mb-1">
- General Settings
- </h2>
- <p className="text-sm text-zinc-500 dark:text-zinc-400 mb-4">
- Basic Workspace information and settings.
- </p>
-
- {workspace ? (
- <Form {...form}>
- <form
- onSubmit={form.handleSubmit(onSubmit)}
- className="space-y-6"
- >
- <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
- <FormField
- control={form.control}
- name="name"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Workspace Name</FormLabel>
- <FormControl>
- <Input
- {...field}
- className="bg-white dark:bg-zinc-800/50"
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
-
- <FormField
- control={form.control}
- name="description"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Workspace description</FormLabel>
- <FormControl>
- <Input
- {...field}
- className="bg-white dark:bg-zinc-800/50 font-mono"
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- </div>
-
- <Button type="submit" disabled={isPending}>
- {isPending ? "Saving..." : "Save Changes"}
- </Button>
- </form>
- </Form>
- ) : (
- <div className="text-sm text-zinc-500 dark:text-zinc-400">
- Select a Workspace to view its settings
- </div>
- )}
- </div>
- </div>
- {workspace && isOwner && (
- <div className="bg-white dark:bg-zinc-900 rounded-lg border border-zinc-200 dark:border-zinc-800">
- <div className="p-4 md:p-6">
- <h2 className="text-base font-medium text-red-600 dark:text-red-400 mb-1">
- Danger Zone
- </h2>
- <p className="text-sm text-zinc-500 dark:text-zinc-400 mb-6">
- Permanently delete your Workspace. This action cannot be
- undone.
- </p>
-
- <div className="space-y-4">
- <div className="p-4 bg-red-500/5 border border-red-200 dark:border-red-500/10 rounded-lg">
- <div className="flex items-center gap-3 text-red-600 dark:text-red-400 mb-3">
- <AlertTriangle className="w-5 h-5" />
- <p className="font-medium">
- Warning: This action cannot be undone
- </p>
- </div>
- <ul className="list-disc list-inside space-y-1 text-sm text-red-600/90 dark:text-red-400/90">
- <li>All Projects will be permanently deleted</li>
- <li>All tasks will be removed</li>
- <li>All task history will be removed</li>
- <li>Project settings will be erased</li>
- </ul>
- </div>
-
- <div>
- <label
- htmlFor="confirm-project-name"
- className="block text-sm font-medium text-zinc-900 dark:text-zinc-100 mb-1.5"
- >
- Type "{workspace.name}" to confirm deletion
- </label>
- <div className="flex gap-3">
- <Input
- value={confirmWorkSpaceName}
- onChange={(e) =>
- setConfirmWorkSpaceName(e.target.value)
- }
- placeholder={workspace.name}
- className="bg-white dark:bg-zinc-800/50"
- />
- <Button
- onClick={handleDeleteWorkspace}
- disabled={confirmWorkSpaceName !== workspace.name}
- className="bg-red-600 text-white hover:bg-red-500 dark:bg-red-500 dark:hover:bg-red-400 disabled:opacity-50"
- >
- {isDeleting ? "Deleting..." : "Delete Workspace"}
- </Button>
- </div>
- </div>
- </div>
- </div>
- </div>
- )}
- </div>
- </div>
- </div>
- </>
- );
-}
diff --git a/apps/web/src/routes/dashboard/workspace/$workspaceId.tsx b/apps/web/src/routes/dashboard/workspace/$workspaceId.tsx
index 9ae483cb1..7de2e9dbb 100644
--- a/apps/web/src/routes/dashboard/workspace/$workspaceId.tsx
+++ b/apps/web/src/routes/dashboard/workspace/$workspaceId.tsx
@@ -1,8 +1,4 @@
-import EmptyProjectState from "@/components/project/empty-state";
-import SelectProjectState from "@/components/project/select-project-state";
-import useGetProjects from "@/hooks/queries/project/use-get-projects";
import useGetWorkspace from "@/hooks/queries/workspace/use-get-workspace";
-import useProjectStore from "@/store/project";
import useWorkspaceStore from "@/store/workspace";
import { Outlet, createFileRoute } from "@tanstack/react-router";
import { useEffect } from "react";
@@ -13,29 +9,14 @@ export const Route = createFileRoute("/dashboard/workspace/$workspaceId")({
function RouteComponent() {
const { workspaceId } = Route.useParams();
- const { data } = useGetWorkspace({
- id: workspaceId,
- });
+ const { data: workspace } = useGetWorkspace({ id: workspaceId });
const { setWorkspace } = useWorkspaceStore();
- const { project } = useProjectStore();
- const { data: projects } = useGetProjects({
- workspaceId,
- });
useEffect(() => {
- if (data) {
- setWorkspace(data);
+ if (workspace) {
+ setWorkspace(workspace);
}
- }, [data, setWorkspace]);
+ }, [workspace, setWorkspace]);
- if (projects && projects.length === 0) {
- return <EmptyProjectState />;
- }
-
- return (
- <>
- <Outlet />
- {!project && <SelectProjectState />}
- </>
- );
+ return <Outlet />;
}
diff --git a/apps/web/src/routes/dashboard/workspace/$workspaceId/index.tsx b/apps/web/src/routes/dashboard/workspace/$workspaceId/index.tsx
new file mode 100644
index 000000000..5f068b612
--- /dev/null
+++ b/apps/web/src/routes/dashboard/workspace/$workspaceId/index.tsx
@@ -0,0 +1,265 @@
+import WorkspaceLayout from "@/components/common/workspace-layout";
+import CreateProjectModal from "@/components/shared/modals/create-project-modal";
+import { Badge } from "@/components/ui/badge";
+import { Button } from "@/components/ui/button";
+import { Progress } from "@/components/ui/progress";
+import { Skeleton } from "@/components/ui/skeleton";
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from "@/components/ui/table";
+import icons from "@/constants/project-icons";
+import { shortcuts } from "@/constants/shortcuts";
+import useGetProjects from "@/hooks/queries/project/use-get-projects";
+import { useRegisterShortcuts } from "@/hooks/use-keyboard-shortcuts";
+import { createFileRoute, useNavigate } from "@tanstack/react-router";
+import { LayoutGrid, Plus } from "lucide-react";
+import { useState } from "react";
+
+export const Route = createFileRoute("/dashboard/workspace/$workspaceId/")({
+ component: RouteComponent,
+});
+
+function RouteComponent() {
+ const [isCreateProjectOpen, setIsCreateProjectOpen] = useState(false);
+ const { workspaceId } = Route.useParams();
+ const navigate = useNavigate();
+ const { data: projects, isLoading } = useGetProjects({
+ workspaceId,
+ });
+
+ const handleCreateProject = () => {
+ setIsCreateProjectOpen(true);
+ };
+
+ useRegisterShortcuts({
+ sequentialShortcuts: {
+ [shortcuts.project.prefix]: {
+ [shortcuts.project.create]: handleCreateProject,
+ },
+ },
+ });
+
+ const handleProjectClick = (projectId: string) => {
+ navigate({
+ to: "/dashboard/workspace/$workspaceId/project/$projectId/board",
+ params: { workspaceId, projectId },
+ });
+ };
+
+ if (isLoading) {
+ return (
+ <WorkspaceLayout
+ title="Projects"
+ headerActions={
+ <Button
+ variant="outline"
+ size="xs"
+ onClick={handleCreateProject}
+ className="gap-1"
+ >
+ <Plus className="w-3 h-3" />
+ Create project
+ </Button>
+ }
+ >
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead className="text-foreground font-medium">
+ Title
+ </TableHead>
+ <TableHead className="text-foreground font-medium">
+ Progress
+ </TableHead>
+ <TableHead className="text-foreground font-medium">
+ Target date
+ </TableHead>
+ <TableHead className="text-foreground font-medium">
+ Status
+ </TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {[1, 2, 3].map((i) => (
+ <TableRow key={i}>
+ <TableCell className="py-3">
+ <div className="flex items-center gap-3">
+ <Skeleton className="h-5 w-5" />
+ <Skeleton className="h-4 w-24" />
+ </div>
+ </TableCell>
+ <TableCell className="py-3">
+ <Skeleton className="h-2 w-20" />
+ </TableCell>
+ <TableCell className="py-3">
+ <Skeleton className="h-4 w-20" />
+ </TableCell>
+ <TableCell className="py-3">
+ <Skeleton className="h-5 w-16" />
+ </TableCell>
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
+ </WorkspaceLayout>
+ );
+ }
+
+ if (!projects || projects.length === 0) {
+ return (
+ <>
+ <WorkspaceLayout
+ title="Projects"
+ headerActions={
+ <Button
+ variant="outline"
+ size="xs"
+ onClick={handleCreateProject}
+ className="gap-1"
+ >
+ <Plus className="w-3 h-3" />
+ Create project
+ </Button>
+ }
+ >
+ <div className="flex items-center justify-center min-h-[60vh]">
+ <div className="text-center space-y-6">
+ <div className="w-16 h-16 mx-auto rounded-xl bg-muted flex items-center justify-center">
+ <LayoutGrid className="w-8 h-8 text-muted-foreground" />
+ </div>
+ <div className="space-y-2">
+ <h3 className="text-xl font-semibold">No projects yet</h3>
+ <p className="text-muted-foreground">
+ Get started by creating your first project.
+ </p>
+ </div>
+ <Button onClick={handleCreateProject} className="gap-2">
+ <Plus className="w-4 h-4" />
+ Create project
+ </Button>
+ </div>
+ </div>
+ </WorkspaceLayout>
+
+ <CreateProjectModal
+ open={isCreateProjectOpen}
+ onClose={() => setIsCreateProjectOpen(false)}
+ />
+ </>
+ );
+ }
+
+ return (
+ <>
+ <WorkspaceLayout
+ title="Projects"
+ headerActions={
+ <Button
+ variant="outline"
+ size="xs"
+ onClick={handleCreateProject}
+ className="gap-1"
+ >
+ <Plus className="w-3 h-3" />
+ Create project
+ </Button>
+ }
+ >
+ <Table>
+ <TableHeader className="p-4">
+ <TableRow>
+ <TableHead className="text-foreground font-medium">
+ Title
+ </TableHead>
+ <TableHead className="text-foreground font-medium">
+ Progress
+ </TableHead>
+ <TableHead className="text-foreground font-medium">
+ Due date
+ </TableHead>
+ <TableHead className="text-foreground font-medium">
+ Status
+ </TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {projects?.map((project) => {
+ if (!project || !project.id || !project.statistics) return null;
+
+ const IconComponent =
+ icons[project.icon as keyof typeof icons] || icons.Layout;
+
+ const getStatusText = () => {
+ if (project.statistics.totalTasks === 0) return "Not started";
+ if (project.statistics.completionPercentage === 100)
+ return "Complete";
+ return "In progress";
+ };
+
+ const getStatusVariant = () => {
+ if (project.statistics.totalTasks === 0) return "secondary";
+ if (project.statistics.completionPercentage === 100)
+ return "default";
+ return "outline";
+ };
+
+ return (
+ <TableRow
+ key={project.id}
+ className="cursor-pointer"
+ onClick={() => handleProjectClick(project.id)}
+ >
+ <TableCell className="py-3">
+ <div className="flex items-center gap-3">
+ <IconComponent className="w-5 h-5 text-muted-foreground" />
+ <span className="font-medium">{project.name}</span>
+ </div>
+ </TableCell>
+ <TableCell className="py-3">
+ <div className="flex items-center gap-2">
+ <Progress
+ value={project.statistics.completionPercentage}
+ className="w-16 h-2"
+ />
+ <span className="text-sm text-muted-foreground">
+ {project.statistics.completionPercentage}%
+ </span>
+ </div>
+ </TableCell>
+ <TableCell className="py-3">
+ <span className="text-sm text-muted-foreground">
+ {project.statistics.dueDate
+ ? new Date(
+ project.statistics.dueDate,
+ ).toLocaleDateString("en-US", {
+ month: "short",
+ day: "numeric",
+ year: "numeric",
+ })
+ : "No due date"}
+ </span>
+ </TableCell>
+ <TableCell className="py-3">
+ <Badge variant={getStatusVariant()}>
+ {getStatusText()}
+ </Badge>
+ </TableCell>
+ </TableRow>
+ );
+ })}
+ </TableBody>
+ </Table>
+ </WorkspaceLayout>
+
+ <CreateProjectModal
+ open={isCreateProjectOpen}
+ onClose={() => setIsCreateProjectOpen(false)}
+ />
+ </>
+ );
+}
diff --git a/apps/web/src/routes/dashboard/workspace/$workspaceId/members.tsx b/apps/web/src/routes/dashboard/workspace/$workspaceId/members.tsx
new file mode 100644
index 000000000..08aba352a
--- /dev/null
+++ b/apps/web/src/routes/dashboard/workspace/$workspaceId/members.tsx
@@ -0,0 +1,45 @@
+import WorkspaceLayout from "@/components/common/workspace-layout";
+import InviteTeamMemberModal from "@/components/team/invite-team-member-modal";
+import MembersTable from "@/components/team/members-table";
+import { Button } from "@/components/ui/button";
+import useGetWorkspaceUsers from "@/hooks/queries/workspace-users/use-get-workspace-users";
+import { createFileRoute } from "@tanstack/react-router";
+import { UserPlus } from "lucide-react";
+import { useState } from "react";
+
+export const Route = createFileRoute(
+ "/dashboard/workspace/$workspaceId/members",
+)({
+ component: RouteComponent,
+});
+
+function RouteComponent() {
+ const { workspaceId } = Route.useParams();
+ const { data: users } = useGetWorkspaceUsers({ workspaceId });
+ const [isInviteTeamMemberModalOpen, setIsInviteTeamMemberModalOpen] =
+ useState(false);
+
+ return (
+ <WorkspaceLayout
+ title="Members"
+ headerActions={
+ <Button
+ onClick={() => setIsInviteTeamMemberModalOpen(true)}
+ variant="outline"
+ size="xs"
+ className="gap-1 w-full md:w-auto"
+ >
+ <UserPlus className="w-3 h-3" />
+ Invite member
+ </Button>
+ }
+ >
+ <MembersTable users={users ?? []} />
+
+ <InviteTeamMemberModal
+ open={isInviteTeamMemberModalOpen}
+ onClose={() => setIsInviteTeamMemberModalOpen(false)}
+ />
+ </WorkspaceLayout>
+ );
+}
diff --git a/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId.tsx b/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId.tsx
deleted file mode 100644
index 7f9bbf0dc..000000000
--- a/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import EmptyProjectState from "@/components/project/empty-state";
-import useGetProjects from "@/hooks/queries/project/use-get-projects";
-import { Outlet, createFileRoute } from "@tanstack/react-router";
-
-export const Route = createFileRoute(
- "/dashboard/workspace/$workspaceId/project/$projectId",
-)({
- component: RouteComponent,
-});
-
-function RouteComponent() {
- const { workspaceId } = Route.useParams();
- const { data: projects } = useGetProjects({ workspaceId });
-
- if (projects && projects.length === 0) {
- return <EmptyProjectState />;
- }
-
- return <Outlet />;
-}
diff --git a/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/backlog.tsx b/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/backlog.tsx
index 0e23c7508..5ea9da56c 100644
--- a/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/backlog.tsx
+++ b/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/backlog.tsx
@@ -1,18 +1,34 @@
import BacklogListView from "@/components/backlog-list-view";
-import BoardFilters, {
- type BoardFilters as BoardFiltersType,
-} from "@/components/filters";
-import PageTitle from "@/components/page-title";
+import ProjectLayout from "@/components/common/project-layout";
import CreateTaskModal from "@/components/shared/modals/create-task-modal";
+import { Button } from "@/components/ui/button";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/popover";
+import { priorityColorsTaskCard } from "@/constants/priority-colors";
import useUpdateTask from "@/hooks/mutations/task/use-update-task";
import useGetTasks from "@/hooks/queries/task/use-get-tasks";
+import useGetActiveWorkspaceUsers from "@/hooks/queries/workspace-users/use-active-workspace-users";
+import { cn } from "@/lib/cn";
import useProjectStore from "@/store/project";
+import { useUserPreferencesStore } from "@/store/user-preferences";
import type Task from "@/types/task";
import { createFileRoute } from "@tanstack/react-router";
import { addWeeks, endOfWeek, isWithinInterval, startOfWeek } from "date-fns";
import { produce } from "immer";
-import { ArrowRight, Plus } from "lucide-react";
-import { useEffect, useState } from "react";
+import {
+ ArrowRight,
+ Calendar,
+ Check,
+ Filter,
+ Flag,
+ Plus,
+ Settings,
+ User,
+} from "lucide-react";
+import { useEffect, useMemo, useState } from "react";
import { toast } from "sonner";
export const Route = createFileRoute(
@@ -21,171 +37,121 @@ export const Route = createFileRoute(
component: RouteComponent,
});
+interface BacklogFilters {
+ priority: string | null;
+ assignee: string | null;
+ dueDate: string | null;
+}
+
function RouteComponent() {
- const { projectId } = Route.useParams();
+ const { projectId, workspaceId } = Route.useParams();
const { data } = useGetTasks(projectId);
const { project, setProject } = useProjectStore();
const [isTaskModalOpen, setIsTaskModalOpen] = useState(false);
const { mutate: updateTask } = useUpdateTask();
- const [filters, setFilters] = useState<BoardFiltersType>({
- search: "",
- assignee: null,
+ const [filters, setFilters] = useState<BacklogFilters>({
priority: null,
+ assignee: null,
dueDate: null,
- sortBy: null,
- sortOrder: null,
});
+ const { data: users } = useGetActiveWorkspaceUsers({ workspaceId });
+ const {
+ showAssignees,
+ showPriority,
+ showDueDates,
+ showLabels,
+ showTaskNumbers,
+ toggleAssignees,
+ togglePriority,
+ toggleDueDates,
+ toggleLabels,
+ toggleTaskNumbers,
+ } = useUserPreferencesStore();
+
useEffect(() => {
if (data) {
setProject(data);
}
}, [data, setProject]);
- const filterTasks = (tasks: Task[]): Task[] => {
- let filteredTasks = tasks.filter((task) => {
- if (
- filters.search &&
- !task.title.toLowerCase().includes(filters.search.toLowerCase())
- ) {
- return false;
- }
+ const filteredProject = useMemo(() => {
+ if (!project) return null;
- if (filters.assignee && task.userEmail !== filters.assignee) {
- return false;
- }
+ const filterTasks = (tasks: Task[]): Task[] => {
+ return tasks.filter((task) => {
+ if (filters.priority && task.priority !== filters.priority) {
+ return false;
+ }
- if (filters.priority && task.priority !== filters.priority) {
- return false;
- }
+ if (filters.assignee && task.userEmail !== filters.assignee) {
+ return false;
+ }
- if (filters.dueDate && task.dueDate) {
- const today = new Date();
- const taskDate = new Date(task.dueDate);
-
- switch (filters.dueDate) {
- case "Due this week": {
- const weekStart = startOfWeek(today);
- const weekEnd = endOfWeek(today);
- if (
- !isWithinInterval(taskDate, { start: weekStart, end: weekEnd })
- ) {
- return false;
+ if (filters.dueDate && task.dueDate) {
+ const today = new Date();
+ const taskDate = new Date(task.dueDate);
+
+ switch (filters.dueDate) {
+ case "Due this week": {
+ const weekStart = startOfWeek(today);
+ const weekEnd = endOfWeek(today);
+ if (
+ !isWithinInterval(taskDate, { start: weekStart, end: weekEnd })
+ ) {
+ return false;
+ }
+ break;
}
- break;
- }
- case "Due next week": {
- const nextWeekStart = startOfWeek(addWeeks(today, 1));
- const nextWeekEnd = endOfWeek(addWeeks(today, 1));
- if (
- !isWithinInterval(taskDate, {
- start: nextWeekStart,
- end: nextWeekEnd,
- })
- ) {
+ case "Due next week": {
+ const nextWeekStart = startOfWeek(addWeeks(today, 1));
+ const nextWeekEnd = endOfWeek(addWeeks(today, 1));
+ if (
+ !isWithinInterval(taskDate, {
+ start: nextWeekStart,
+ end: nextWeekEnd,
+ })
+ ) {
+ return false;
+ }
+ break;
+ }
+ case "No due date": {
return false;
}
- break;
- }
- case "No due date": {
- return false;
}
}
- }
-
- return true;
- });
-
- // Sort tasks if sort parameters are provided
- if (filters.sortBy && filters.sortOrder) {
- filteredTasks = filteredTasks.sort((a, b) => {
- const sortOrder = filters.sortOrder === "asc" ? 1 : -1;
-
- switch (filters.sortBy) {
- case "title":
- return sortOrder * a.title.localeCompare(b.title);
-
- case "priority": {
- // Custom priority order: urgent > high > medium > low
- const priorityOrder = { urgent: 0, high: 1, medium: 2, low: 3 };
- const aPriority = a.priority
- ? (priorityOrder[a.priority as keyof typeof priorityOrder] ?? 999)
- : 999;
- const bPriority = b.priority
- ? (priorityOrder[b.priority as keyof typeof priorityOrder] ?? 999)
- : 999;
- return sortOrder * (aPriority - bPriority);
- }
- case "dueDate": {
- // Handle cases where dueDate might be undefined
- if (!a.dueDate && !b.dueDate) return 0;
- if (!a.dueDate) return sortOrder;
- if (!b.dueDate) return -sortOrder;
+ if (filters.dueDate === "No due date" && task.dueDate) {
+ return false;
+ }
- const aDate = new Date(a.dueDate).getTime();
- const bDate = new Date(b.dueDate).getTime();
- return sortOrder * (aDate - bDate);
- }
+ return true;
+ });
+ };
- case "createdAt": {
- const aDate = new Date(a.createdAt).getTime();
- const bDate = new Date(b.createdAt).getTime();
- return sortOrder * (aDate - bDate);
- }
+ return {
+ ...project,
+ plannedTasks: filterTasks(project.plannedTasks || []),
+ archivedTasks: filterTasks(project.archivedTasks || []),
+ };
+ }, [project, filters]);
- default:
- return 0;
- }
- });
- }
+ const hasActiveFilters = Object.values(filters).some(
+ (filter) => filter !== null,
+ );
- return filteredTasks;
+ const clearFilters = () => {
+ setFilters({
+ priority: null,
+ assignee: null,
+ dueDate: null,
+ });
};
- const backlogProject = project
- ? {
- ...project,
- columns: [
- {
- id: "planned" as const,
- name: "Planned" as const,
- tasks: project.plannedTasks
- ? filterTasks(project.plannedTasks).map((task) => ({
- ...task,
- assigneeName: task.assigneeName ?? null,
- assigneeEmail: task.assigneeEmail ?? null,
- }))
- : [],
- },
- {
- id: "archived" as const,
- name: "Archived" as const,
- tasks: project.archivedTasks
- ? filterTasks(project.archivedTasks).map((task) => ({
- ...task,
- assigneeName: task.assigneeName ?? null,
- assigneeEmail: task.assigneeEmail ?? null,
- }))
- : [],
- },
- ],
- plannedTasks: project.plannedTasks
- ? filterTasks(project.plannedTasks).map((task) => ({
- ...task,
- assigneeName: task.assigneeName ?? null,
- assigneeEmail: task.assigneeEmail ?? null,
- }))
- : [],
- archivedTasks: project.archivedTasks
- ? filterTasks(project.archivedTasks).map((task) => ({
- ...task,
- assigneeName: task.assigneeName ?? null,
- assigneeEmail: task.assigneeEmail ?? null,
- }))
- : [],
- }
- : undefined;
+ const updateFilter = (key: keyof BacklogFilters, value: string | null) => {
+ setFilters((prev) => ({ ...prev, [key]: value }));
+ };
const handleMoveAllPlannedToTodo = () => {
if (!project) return;
@@ -227,55 +193,340 @@ function RouteComponent() {
};
return (
- <div className="flex flex-col flex-1">
- <PageTitle title={`${project?.name || "Project"} · Backlog`} />
- <div className="p-4 border-b border-zinc-200 dark:border-zinc-800">
- <div className="flex items-center justify-between mb-3">
- <h1 className="text-lg font-medium text-zinc-900 dark:text-zinc-100">
- Project - Backlog
- </h1>
-
- <div className="flex items-center gap-1">
- <button
- type="button"
- onClick={() => setIsTaskModalOpen(true)}
- className="h-8 bg-indigo-500 text-white text-xs font-medium rounded-l-md flex items-center"
- >
- <span className="px-1.5 flex items-center justify-center h-full">
- <Plus className="w-3.5 h-3.5" />
- </span>
- <span className="px-2">Plan Task</span>
- </button>
-
- <button
- type="button"
- onClick={handleMoveAllPlannedToTodo}
- className="h-8 bg-zinc-700 text-zinc-100 text-xs font-medium rounded-r-md flex items-center"
- title="Move All Planned to To Do"
- >
- <span className="px-1.5 flex items-center justify-center h-full">
- <ArrowRight className="w-3.5 h-3.5" />
- </span>
- <span className="px-2 hidden sm:inline">Move All</span>
- </button>
+ <ProjectLayout
+ title="Backlog"
+ projectId={projectId}
+ workspaceId={workspaceId}
+ >
+ <div className="flex flex-col h-full min-h-0">
+ <div className="bg-card border-b border-border">
+ <div className="h-10 flex items-center px-4">
+ <div className="flex items-center justify-between w-full">
+ <div className="flex items-center gap-2">
+ <Button
+ variant="ghost"
+ size="xs"
+ onClick={() => setIsTaskModalOpen(true)}
+ className="h-6 px-2 text-xs text-zinc-600 dark:text-zinc-400"
+ >
+ <Plus className="h-3 w-3 mr-1" />
+ Plan
+ </Button>
+
+ <Button
+ variant="ghost"
+ size="xs"
+ onClick={handleMoveAllPlannedToTodo}
+ className="h-6 px-2 text-xs text-zinc-600 dark:text-zinc-400"
+ title="Move All Planned to To Do"
+ >
+ <ArrowRight className="h-3 w-3 mr-1" />
+ Move All
+ </Button>
+
+ <Popover>
+ <PopoverTrigger asChild>
+ <Button
+ variant="ghost"
+ size="sm"
+ className={cn(
+ "h-6 px-2 text-xs",
+ hasActiveFilters
+ ? "text-indigo-600 dark:text-indigo-400 bg-indigo-50 dark:bg-indigo-500/10"
+ : "text-zinc-600 dark:text-zinc-400",
+ )}
+ >
+ <Filter className="h-3 w-3 mr-1" />
+ Filter
+ {hasActiveFilters && (
+ <span className="ml-1 bg-indigo-500 text-white text-xs rounded-full w-4 h-4 flex items-center justify-center">
+ {
+ Object.values(filters).filter((f) => f !== null)
+ .length
+ }
+ </span>
+ )}
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent className="w-72 p-0" align="start">
+ <div className="p-3 border-b border-zinc-200 dark:border-zinc-800">
+ <div className="flex items-center justify-between">
+ <h3 className="text-sm font-medium text-zinc-900 dark:text-zinc-100">
+ Filters
+ </h3>
+ {hasActiveFilters && (
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={clearFilters}
+ className="h-6 px-2 text-xs text-zinc-500 hover:text-zinc-700"
+ >
+ Clear all
+ </Button>
+ )}
+ </div>
+ </div>
+
+ <div className="p-1 space-y-1">
+ <Popover>
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ className="w-full flex items-center justify-between px-2 py-1.5 text-xs text-left text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800 rounded-md transition-colors"
+ >
+ <div className="flex items-center gap-2">
+ <Flag className="w-3 h-3" />
+ <span>Priority</span>
+ </div>
+ {filters.priority && (
+ <div className="flex items-center gap-1">
+ <span className="text-xs bg-zinc-100 dark:bg-zinc-800 px-1.5 py-0.5 rounded capitalize">
+ {filters.priority}
+ </span>
+ </div>
+ )}
+ </button>
+ </PopoverTrigger>
+ <PopoverContent
+ className="w-48 p-1"
+ align="start"
+ side="right"
+ >
+ {["urgent", "high", "medium", "low"].map(
+ (priority) => (
+ <button
+ key={priority}
+ type="button"
+ onClick={() =>
+ updateFilter("priority", priority)
+ }
+ className={cn(
+ "w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left rounded-md transition-colors",
+ filters.priority === priority
+ ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
+ : "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
+ )}
+ >
+ <Flag
+ className={cn(
+ "w-3 h-3",
+ priorityColorsTaskCard[
+ priority as keyof typeof priorityColorsTaskCard
+ ],
+ )}
+ />
+ <span className="capitalize">{priority}</span>
+ {filters.priority === priority && (
+ <Check className="h-3 w-3 ml-auto" />
+ )}
+ </button>
+ ),
+ )}
+ </PopoverContent>
+ </Popover>
+
+ <Popover>
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ className="w-full flex items-center justify-between px-2 py-1.5 text-xs text-left text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800 rounded-md transition-colors"
+ >
+ <div className="flex items-center gap-2">
+ <User className="w-3 h-3" />
+ <span>Assignee</span>
+ </div>
+ {filters.assignee && (
+ <div className="flex items-center gap-1">
+ <span className="text-xs bg-zinc-100 dark:bg-zinc-800 px-1.5 py-0.5 rounded">
+ {users?.find(
+ (u) => u.userEmail === filters.assignee,
+ )?.userName || "Unknown"}
+ </span>
+ </div>
+ )}
+ </button>
+ </PopoverTrigger>
+ <PopoverContent
+ className="w-48 p-1"
+ align="start"
+ side="right"
+ >
+ {users?.map((user) => (
+ <button
+ key={user.userEmail}
+ type="button"
+ onClick={() =>
+ updateFilter("assignee", user.userEmail)
+ }
+ className={cn(
+ "w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left rounded-md transition-colors",
+ filters.assignee === user.userEmail
+ ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
+ : "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
+ )}
+ >
+ <div className="w-5 h-5 bg-zinc-400 rounded-full flex items-center justify-center text-white text-xs font-bold">
+ {user.userName?.charAt(0).toUpperCase()}
+ </div>
+ <span>{user.userName}</span>
+ {filters.assignee === user.userEmail && (
+ <Check className="h-3 w-3 ml-auto" />
+ )}
+ </button>
+ ))}
+ </PopoverContent>
+ </Popover>
+
+ <Popover>
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ className="w-full flex items-center justify-between px-2 py-1.5 text-xs text-left text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800 rounded-md transition-colors"
+ >
+ <div className="flex items-center gap-2">
+ <Calendar className="w-3 h-3" />
+ <span>Due date</span>
+ </div>
+ {filters.dueDate && (
+ <div className="flex items-center gap-1">
+ <span className="text-xs bg-zinc-100 dark:bg-zinc-800 px-1.5 py-0.5 rounded">
+ {filters.dueDate}
+ </span>
+ </div>
+ )}
+ </button>
+ </PopoverTrigger>
+ <PopoverContent
+ className="w-48 p-1"
+ align="start"
+ side="right"
+ >
+ {[
+ "Due this week",
+ "Due next week",
+ "No due date",
+ ].map((option) => (
+ <button
+ key={option}
+ type="button"
+ onClick={() => updateFilter("dueDate", option)}
+ className={cn(
+ "w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left rounded-md transition-colors",
+ filters.dueDate === option
+ ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
+ : "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
+ )}
+ >
+ <Calendar className="w-3 h-3" />
+ <span>{option}</span>
+ {filters.dueDate === option && (
+ <Check className="h-3 w-3 ml-auto" />
+ )}
+ </button>
+ ))}
+ </PopoverContent>
+ </Popover>
+ </div>
+ </PopoverContent>
+ </Popover>
+
+ <Popover>
+ <PopoverTrigger asChild>
+ <Button
+ variant="ghost"
+ size="sm"
+ className="h-6 px-2 text-xs text-zinc-600 dark:text-zinc-400"
+ >
+ <Settings className="h-3 w-3 mr-1" />
+ Display
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent className="w-56 p-0" align="start">
+ <div className="py-2">
+ <div className="px-2 py-1.5 text-xs font-medium text-zinc-500 dark:text-zinc-400">
+ Show Elements
+ </div>
+ <button
+ type="button"
+ onClick={toggleAssignees}
+ className="w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left transition-colors text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800"
+ >
+ <User className="w-3.5 h-3.5" />
+ <span>Show assignee</span>
+ {showAssignees && (
+ <div className="ml-auto w-2 h-2 bg-indigo-500 rounded-full" />
+ )}
+ </button>
+ <button
+ type="button"
+ onClick={togglePriority}
+ className="w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left transition-colors text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800"
+ >
+ <Flag className="w-3.5 h-3.5" />
+ <span>Show priority</span>
+ {showPriority && (
+ <div className="ml-auto w-2 h-2 bg-indigo-500 rounded-full" />
+ )}
+ </button>
+ <button
+ type="button"
+ onClick={toggleDueDates}
+ className="w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left transition-colors text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800"
+ >
+ <Calendar className="w-3.5 h-3.5" />
+ <span>Show due date</span>
+ {showDueDates && (
+ <div className="ml-auto w-2 h-2 bg-indigo-500 rounded-full" />
+ )}
+ </button>
+ <button
+ type="button"
+ onClick={toggleLabels}
+ className="w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left transition-colors text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800"
+ >
+ <span className="w-3.5 h-3.5 bg-zinc-300 dark:bg-zinc-600 rounded-sm" />
+ <span>Show labels</span>
+ {showLabels && (
+ <div className="ml-auto w-2 h-2 bg-indigo-500 rounded-full" />
+ )}
+ </button>
+ <button
+ type="button"
+ onClick={toggleTaskNumbers}
+ className="w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left transition-colors text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800"
+ >
+ <span className="w-3.5 h-3.5 text-xs font-mono text-zinc-500 dark:text-zinc-400 flex items-center justify-center">
+ #
+ </span>
+ <span>Show task numbers</span>
+ {showTaskNumbers && (
+ <div className="ml-auto w-2 h-2 bg-indigo-500 rounded-full" />
+ )}
+ </button>
+ </div>
+ </PopoverContent>
+ </Popover>
+ </div>
+ </div>
</div>
</div>
- <div className="flex justify-end">
- <BoardFilters onFiltersChange={setFilters} />
+ <div className="flex-1 overflow-hidden bg-card h-full">
+ {filteredProject ? (
+ <BacklogListView project={filteredProject} />
+ ) : (
+ <div className="flex h-full items-center justify-center">
+ <div className="h-8 w-8 animate-spin rounded-full border-2 border-zinc-300 border-t-zinc-600 dark:border-zinc-700 dark:border-t-zinc-300" />
+ </div>
+ )}
</div>
- </div>
- <div className="flex-1 overflow-auto">
- {/* @ts-expect-error - TODO: fix this */}
- <BacklogListView project={backlogProject} />
+ <CreateTaskModal
+ open={isTaskModalOpen}
+ onClose={() => setIsTaskModalOpen(false)}
+ status="planned"
+ />
</div>
-
- <CreateTaskModal
- open={isTaskModalOpen}
- onClose={() => setIsTaskModalOpen(false)}
- status="planned"
- />
- </div>
+ </ProjectLayout>
);
}
diff --git a/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/board.tsx b/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/board.tsx
index 91e674e8f..d760ea16f 100644
--- a/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/board.tsx
+++ b/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/board.tsx
@@ -1,18 +1,39 @@
-import type { BoardFilters as BoardFiltersType } from "@/components/filters";
+import ProjectLayout from "@/components/common/project-layout";
import KanbanBoard from "@/components/kanban-board";
import ListView from "@/components/list-view";
-import NotificationBell from "@/components/notification/notification-bell";
import CreateTaskModal from "@/components/shared/modals/create-task-modal";
import { Button } from "@/components/ui/button";
-import { Input } from "@/components/ui/input";
+import { KbdSequence } from "@/components/ui/kbd";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/popover";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
+import { shortcuts } from "@/constants/shortcuts";
import useGetTasks from "@/hooks/queries/task/use-get-tasks";
+import useGetActiveWorkspaceUsers from "@/hooks/queries/workspace-users/use-active-workspace-users";
+import { useTaskFilters } from "@/hooks/use-task-filters";
import { cn } from "@/lib/cn";
import useProjectStore from "@/store/project";
import { useUserPreferencesStore } from "@/store/user-preferences";
-import type Task from "@/types/task";
import { createFileRoute } from "@tanstack/react-router";
-import { addWeeks, endOfWeek, isWithinInterval, startOfWeek } from "date-fns";
-import { Filter, LayoutGrid, List, Plus, Search, SortAsc } from "lucide-react";
+import {
+ Calendar,
+ Check,
+ Filter,
+ Flag,
+ LayoutGrid,
+ List,
+ Plus,
+ Settings,
+ User,
+} from "lucide-react";
import { useEffect, useState } from "react";
export const Route = createFileRoute(
@@ -22,19 +43,25 @@ export const Route = createFileRoute(
});
function RouteComponent() {
- const { projectId } = Route.useParams();
+ const { projectId, workspaceId } = Route.useParams();
const { data } = useGetTasks(projectId);
const { project, setProject } = useProjectStore();
const { viewMode } = useUserPreferencesStore();
const [isTaskModalOpen, setIsTaskModalOpen] = useState(false);
- const [filters, setFilters] = useState<BoardFiltersType>({
- search: "",
- assignee: null,
- priority: null,
- dueDate: null,
- sortBy: null,
- sortOrder: null,
- });
+
+ const { data: users } = useGetActiveWorkspaceUsers({ workspaceId });
+ const {
+ showAssignees,
+ showPriority,
+ showDueDates,
+ showLabels,
+ showTaskNumbers,
+ toggleAssignees,
+ togglePriority,
+ toggleDueDates,
+ toggleLabels,
+ toggleTaskNumbers,
+ } = useUserPreferencesStore();
useEffect(() => {
if (data) {
@@ -42,264 +69,439 @@ function RouteComponent() {
}
}, [data, setProject]);
- const handleSearchChange = (value: string) => {
- setFilters((prev) => ({
- ...prev,
- search: value,
- }));
- };
-
- const filterTasks = (tasks: Task[]): Task[] => {
- let filteredTasks = tasks
- .filter((task) => {
- if (
- filters.search &&
- !task.title.toLowerCase().includes(filters.search.toLowerCase())
- ) {
- return false;
- }
-
- if (filters.assignee && task.userEmail !== filters.assignee) {
- return false;
- }
-
- if (filters.priority && task.priority !== filters.priority) {
- return false;
- }
-
- if (filters.dueDate && task.dueDate) {
- const today = new Date();
- const taskDate = new Date(task.dueDate);
-
- switch (filters.dueDate) {
- case "Due this week": {
- const weekStart = startOfWeek(today);
- const weekEnd = endOfWeek(today);
- if (
- !isWithinInterval(taskDate, { start: weekStart, end: weekEnd })
- ) {
- return false;
- }
- break;
- }
- case "Due next week": {
- const nextWeekStart = startOfWeek(addWeeks(today, 1));
- const nextWeekEnd = endOfWeek(addWeeks(today, 1));
- if (
- !isWithinInterval(taskDate, {
- start: nextWeekStart,
- end: nextWeekEnd,
- })
- ) {
- return false;
- }
- break;
- }
- case "No due date": {
- return false;
- }
- }
- }
-
- return true;
- })
- .map((task) => ({
- ...task,
- assigneeEmail: task.userEmail ?? null,
- }));
-
- if (filters.sortBy && filters.sortOrder) {
- filteredTasks = filteredTasks.sort((a, b) => {
- const sortOrder = filters.sortOrder === "asc" ? 1 : -1;
-
- switch (filters.sortBy) {
- case "title":
- return sortOrder * a.title.localeCompare(b.title);
-
- case "priority": {
- const priorityOrder = { urgent: 0, high: 1, medium: 2, low: 3 };
- const aPriority = a.priority
- ? (priorityOrder[a.priority as keyof typeof priorityOrder] ?? 999)
- : 999;
- const bPriority = b.priority
- ? (priorityOrder[b.priority as keyof typeof priorityOrder] ?? 999)
- : 999;
- return sortOrder * (aPriority - bPriority);
- }
-
- case "dueDate": {
- if (!a.dueDate && !b.dueDate) return 0;
- if (!a.dueDate) return sortOrder;
- if (!b.dueDate) return -sortOrder;
-
- const aDate = new Date(a.dueDate).getTime();
- const bDate = new Date(b.dueDate).getTime();
- return sortOrder * (aDate - bDate);
- }
-
- case "createdAt": {
- const aDate = new Date(a.createdAt).getTime();
- const bDate = new Date(b.createdAt).getTime();
- return sortOrder * (aDate - bDate);
- }
-
- default:
- return 0;
- }
- });
- }
+ const {
+ filters,
+ updateFilter,
+ filteredProject,
+ hasActiveFilters,
+ clearFilters,
+ } = useTaskFilters(project);
- return filteredTasks;
- };
+ return (
+ <ProjectLayout
+ title={viewMode === "board" ? "Board" : "List"}
+ projectId={projectId}
+ workspaceId={workspaceId}
+ >
+ <div className="flex flex-col h-full min-h-0">
+ <div className="bg-card border-b border-border">
+ <div className="h-10 flex items-center px-4">
+ <div className="flex items-center justify-between w-full">
+ <div className="flex items-center gap-2">
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ size="xs"
+ onClick={() => setIsTaskModalOpen(true)}
+ className="h-6 px-2 text-xs text-zinc-600 dark:text-zinc-400"
+ >
+ <Plus className="h-3 w-3 mr-1" />
+ New task
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <KbdSequence
+ keys={[shortcuts.task.prefix, shortcuts.task.create]}
+ className="ml-auto"
+ />
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
- const filteredProject = project
- ? {
- ...project,
- columns:
- project.columns?.map((column) => ({
- id: column.id as "to-do" | "in-progress" | "in-review" | "done",
- name: column.name as "To Do" | "In Progress" | "In Review" | "Done",
- tasks: filterTasks(column.tasks).map((task) => ({
- id: task.id,
- title: task.title,
- status: task.status,
- dueDate: task.dueDate,
- priority: task.priority,
- position: task.position,
- createdAt: task.createdAt,
- userEmail: task.userEmail,
- number: task.number,
- description: task.description ?? null,
- assigneeEmail: task.userEmail ?? null,
- projectId: task.projectId,
- assigneeName: task.assigneeName ?? null,
- })),
- })) ?? [],
- }
- : null;
+ <Popover>
+ <PopoverTrigger asChild>
+ <Button
+ variant="ghost"
+ size="sm"
+ className={cn(
+ "h-6 px-2 text-xs",
+ hasActiveFilters
+ ? "text-indigo-600 dark:text-indigo-400 bg-indigo-50 dark:bg-indigo-500/10"
+ : "text-zinc-600 dark:text-zinc-400",
+ )}
+ >
+ <Filter className="h-3 w-3 mr-1" />
+ Filter
+ {hasActiveFilters && (
+ <span className="ml-1 bg-indigo-500 text-white text-xs rounded-full w-4 h-4 flex items-center justify-center">
+ {
+ Object.values(filters).filter((f) => f !== null)
+ .length
+ }
+ </span>
+ )}
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent className="w-72 p-0" align="start">
+ <div className="p-3 border-b border-zinc-200 dark:border-zinc-800">
+ <div className="flex items-center justify-between">
+ <h3 className="text-sm font-medium text-zinc-900 dark:text-zinc-100">
+ Filters
+ </h3>
+ {hasActiveFilters && (
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={clearFilters}
+ className="h-6 px-2 text-xs text-zinc-500 hover:text-zinc-700"
+ >
+ Clear all
+ </Button>
+ )}
+ </div>
+ </div>
- return (
- <div className="flex flex-col h-full">
- <div className="bg-white dark:bg-black border-b border-zinc-200 dark:border-zinc-800">
- <div className="h-14 flex items-center px-3">
- <div className="flex items-center justify-between w-full">
- <div className="flex items-center gap-2">
- <Button
- variant="ghost"
- size="sm"
- onClick={() => {
- setIsTaskModalOpen(true);
- }}
- className="h-7 px-2 text-xs text-zinc-700 dark:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800"
- >
- <Plus className="h-3.5 w-3.5 mr-1.5" />
- New
- </Button>
+ <div className="p-1 space-y-1">
+ <Popover>
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ className="w-full flex items-center justify-between px-2 py-1.5 text-xs text-left text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800 rounded-md transition-colors"
+ >
+ <div className="flex items-center gap-2">
+ <div className="w-2 h-2 border border-zinc-400 rounded-full" />
+ <span>Status</span>
+ </div>
+ {filters.status && (
+ <div className="flex items-center gap-1">
+ <span className="text-xs bg-zinc-100 dark:bg-zinc-800 px-1.5 py-0.5 rounded capitalize">
+ {filters.status.replace("-", " ")}
+ </span>
+ </div>
+ )}
+ </button>
+ </PopoverTrigger>
+ <PopoverContent
+ className="w-48 p-1"
+ align="start"
+ side="right"
+ >
+ {project?.columns?.map((column) => (
+ <button
+ key={column.id}
+ type="button"
+ onClick={() => updateFilter("status", column.id)}
+ className={cn(
+ "w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left rounded-md transition-colors",
+ filters.status === column.id
+ ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
+ : "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
+ )}
+ >
+ <span>{column.name}</span>
+ {filters.status === column.id && (
+ <Check className="h-3 w-3 ml-auto" />
+ )}
+ </button>
+ ))}
+ </PopoverContent>
+ </Popover>
- <div className="relative hidden sm:block">
- <Search className="absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-zinc-500 dark:text-zinc-400" />
- <Input
- value={filters.search}
- onChange={(e) => handleSearchChange(e.target.value)}
- placeholder="Search tasks..."
- className="h-7 w-[240px] pl-8 pr-3 text-xs bg-transparent border-zinc-200 dark:border-zinc-800"
- />
- </div>
- </div>
+ <Popover>
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ className="w-full flex items-center justify-between px-2 py-1.5 text-xs text-left text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800 rounded-md transition-colors"
+ >
+ <div className="flex items-center gap-2">
+ <Flag className="w-3 h-3" />
+ <span>Priority</span>
+ </div>
+ {filters.priority && (
+ <div className="flex items-center gap-1">
+ <span className="text-xs bg-zinc-100 dark:bg-zinc-800 px-1.5 py-0.5 rounded capitalize">
+ {filters.priority}
+ </span>
+ </div>
+ )}
+ </button>
+ </PopoverTrigger>
+ <PopoverContent
+ className="w-48 p-1"
+ align="start"
+ side="right"
+ >
+ {["urgent", "high", "medium", "low"].map(
+ (priority) => (
+ <button
+ key={priority}
+ type="button"
+ onClick={() =>
+ updateFilter("priority", priority)
+ }
+ className={cn(
+ "w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left rounded-md transition-colors",
+ filters.priority === priority
+ ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
+ : "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
+ )}
+ >
+ <Flag
+ className={cn(
+ "w-3 h-3",
+ priority === "urgent" && "text-red-500",
+ priority === "high" && "text-orange-500",
+ priority === "medium" && "text-yellow-500",
+ priority === "low" && "text-green-500",
+ )}
+ />
+ <span className="capitalize">{priority}</span>
+ {filters.priority === priority && (
+ <Check className="h-3 w-3 ml-auto" />
+ )}
+ </button>
+ ),
+ )}
+ </PopoverContent>
+ </Popover>
- <div className="flex items-center gap-2">
- <div className="flex items-center">
- <Button
- variant="ghost"
- size="sm"
- className={cn(
- "h-7 px-2 text-xs",
- filters.assignee || filters.priority || filters.dueDate
- ? "text-indigo-600 dark:text-indigo-400"
- : "text-zinc-600 dark:text-zinc-400",
- )}
- >
- <Filter className="h-3.5 w-3.5 mr-1.5" />
- <span className="hidden sm:inline">Filter</span>
- </Button>
+ <Popover>
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ className="w-full flex items-center justify-between px-2 py-1.5 text-xs text-left text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800 rounded-md transition-colors"
+ >
+ <div className="flex items-center gap-2">
+ <User className="w-3 h-3" />
+ <span>Assignee</span>
+ </div>
+ {filters.assignee && (
+ <div className="flex items-center gap-1">
+ <span className="text-xs bg-zinc-100 dark:bg-zinc-800 px-1.5 py-0.5 rounded">
+ {users?.find(
+ (u) => u.userEmail === filters.assignee,
+ )?.userName || "Unknown"}
+ </span>
+ </div>
+ )}
+ </button>
+ </PopoverTrigger>
+ <PopoverContent
+ className="w-48 p-1"
+ align="start"
+ side="right"
+ >
+ {users?.map((user) => (
+ <button
+ key={user.userEmail}
+ type="button"
+ onClick={() =>
+ updateFilter("assignee", user.userEmail)
+ }
+ className={cn(
+ "w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left rounded-md transition-colors",
+ filters.assignee === user.userEmail
+ ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
+ : "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
+ )}
+ >
+ <div className="w-5 h-5 bg-zinc-400 rounded-full flex items-center justify-center text-white text-xs font-bold">
+ {user.userName?.charAt(0).toUpperCase()}
+ </div>
+ <span>{user.userName}</span>
+ {filters.assignee === user.userEmail && (
+ <Check className="h-3 w-3 ml-auto" />
+ )}
+ </button>
+ ))}
+ </PopoverContent>
+ </Popover>
- <Button
- variant="ghost"
- size="sm"
- className={cn(
- "h-7 px-2 text-xs",
- filters.sortBy
- ? "text-indigo-600 dark:text-indigo-400"
- : "text-zinc-600 dark:text-zinc-400",
- )}
- >
- <SortAsc className="h-3.5 w-3.5 mr-1.5" />
- <span className="hidden sm:inline">Sort</span>
- </Button>
- </div>
+ <Popover>
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ className="w-full flex items-center justify-between px-2 py-1.5 text-xs text-left text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800 rounded-md transition-colors"
+ >
+ <div className="flex items-center gap-2">
+ <Calendar className="w-3 h-3" />
+ <span>Due date</span>
+ </div>
+ {filters.dueDate && (
+ <div className="flex items-center gap-1">
+ <span className="text-xs bg-zinc-100 dark:bg-zinc-800 px-1.5 py-0.5 rounded">
+ {filters.dueDate}
+ </span>
+ </div>
+ )}
+ </button>
+ </PopoverTrigger>
+ <PopoverContent
+ className="w-48 p-1"
+ align="start"
+ side="right"
+ >
+ {[
+ "Due this week",
+ "Due next week",
+ "No due date",
+ ].map((option) => (
+ <button
+ key={option}
+ type="button"
+ onClick={() => updateFilter("dueDate", option)}
+ className={cn(
+ "w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left rounded-md transition-colors",
+ filters.dueDate === option
+ ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
+ : "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
+ )}
+ >
+ <Calendar className="w-3 h-3" />
+ <span>{option}</span>
+ {filters.dueDate === option && (
+ <Check className="h-3 w-3 ml-auto" />
+ )}
+ </button>
+ ))}
+ </PopoverContent>
+ </Popover>
+ </div>
+ </PopoverContent>
+ </Popover>
- <div className="border-l border-zinc-200 dark:border-zinc-800 h-4 mx-1 hidden sm:block" />
+ <Popover>
+ <PopoverTrigger asChild>
+ <Button
+ variant="ghost"
+ size="sm"
+ className="h-6 px-2 text-xs text-zinc-600 dark:text-zinc-400"
+ >
+ <Settings className="h-3 w-3 mr-1" />
+ Display
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent className="w-56 p-0" align="start">
+ <div className="py-2">
+ <div className="px-2 py-1.5 text-xs font-medium text-zinc-500 dark:text-zinc-400">
+ Layout
+ </div>
+ <button
+ type="button"
+ onClick={() => {
+ useUserPreferencesStore.setState({
+ viewMode: "board",
+ });
+ }}
+ className={cn(
+ "w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left transition-colors",
+ viewMode === "board"
+ ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
+ : "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
+ )}
+ >
+ <LayoutGrid className="w-3.5 h-3.5" />
+ <span>Board</span>
+ </button>
+ <button
+ type="button"
+ onClick={() => {
+ useUserPreferencesStore.setState({
+ viewMode: "list",
+ });
+ }}
+ className={cn(
+ "w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left transition-colors",
+ viewMode === "list"
+ ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
+ : "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
+ )}
+ >
+ <List className="w-3.5 h-3.5" />
+ <span>List</span>
+ </button>
- <div className="flex items-center">
- <Button
- variant={viewMode === "board" ? "secondary" : "ghost"}
- size="sm"
- className="h-7 px-1.5"
- onClick={() => {
- useUserPreferencesStore.setState({ viewMode: "board" });
- }}
- >
- <LayoutGrid className="h-3.5 w-3.5" />
- </Button>
+ <div className="h-px bg-zinc-200 dark:bg-zinc-800 my-2" />
- <Button
- variant={viewMode === "list" ? "secondary" : "ghost"}
- size="sm"
- className="h-7 px-1.5"
- onClick={() => {
- useUserPreferencesStore.setState({ viewMode: "list" });
- }}
- >
- <List className="h-3.5 w-3.5" />
- </Button>
+ <div className="px-2 py-1.5 text-xs font-medium text-zinc-500 dark:text-zinc-400">
+ Show Elements
+ </div>
+ <button
+ type="button"
+ onClick={toggleAssignees}
+ className="w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left transition-colors text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800"
+ >
+ <User className="w-3.5 h-3.5" />
+ <span>Show assignee</span>
+ {showAssignees && (
+ <div className="ml-auto w-2 h-2 bg-indigo-500 rounded-full" />
+ )}
+ </button>
+ <button
+ type="button"
+ onClick={togglePriority}
+ className="w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left transition-colors text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800"
+ >
+ <Flag className="w-3.5 h-3.5" />
+ <span>Show priority</span>
+ {showPriority && (
+ <div className="ml-auto w-2 h-2 bg-indigo-500 rounded-full" />
+ )}
+ </button>
+ <button
+ type="button"
+ onClick={toggleDueDates}
+ className="w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left transition-colors text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800"
+ >
+ <Calendar className="w-3.5 h-3.5" />
+ <span>Show due date</span>
+ {showDueDates && (
+ <div className="ml-auto w-2 h-2 bg-indigo-500 rounded-full" />
+ )}
+ </button>
+ <button
+ type="button"
+ onClick={toggleLabels}
+ className="w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left transition-colors text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800"
+ >
+ <span className="w-3.5 h-3.5 bg-zinc-300 dark:bg-zinc-600 rounded-sm" />
+ <span>Show labels</span>
+ {showLabels && (
+ <div className="ml-auto w-2 h-2 bg-indigo-500 rounded-full" />
+ )}
+ </button>
+ <button
+ type="button"
+ onClick={toggleTaskNumbers}
+ className="w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left transition-colors text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800"
+ >
+ <span className="w-3.5 h-3.5 text-xs font-mono text-zinc-500 dark:text-zinc-400 flex items-center justify-center">
+ #
+ </span>
+ <span>Show task numbers</span>
+ {showTaskNumbers && (
+ <div className="ml-auto w-2 h-2 bg-indigo-500 rounded-full" />
+ )}
+ </button>
+ </div>
+ </PopoverContent>
+ </Popover>
</div>
-
- <NotificationBell />
</div>
</div>
</div>
- <div className="sm:hidden px-3 py-2">
- <div className="relative">
- <Search className="absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-zinc-500 dark:text-zinc-400" />
- <Input
- value={filters.search}
- onChange={(e) => handleSearchChange(e.target.value)}
- placeholder="Search tasks..."
- className="h-8 w-full pl-8 pr-3 text-xs bg-transparent border-zinc-200 dark:border-zinc-800"
- />
- </div>
+ <div className="flex-1 overflow-hidden bg-card h-full">
+ {filteredProject ? (
+ viewMode === "board" ? (
+ <KanbanBoard project={filteredProject} />
+ ) : (
+ <ListView project={filteredProject} />
+ )
+ ) : (
+ <div className="flex h-full items-center justify-center">
+ <div className="h-8 w-8 animate-spin rounded-full border-2 border-zinc-300 border-t-zinc-600 dark:border-zinc-700 dark:border-t-zinc-300" />
+ </div>
+ )}
</div>
- </div>
- <div className="flex-1 overflow-hidden bg-black/[0.03] dark:bg-black/30">
- {filteredProject ? (
- viewMode === "board" ? (
- <KanbanBoard project={filteredProject} />
- ) : (
- <ListView project={filteredProject} />
- )
- ) : (
- <div className="flex h-full items-center justify-center">
- <div className="h-8 w-8 animate-spin rounded-full border-2 border-zinc-300 border-t-zinc-600 dark:border-zinc-700 dark:border-t-zinc-300" />
- </div>
- )}
+ <CreateTaskModal
+ open={isTaskModalOpen}
+ onClose={() => setIsTaskModalOpen(false)}
+ />
</div>
-
- <CreateTaskModal
- open={isTaskModalOpen}
- onClose={() => setIsTaskModalOpen(false)}
- />
- </div>
+ </ProjectLayout>
);
}
diff --git a/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/index.tsx b/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/index.tsx
new file mode 100644
index 000000000..68d176d0b
--- /dev/null
+++ b/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/index.tsx
@@ -0,0 +1,22 @@
+import ProjectLayout from "@/components/common/project-layout";
+import { Outlet, createFileRoute } from "@tanstack/react-router";
+
+export const Route = createFileRoute(
+ "/dashboard/workspace/$workspaceId/project/$projectId/",
+)({
+ component: RouteComponent,
+});
+
+function RouteComponent() {
+ const { workspaceId, projectId } = Route.useParams();
+
+ return (
+ <ProjectLayout
+ title="Project"
+ projectId={projectId}
+ workspaceId={workspaceId}
+ >
+ <Outlet />
+ </ProjectLayout>
+ );
+}
diff --git a/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/settings.tsx b/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/settings.tsx
index 348270038..707c6937b 100644
--- a/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/settings.tsx
+++ b/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/settings.tsx
@@ -1,6 +1,10 @@
-import PageTitle from "@/components/page-title";
import { GitHubIntegrationSettings } from "@/components/project/github-integration-settings";
import { TasksImportExport } from "@/components/project/tasks-import-export";
+import {
+ DangerZoneSection,
+ SettingsLayout,
+ SettingsSection,
+} from "@/components/settings-layout";
import { Button } from "@/components/ui/button";
import {
Form,
@@ -12,6 +16,11 @@ import {
FormMessage,
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/popover";
import { Switch } from "@/components/ui/switch";
import icons from "@/constants/project-icons";
import useDeleteProject from "@/hooks/mutations/project/use-delete-project";
@@ -23,13 +32,18 @@ import useProjectStore from "@/store/project";
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
import { useQueryClient } from "@tanstack/react-query";
import { createFileRoute, useNavigate } from "@tanstack/react-router";
+import { motion } from "framer-motion";
import {
AlertCircle,
AlertTriangle,
- ArrowLeft,
Check,
Copy,
+ Download,
+ Github,
+ Globe,
+ Key,
Lock,
+ Trash2,
} from "lucide-react";
import { createElement, useCallback, useEffect, useState } from "react";
import { useForm } from "react-hook-form";
@@ -58,6 +72,7 @@ function ProjectSettings() {
const { isOwner } = useWorkspacePermission();
const [confirmProjectName, setConfirmProjectName] = useState("");
const [copied, setCopied] = useState(false);
+ const [iconPopoverOpen, setIconPopoverOpen] = useState(false);
const { mutateAsync: updateProject, isPending } = useUpdateProject();
const { mutateAsync: deleteProject, isPending: isDeleting } =
useDeleteProject();
@@ -192,38 +207,22 @@ function ProjectSettings() {
if (!isOwner) {
return (
- <div className="flex-1 p-6">
- <PageTitle title="Project Settings" />
- <div className="mt-6 max-w-2xl mx-auto">
- <div className="bg-white dark:bg-zinc-800/50 rounded-lg p-8 shadow-sm border border-zinc-200 dark:border-zinc-700/50 text-center">
- <div className="flex justify-center mb-4">
- <div className="w-16 h-16 rounded-full bg-amber-100 dark:bg-amber-900/30 flex items-center justify-center">
- <Lock className="w-8 h-8 text-amber-600 dark:text-amber-400" />
- </div>
- </div>
- <h2 className="text-xl font-semibold text-zinc-900 dark:text-zinc-100 mb-2">
- Permission Required
- </h2>
- <p className="text-zinc-500 dark:text-zinc-400 mb-6 max-w-md mx-auto">
+ <div className="max-w-4xl mx-auto space-y-8 py-6">
+ <div className="space-y-1">
+ <p className="text-sm text-muted-foreground">
+ Manage your project configuration and settings
+ </p>
+ </div>
+ <div className="flex flex-col items-center justify-center py-24">
+ <div className="flex h-20 w-20 items-center justify-center rounded-full border border-amber-200 bg-amber-50 dark:border-amber-800/50 dark:bg-amber-900/20">
+ <Lock className="h-8 w-8 text-amber-600 dark:text-amber-500" />
+ </div>
+ <div className="mt-6 text-center">
+ <h2 className="text-xl font-semibold">Permission Required</h2>
+ <p className="mt-2 text-sm text-muted-foreground max-w-md">
Only workspace owners can modify project settings. Please contact
the workspace owner if you need to make changes.
</p>
- <Button
- variant="outline"
- onClick={() =>
- navigate({
- to: "/dashboard/workspace/$workspaceId/project/$projectId/board",
- params: {
- workspaceId: project?.workspaceId ?? "",
- projectId: project?.id ?? "",
- },
- })
- }
- className="gap-2"
- >
- <ArrowLeft className="w-4 h-4" />
- Back to Project
- </Button>
</div>
</div>
</div>
@@ -231,298 +230,300 @@ function ProjectSettings() {
}
return (
- <>
- <PageTitle title="Project Settings" />
- <div className="h-full flex flex-col bg-white dark:bg-zinc-900 overflow-hidden">
- <header className="sticky top-0 z-10 flex items-center px-4 h-[65px] bg-white dark:bg-zinc-900 border-b border-zinc-200 dark:border-zinc-800">
- <div className="flex items-center gap-2 flex-1 min-w-0">
- <h1 className="text-lg font-semibold text-zinc-900 dark:text-zinc-100">
- Project Settings
- </h1>
- {isDirty && (
- <div className="flex items-center gap-1.5 px-2 py-1 bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300 rounded text-xs font-medium">
- <AlertCircle className="w-3 h-3" />
- Unsaved changes
- </div>
- )}
- </div>
- </header>
-
- <div className="flex-1 overflow-y-auto p-4 md:p-8">
- <div className="max-w-4xl mx-auto space-y-6 md:space-y-8">
- <div className="bg-white dark:bg-zinc-900 rounded-lg border border-zinc-200 dark:border-zinc-800">
- <div className="p-4 md:p-6">
- <h2 className="text-sm font-medium text-zinc-900 dark:text-zinc-100 mb-1">
- General Settings
- </h2>
- <p className="text-sm text-zinc-500 dark:text-zinc-400 mb-4">
- Basic project information and settings.
- </p>
-
- {project ? (
- <Form {...form}>
- <form
- onSubmit={form.handleSubmit(onSubmit)}
- className="space-y-6"
- >
- <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
- <FormField
- control={form.control}
- name="name"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Project Name</FormLabel>
- <FormControl>
- <Input
- {...field}
- className="bg-white dark:bg-zinc-800/50"
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
-
- <FormField
- control={form.control}
- name="slug"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Project Slug</FormLabel>
- <FormControl>
- <Input
- {...field}
- className="bg-white dark:bg-zinc-800/50 font-mono"
- maxLength={5}
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- </div>
- <div className="grid grid-cols-1 gap-4">
- <FormField
- control={form.control}
- name="isPublic"
- render={({ field }) => (
- <FormItem className="space-y-4">
- <div className="flex items-center justify-between">
- <div className="space-y-1">
- <FormLabel className="text-base">
- Public Project
- </FormLabel>
- <FormDescription>
- Make the project visible to everyone on the
- web.
- </FormDescription>
+ <SettingsLayout
+ title="Project"
+ description="Configure your project settings and details"
+ className="pt-4 px-6 overflow-auto"
+ >
+ <div className="max-w-4xl mx-auto space-y-8">
+ {isDirty && (
+ <motion.div
+ initial={{ opacity: 0, y: -10 }}
+ animate={{ opacity: 1, y: 0 }}
+ className="rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-800/50 dark:bg-amber-900/20"
+ >
+ <div className="flex items-center gap-2">
+ <AlertCircle className="h-4 w-4 text-amber-600 dark:text-amber-500" />
+ <span className="text-sm font-medium text-amber-800 dark:text-amber-200">
+ You have unsaved changes
+ </span>
+ </div>
+ </motion.div>
+ )}
+
+ {project && (
+ <SettingsSection
+ title="General"
+ description="Basic project information and configuration"
+ >
+ <Form {...form}>
+ <form
+ onSubmit={form.handleSubmit(onSubmit)}
+ className="space-y-8"
+ >
+ <FormField
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <FormItem className="flex flex-col gap-2">
+ <FormLabel className="text-base font-medium">
+ Project Name
+ </FormLabel>
+ <FormControl>
+ <Input {...field} placeholder="Enter project name" />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+
+ <div className="space-y-6">
+ <FormField
+ control={form.control}
+ name="icon"
+ render={({ field }) => (
+ <FormItem className="flex flex-col gap-2">
+ <FormLabel className="text-base font-medium">
+ Project Icon
+ </FormLabel>
+ <div className="flex items-center gap-4">
+ <Popover
+ open={iconPopoverOpen}
+ onOpenChange={setIconPopoverOpen}
+ >
+ <PopoverTrigger asChild>
+ <Button
+ variant="outline"
+ size="sm"
+ className="h-10 w-10 p-0"
+ >
+ {createElement(
+ icons[field.value as keyof typeof icons],
+ {
+ className: "h-4 w-4",
+ },
+ )}
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent className="w-80 p-2" align="start">
+ <div className="max-h-[300px] overflow-y-auto">
+ <div className="grid grid-cols-8 gap-2">
+ {Object.entries(icons).map(
+ ([iconName, Icon]) => (
+ <Button
+ key={iconName}
+ variant="ghost"
+ size="sm"
+ className={cn(
+ "h-10 w-10 p-0",
+ field.value === iconName &&
+ "bg-accent",
+ )}
+ onClick={() => {
+ field.onChange(iconName);
+ setIconPopoverOpen(false);
+ }}
+ >
+ <Icon className="h-4 w-4" />
+ </Button>
+ ),
+ )}
</div>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- className="data-[state=checked]:bg-indigo-500 data-[state=unchecked]:bg-zinc-200 dark:data-[state=unchecked]:bg-zinc-700"
- />
- </FormControl>
</div>
- <FormMessage />
- {field.value && (
- <div className="mt-4 p-4 bg-indigo-50 dark:bg-indigo-950/50 rounded-lg border border-indigo-200 dark:border-indigo-800/50">
- <p className="text-sm font-medium text-indigo-900 dark:text-indigo-100 mb-2">
- Public URL
- </p>
- <div className="flex gap-2">
- <Input
- value={`${window.location.origin}/public-project/${project?.id}`}
- readOnly
- className="bg-white dark:bg-zinc-800/50 font-mono text-sm flex-1"
- />
- <Button
- type="button"
- variant="outline"
- size="sm"
- onClick={handleCopyUrl}
- className="px-3 min-w-[80px]"
- >
- {copied ? (
- <>
- <Check className="w-4 h-4 mr-1" />
- Copied
- </>
- ) : (
- <>
- <Copy className="w-4 h-4 mr-1" />
- Copy
- </>
- )}
- </Button>
- </div>
- <p className="text-xs text-indigo-700 dark:text-indigo-300 mt-2">
- Anyone with this link can view your
- project's tasks.
- </p>
- </div>
- )}
- </FormItem>
- )}
- />
- </div>
-
- <FormField
- control={form.control}
- name="icon"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Project Icon</FormLabel>
+ </PopoverContent>
+ </Popover>
+ <div className="flex-1 space-y-1">
+ <p className="text-xs text-muted-foreground">
+ Choose an icon to represent your project
+ </p>
+ </div>
+ </div>
+ </FormItem>
+ )}
+ />
+
+ <FormField
+ control={form.control}
+ name="slug"
+ render={({ field }) => (
+ <FormItem className="flex flex-col gap-2">
+ <FormLabel className="text-base font-medium">
+ Project Key
+ </FormLabel>
+ <div className="rounded-lg border bg-card p-4">
+ <div className="flex items-center gap-3">
+ <Key className="h-4 w-4 text-muted-foreground" />
<FormControl>
- <div className="relative">
- <div className="grid grid-cols-4 sm:grid-cols-6 md:grid-cols-8 gap-2 max-h-[240px] overflow-y-auto p-2 rounded-lg border border-zinc-200 dark:border-zinc-700/50">
- {Object.entries(icons).map(([name, Icon]) => (
- <button
- key={name}
- type="button"
- onClick={() => field.onChange(name)}
- className={cn(
- "p-3 sm:p-2 rounded-lg transition-colors flex items-center justify-center group",
- field.value === name
- ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
- : "text-zinc-600 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
- )}
- title={name}
- >
- <Icon className="w-6 h-6 sm:w-5 sm:h-5" />
- </button>
- ))}
- </div>
- <div className="absolute left-0 right-0 bottom-0 h-8 bg-gradient-to-t from-white dark:from-zinc-900 to-transparent pointer-events-none" />
- </div>
+ <Input
+ {...field}
+ placeholder="PROJ"
+ className="w-20 border-0 bg-transparent p-0 text-center font-mono text-sm font-semibold uppercase shadow-none focus-visible:ring-0"
+ maxLength={5}
+ onChange={(e) =>
+ field.onChange(e.target.value.toUpperCase())
+ }
+ />
</FormControl>
- <div className="flex items-center gap-2 mt-2 px-2">
- {createElement(
- icons[field.value as keyof typeof icons],
- {
- className: "w-4 h-4 text-zinc-400",
- },
- )}
- <span className="text-sm text-zinc-500 dark:text-zinc-400">
- {field.value}
- </span>
+ <div className="flex-1 text-xs text-muted-foreground">
+ Used for task IDs (e.g., {field.value || "ABC"}
+ -123)
</div>
- <FormMessage />
- </FormItem>
- )}
- />
-
- <Button type="submit" disabled={isPending}>
- {isPending ? "Saving..." : "Save Changes"}
- </Button>
-
- {isDirty && (
- <div className="flex items-center gap-2 text-sm text-amber-600 dark:text-amber-400">
- <AlertCircle className="w-4 h-4" />
- <span>You have unsaved changes</span>
+ </div>
</div>
- )}
- </form>
- </Form>
- ) : (
- <div className="text-sm text-zinc-500 dark:text-zinc-400">
- Select a project to view its settings
- </div>
- )}
- </div>
- </div>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
- {project && (
- <div className="bg-white dark:bg-zinc-900 rounded-lg border border-zinc-200 dark:border-zinc-800">
- <div className="p-4 md:p-6">
- <h2 className="text-sm font-medium text-zinc-900 dark:text-zinc-100 mb-1">
- Tasks Export & Import
- </h2>
- <p className="text-sm text-zinc-500 dark:text-zinc-400 mb-4">
- Export tasks to a JSON file or import tasks from a JSON
- file.
- </p>
-
- <TasksImportExport project={project} />
+ <FormField
+ control={form.control}
+ name="isPublic"
+ render={({ field }) => (
+ <FormItem className="flex flex-col gap-2">
+ <div className="rounded-lg border bg-card p-4">
+ <div className="flex items-center justify-between">
+ <div className="space-y-0.5">
+ <div className="flex items-center gap-2">
+ <Globe className="h-4 w-4 text-muted-foreground" />
+ <FormLabel className="text-base font-medium">
+ Public Project
+ </FormLabel>
+ </div>
+ <FormDescription>
+ Make the project visible to everyone on the web
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </div>
+ {field.value && (
+ <motion.div
+ initial={{ opacity: 0, height: 0 }}
+ animate={{ opacity: 1, height: "auto" }}
+ className="mt-4 space-y-3 rounded-md border bg-muted/20 p-3"
+ >
+ <p className="text-sm font-medium">Public URL</p>
+ <div className="flex gap-2">
+ <Input
+ value={`${window.location.origin}/public-project/${project?.id}`}
+ readOnly
+ className="flex-1 font-mono text-xs"
+ />
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ onClick={handleCopyUrl}
+ >
+ {copied ? (
+ <>
+ <Check className="mr-1 h-3 w-3" />
+ Copied
+ </>
+ ) : (
+ <>
+ <Copy className="mr-1 h-3 w-3" />
+ Copy
+ </>
+ )}
+ </Button>
+ </div>
+ </motion.div>
+ )}
+ </div>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+
+ <div className="flex justify-end">
+ <Button type="submit" disabled={isPending || !isDirty}>
+ {isPending ? "Saving..." : "Save Changes"}
+ </Button>
</div>
- </div>
- )}
-
- {project && (
- <div className="bg-white dark:bg-zinc-900 rounded-lg border border-zinc-200 dark:border-zinc-800">
- <div className="p-4 md:p-6">
- <h2 className="text-sm font-medium text-zinc-900 dark:text-zinc-100 mb-1">
- GitHub Integration
- </h2>
- <p className="text-sm text-zinc-500 dark:text-zinc-400 mb-4">
- Configure GitHub integration for your project.
- </p>
-
- <GitHubIntegrationSettings projectId={project.id} />
+ </form>
+ </Form>
+ </SettingsSection>
+ )}
+
+ {project && (
+ <SettingsSection
+ title="Export & Import"
+ description="Export tasks to a JSON file or import tasks from a JSON file"
+ icon={<Download className="w-4 h-4" />}
+ >
+ <TasksImportExport project={project} />
+ </SettingsSection>
+ )}
+
+ {project && (
+ <SettingsSection
+ title="GitHub Integration"
+ description="Configure GitHub integration for your project"
+ icon={<Github className="w-4 h-4" />}
+ >
+ <GitHubIntegrationSettings projectId={project.id} />
+ </SettingsSection>
+ )}
+
+ {project && (
+ <DangerZoneSection
+ title="Danger Zone"
+ description="Permanently delete your project. This action cannot be undone."
+ >
+ <div className="space-y-4">
+ <div className="rounded-md border border-destructive/20 bg-destructive/10 p-4">
+ <div className="flex items-start gap-3">
+ <AlertTriangle className="mt-0.5 h-4 w-4 text-destructive" />
+ <div className="space-y-1">
+ <p className="text-sm font-medium">
+ This action cannot be undone
+ </p>
+ <ul className="space-y-1 text-xs text-muted-foreground">
+ <li>• All tasks will be permanently deleted</li>
+ <li>• All task history will be removed</li>
+ <li>• Project settings will be erased</li>
+ </ul>
+ </div>
</div>
</div>
- )}
-
- {project && (
- <div className="bg-white dark:bg-zinc-900 rounded-lg border border-zinc-200 dark:border-zinc-800">
- <div className="p-4 md:p-6">
- <h2 className="text-base font-medium text-red-600 dark:text-red-400 mb-1">
- Danger Zone
- </h2>
- <p className="text-sm text-zinc-500 dark:text-zinc-400 mb-6">
- Permanently delete your project. This action cannot be
- undone.
- </p>
-
- <div className="space-y-4">
- <div className="p-4 bg-red-500/5 border border-red-200 dark:border-red-500/10 rounded-lg">
- <div className="flex items-center gap-3 text-red-600 dark:text-red-400 mb-3">
- <AlertTriangle className="w-5 h-5" />
- <p className="font-medium">
- Warning: This action cannot be undone
- </p>
- </div>
- <ul className="list-disc list-inside space-y-1 text-sm text-red-600/90 dark:text-red-400/90">
- <li>All tasks will be permanently deleted</li>
- <li>All task history will be removed</li>
- <li>Project settings will be erased</li>
- </ul>
- </div>
-
- <div>
- <label
- htmlFor="confirm-project-name"
- className="block text-sm font-medium text-zinc-900 dark:text-zinc-100 mb-1.5"
- >
- Type "{project.name}" to confirm deletion
- </label>
- <div className="flex gap-3">
- <Input
- value={confirmProjectName}
- onChange={(e) =>
- setConfirmProjectName(e.target.value)
- }
- placeholder={project.name}
- className="bg-white dark:bg-zinc-800/50"
- />
- <Button
- onClick={handleDeleteProject}
- disabled={confirmProjectName !== project.name}
- className="bg-red-600 text-white hover:bg-red-500 dark:bg-red-500 dark:hover:bg-red-400 disabled:opacity-50"
- >
- {isDeleting ? "Deleting..." : "Delete Project"}
- </Button>
- </div>
- </div>
- </div>
+
+ <div className="space-y-3">
+ <div>
+ <label
+ htmlFor="confirm-deletion"
+ className="text-sm font-medium"
+ >
+ Type "{project.name}" to confirm deletion
+ </label>
+ <Input
+ id="confirm-deletion"
+ value={confirmProjectName}
+ onChange={(e) => setConfirmProjectName(e.target.value)}
+ placeholder={project.name}
+ className="mt-1"
+ />
</div>
+ <Button
+ onClick={handleDeleteProject}
+ disabled={confirmProjectName !== project.name || isDeleting}
+ variant="destructive"
+ className="w-full gap-2"
+ >
+ <Trash2 className="h-4 w-4" />
+ {isDeleting ? "Deleting..." : "Delete Project"}
+ </Button>
</div>
- )}
- </div>
- </div>
+ </div>
+ </DangerZoneSection>
+ )}
</div>
- </>
+ </SettingsLayout>
);
}
diff --git a/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId.tsx b/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_.tsx
similarity index 91%
rename from apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId.tsx
rename to apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_.tsx
index 543404321..f90ca8d67 100644
--- a/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId.tsx
+++ b/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_.tsx
@@ -1,3 +1,4 @@
+import ProjectLayout from "@/components/common/project-layout";
import PageTitle from "@/components/page-title";
import TaskActivities from "@/components/task/task-activities";
import TaskComment from "@/components/task/task-comment";
@@ -14,13 +15,13 @@ import { LayoutGrid, X } from "lucide-react";
import { useEffect, useState } from "react";
export const Route = createFileRoute(
- "/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId",
+ "/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_",
)({
component: TaskEditPage,
});
function TaskEditPage() {
- const { taskId, projectId } = Route.useParams();
+ const { taskId, projectId, workspaceId } = Route.useParams();
const { data: project } = useGetTasks(projectId);
const { data: task, isLoading } = useGetTask(taskId);
const { setProject } = useProjectStore();
@@ -44,7 +45,11 @@ function TaskEditPage() {
}
return (
- <>
+ <ProjectLayout
+ title={`${project?.slug}-${task?.number}`}
+ projectId={projectId}
+ workspaceId={workspaceId}
+ >
<PageTitle
title={`${project?.slug}-${task?.number} · ${task?.title || "Task"}`}
hideAppName
@@ -52,9 +57,9 @@ function TaskEditPage() {
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
- className="h-full flex flex-col bg-white dark:bg-zinc-900 overflow-hidden"
+ className="h-full flex flex-col bg-card overflow-hidden"
>
- <header className="sticky top-0 z-10 flex items-center px-4 h-[65px] bg-white dark:bg-zinc-900 border-b border-zinc-200 dark:border-zinc-800">
+ <header className="sticky top-0 z-10 flex items-center px-4 h-[65px] border-b border-zinc-200 dark:border-zinc-800">
<div className="flex items-center gap-2 flex-1 min-w-0">
<button
type="button"
@@ -112,6 +117,6 @@ function TaskEditPage() {
</div>
</div>
</motion.div>
- </>
+ </ProjectLayout>
);
}
diff --git a/apps/web/src/routes/dashboard/workspace/$workspaceId/search.tsx b/apps/web/src/routes/dashboard/workspace/$workspaceId/search.tsx
new file mode 100644
index 000000000..ea3174464
--- /dev/null
+++ b/apps/web/src/routes/dashboard/workspace/$workspaceId/search.tsx
@@ -0,0 +1,133 @@
+import WorkspaceLayout from "@/components/common/workspace-layout";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { Link, createFileRoute } from "@tanstack/react-router";
+import { ArrowLeft, Search } from "lucide-react";
+import { useState } from "react";
+
+export const Route = createFileRoute(
+ "/dashboard/workspace/$workspaceId/search",
+)({
+ component: SearchComponent,
+});
+
+function SearchComponent() {
+ const { workspaceId } = Route.useParams();
+ const [searchQuery, setSearchQuery] = useState("");
+ const [isSearching, setIsSearching] = useState(false);
+
+ const handleSearch = async (query: string) => {
+ if (!query.trim()) return;
+
+ setIsSearching(true);
+ setTimeout(() => {
+ setIsSearching(false);
+ }, 1000);
+ };
+
+ return (
+ <WorkspaceLayout
+ title="Search"
+ headerActions={
+ <Link to="/dashboard/workspace/$workspaceId" params={{ workspaceId }}>
+ <Button variant="ghost" size="sm" className="gap-2">
+ <ArrowLeft className="w-4 h-4" />
+ Back to Dashboard
+ </Button>
+ </Link>
+ }
+ >
+ <div className="space-y-6">
+ <div>
+ <div className="relative">
+ <Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" />
+ <Input
+ placeholder="Search projects, tasks, comments..."
+ value={searchQuery}
+ onChange={(e) => setSearchQuery(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") {
+ handleSearch(searchQuery);
+ }
+ }}
+ className="pl-10 h-12 text-lg"
+ autoFocus
+ />
+ <Button
+ onClick={() => handleSearch(searchQuery)}
+ disabled={!searchQuery.trim() || isSearching}
+ className="absolute right-2 top-1/2 transform -translate-y-1/2"
+ size="sm"
+ >
+ {isSearching ? "Searching..." : "Search"}
+ </Button>
+ </div>
+ <p className="text-sm text-muted-foreground mt-2">
+ Search across all projects, tasks, and comments in this workspace
+ </p>
+ </div>
+
+ {searchQuery ? (
+ <div>
+ <h2 className="text-xl font-semibold mb-4">
+ Search Results for "{searchQuery}"
+ </h2>
+
+ {isSearching ? (
+ <div className="flex items-center justify-center py-12">
+ <div className="text-center">
+ <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4" />
+ <p className="text-muted-foreground">Searching...</p>
+ </div>
+ </div>
+ ) : (
+ <div className="text-center py-12">
+ <Search className="w-12 h-12 text-muted-foreground mx-auto mb-4" />
+ <p className="text-lg font-medium mb-2">No results found</p>
+ <p className="text-muted-foreground">
+ Try adjusting your search terms or search for something else
+ </p>
+ </div>
+ )}
+ </div>
+ ) : (
+ <div className="text-center py-12">
+ <Search className="w-16 h-16 text-muted-foreground mx-auto mb-4" />
+ <h2 className="text-xl font-semibold mb-2">Start Searching</h2>
+ <p className="text-muted-foreground mb-6">
+ Enter a search term to find projects, tasks, and comments
+ </p>
+
+ <div className="space-y-2">
+ <p className="text-sm font-medium text-muted-foreground">
+ Quick searches:
+ </p>
+ <div className="flex flex-wrap gap-2 justify-center">
+ {[
+ "High priority",
+ "Bug",
+ "Feature",
+ "In progress",
+ "Completed",
+ ].map((suggestion) => (
+ <Button
+ key={suggestion}
+ variant="outline"
+ size="sm"
+ onClick={() => {
+ setSearchQuery(suggestion);
+ handleSearch(suggestion);
+ }}
+ className="text-xs"
+ >
+ {suggestion}
+ </Button>
+ ))}
+ </div>
+ </div>
+ </div>
+ )}
+ </div>
+ </WorkspaceLayout>
+ );
+}
diff --git a/apps/web/src/routes/dashboard/workspace/$workspaceId/settings.tsx b/apps/web/src/routes/dashboard/workspace/$workspaceId/settings.tsx
new file mode 100644
index 000000000..e35fcab13
--- /dev/null
+++ b/apps/web/src/routes/dashboard/workspace/$workspaceId/settings.tsx
@@ -0,0 +1,245 @@
+import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
+import { createFileRoute, useNavigate } from "@tanstack/react-router";
+import { AlertTriangle, Lock, Trash2 } from "lucide-react";
+import { useState } from "react";
+import { useForm } from "react-hook-form";
+import { toast } from "sonner";
+import { z } from "zod/v4";
+
+import {
+ DangerZoneSection,
+ SettingsLayout,
+ SettingsSection,
+} from "@/components/settings-layout";
+import { Button } from "@/components/ui/button";
+import {
+ Form,
+ FormControl,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@/components/ui/form";
+import { Input } from "@/components/ui/input";
+import useDeleteWorkspace from "@/hooks/mutations/workspace/use-delete-workspace";
+import useUpdateWorkspace from "@/hooks/mutations/workspace/use-update-workspace";
+import { useWorkspacePermission } from "@/hooks/useWorkspacePermission";
+import queryClient from "@/query-client";
+import useWorkspaceStore from "@/store/workspace";
+
+const workspaceFormSchema = z.object({
+ name: z.string().min(1, "Workspace name is required"),
+ description: z.string().min(1, "Workspace description is required"),
+});
+
+type WorkspaceFormValues = z.infer<typeof workspaceFormSchema>;
+
+export const Route = createFileRoute(
+ "/dashboard/workspace/$workspaceId/settings",
+)({
+ component: SettingsComponent,
+});
+
+function SettingsComponent() {
+ const navigate = useNavigate();
+ const { workspace, setWorkspace } = useWorkspaceStore();
+ const [deleteConfirmText, setDeleteConfirmText] = useState("");
+ const { mutateAsync: updateWorkspace, isPending: isUpdating } =
+ useUpdateWorkspace();
+ const { mutateAsync: deleteWorkspace, isPending: isDeleting } =
+ useDeleteWorkspace();
+ const { isOwner } = useWorkspacePermission();
+
+ const form = useForm<WorkspaceFormValues>({
+ resolver: standardSchemaResolver(workspaceFormSchema),
+ defaultValues: {
+ name: workspace?.name || "",
+ description: workspace?.description || "",
+ },
+ });
+
+ const { isDirty } = form.formState;
+
+ const onSubmit = async (values: WorkspaceFormValues) => {
+ if (!workspace?.id) return;
+ try {
+ const updatedWorkspace = await updateWorkspace({
+ id: workspace.id,
+ name: values.name,
+ description: values.description,
+ });
+ setWorkspace(updatedWorkspace);
+ toast.success("Workspace updated successfully");
+ await queryClient.invalidateQueries({ queryKey: ["workspaces"] });
+ form.reset(values);
+ } catch (error) {
+ toast.error(
+ error instanceof Error ? error.message : "Failed to update workspace",
+ );
+ }
+ };
+
+ const handleDeleteWorkspace = async () => {
+ if (!workspace?.id || deleteConfirmText !== workspace.name) return;
+ try {
+ await deleteWorkspace({ id: workspace.id });
+ toast.success("Workspace deleted successfully");
+ await queryClient.invalidateQueries({ queryKey: ["workspaces"] });
+ navigate({ to: "/dashboard" });
+ } catch (error) {
+ toast.error(
+ error instanceof Error ? error.message : "Failed to delete workspace",
+ );
+ }
+ };
+
+ if (!isOwner) {
+ return (
+ <div className="max-w-4xl mx-auto space-y-8 py-6">
+ <div className="space-y-1">
+ <p className="text-sm text-muted-foreground">
+ Manage your workspace configuration and settings
+ </p>
+ </div>
+ <div className="flex flex-col items-center justify-center py-24">
+ <div className="flex h-20 w-20 items-center justify-center rounded-full border border-amber-200 bg-amber-50 dark:border-amber-800/50 dark:bg-amber-900/20">
+ <Lock className="h-8 w-8 text-amber-600 dark:text-amber-500" />
+ </div>
+ <div className="mt-6 text-center">
+ <h2 className="text-xl font-semibold">Permission Required</h2>
+ <p className="mt-2 text-sm text-muted-foreground max-w-md">
+ Only workspace owners can modify workspace settings. Please
+ contact the workspace owner if you need to make changes.
+ </p>
+ </div>
+ </div>
+ </div>
+ );
+ }
+
+ return (
+ <SettingsLayout
+ title="Workspace"
+ description="Manage your workspace details and settings"
+ className="pt-4 px-6 overflow-auto"
+ >
+ <div className="max-w-4xl mx-auto space-y-8">
+ {isDirty && (
+ <div className="rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-800/50 dark:bg-amber-900/20">
+ <div className="flex items-center gap-2">
+ <AlertTriangle className="h-4 w-4 text-amber-600 dark:text-amber-500" />
+ <span className="text-sm font-medium text-amber-800 dark:text-amber-200">
+ You have unsaved changes
+ </span>
+ </div>
+ </div>
+ )}
+
+ {workspace && (
+ <SettingsSection
+ title="General"
+ description="Basic workspace information and configuration"
+ >
+ <Form {...form}>
+ <form
+ onSubmit={form.handleSubmit(onSubmit)}
+ className="space-y-8"
+ >
+ <FormField
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <FormItem className="flex flex-col gap-2">
+ <FormLabel className="text-base font-medium">
+ Workspace Name
+ </FormLabel>
+ <FormControl>
+ <Input {...field} placeholder="Enter workspace name" />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="description"
+ render={({ field }) => (
+ <FormItem className="flex flex-col gap-2">
+ <FormLabel className="text-base font-medium">
+ Description
+ </FormLabel>
+ <FormControl>
+ <Input
+ {...field}
+ placeholder="Enter workspace description"
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <div className="flex justify-end">
+ <Button type="submit" disabled={isUpdating || !isDirty}>
+ {isUpdating ? "Saving..." : "Save Changes"}
+ </Button>
+ </div>
+ </form>
+ </Form>
+ </SettingsSection>
+ )}
+
+ {workspace && (
+ <DangerZoneSection
+ title="Danger Zone"
+ description="Permanently delete your workspace. This action cannot be undone."
+ >
+ <div className="space-y-4">
+ <div className="rounded-md border border-destructive/20 bg-destructive/10 p-4">
+ <div className="flex items-start gap-3">
+ <AlertTriangle className="mt-0.5 h-4 w-4 text-destructive" />
+ <div className="space-y-1">
+ <p className="text-sm font-medium">
+ This action cannot be undone
+ </p>
+ <ul className="space-y-1 text-xs text-muted-foreground">
+ <li>
+ • All projects and tasks will be permanently deleted
+ </li>
+ <li>• All workspace settings will be erased</li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ <div className="space-y-3">
+ <div>
+ <label
+ htmlFor="confirm-deletion"
+ className="text-sm font-medium"
+ >
+ Type "{workspace.name}" to confirm deletion
+ </label>
+ <Input
+ id="confirm-deletion"
+ value={deleteConfirmText}
+ onChange={(e) => setDeleteConfirmText(e.target.value)}
+ placeholder={workspace.name}
+ className="mt-1"
+ />
+ </div>
+ <Button
+ onClick={handleDeleteWorkspace}
+ disabled={deleteConfirmText !== workspace.name || isDeleting}
+ variant="destructive"
+ className="w-full gap-2"
+ >
+ <Trash2 className="h-4 w-4" />
+ {isDeleting ? "Deleting..." : "Delete Workspace"}
+ </Button>
+ </div>
+ </div>
+ </DangerZoneSection>
+ )}
+ </div>
+ </SettingsLayout>
+ );
+}
diff --git a/apps/web/src/routes/dashboard/workspace/create.tsx b/apps/web/src/routes/dashboard/workspace/create.tsx
new file mode 100644
index 000000000..1aa30a3b7
--- /dev/null
+++ b/apps/web/src/routes/dashboard/workspace/create.tsx
@@ -0,0 +1,133 @@
+import { useQueryClient } from "@tanstack/react-query";
+import { createFileRoute, useNavigate } from "@tanstack/react-router";
+import { Building2 } from "lucide-react";
+import { useEffect, useRef, useState } from "react";
+import { toast } from "sonner";
+
+import { Button } from "@/components/ui/button";
+import { Card, CardContent } from "@/components/ui/card";
+import { Input } from "@/components/ui/input";
+import useCreateWorkspace from "@/hooks/queries/workspace/use-create-workspace";
+import { useUserPreferencesStore } from "@/store/user-preferences";
+
+export const Route = createFileRoute("/dashboard/workspace/create")({
+ component: RouteComponent,
+});
+
+function RouteComponent() {
+ const [name, setName] = useState("");
+ const [description, setDescription] = useState("");
+ const inputRef = useRef<HTMLInputElement>(null);
+ const queryClient = useQueryClient();
+ const navigate = useNavigate();
+ const { setActiveWorkspaceId } = useUserPreferencesStore();
+ const { mutateAsync, isPending } = useCreateWorkspace();
+
+ useEffect(() => {
+ if (inputRef.current) {
+ setTimeout(() => {
+ inputRef.current?.focus();
+ }, 100);
+ }
+ }, []);
+
+ const handleSubmit = async (e: React.FormEvent) => {
+ e.preventDefault();
+ if (!name.trim()) return;
+
+ try {
+ const createdWorkspace = await mutateAsync({ name, description });
+ toast.success("Workspace created successfully");
+ await queryClient.invalidateQueries({ queryKey: ["workspaces"] });
+
+ setActiveWorkspaceId(createdWorkspace.id);
+ navigate({
+ to: "/dashboard/workspace/$workspaceId",
+ params: {
+ workspaceId: createdWorkspace.id,
+ },
+ });
+ } catch (error) {
+ toast.error(
+ error instanceof Error ? error.message : "Failed to create workspace",
+ );
+ }
+ };
+
+ return (
+ <div className="min-h-screen w-full bg-zinc-50 dark:bg-zinc-900 flex items-center justify-center p-4 overflow-y-auto">
+ <div className="w-full max-w-md">
+ <Card className="border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-800 shadow-sm">
+ <CardContent className="p-8">
+ <div className="text-center mb-8">
+ <div className="flex justify-center mb-4">
+ <div className="w-12 h-12 bg-zinc-100 dark:bg-zinc-700 rounded-lg flex items-center justify-center">
+ <Building2 className="h-6 w-6 text-zinc-600 dark:text-zinc-400" />
+ </div>
+ </div>
+
+ <h1 className="text-2xl font-semibold text-zinc-900 dark:text-white mb-2">
+ Create a new workspace
+ </h1>
+ <p className="text-zinc-600 dark:text-zinc-400 text-sm">
+ Workspaces are shared environments where teams can work on
+ projects, cycles and issues.
+ </p>
+ </div>
+
+ <form onSubmit={handleSubmit} className="space-y-6">
+ <div className="space-y-4">
+ <div>
+ <label
+ htmlFor="workspace-name"
+ className="block text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-2"
+ >
+ Workspace Name
+ </label>
+ <Input
+ ref={inputRef}
+ id="workspace-name"
+ value={name}
+ onChange={(e) => setName(e.target.value)}
+ placeholder="Enter workspace name"
+ className="h-12 text-lg font-medium border-zinc-300 dark:border-zinc-600 focus:border-indigo-500 dark:focus:border-indigo-400 focus:ring-indigo-500 dark:focus:ring-indigo-400"
+ required
+ />
+ {!name.trim() && (
+ <p className="text-red-500 text-sm mt-1">Required</p>
+ )}
+ </div>
+
+ <div>
+ <label
+ htmlFor="workspace-description"
+ className="block text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-2"
+ >
+ Description (optional)
+ </label>
+ <Input
+ id="workspace-description"
+ value={description}
+ onChange={(e) => setDescription(e.target.value)}
+ placeholder="Add a description for your workspace"
+ className="h-10 border-zinc-300 dark:border-zinc-600 focus:border-indigo-500 dark:focus:border-indigo-400 focus:ring-indigo-500 dark:focus:ring-indigo-400"
+ />
+ </div>
+ </div>
+
+ <div className="pt-4">
+ <Button
+ type="submit"
+ disabled={!name.trim() || isPending}
+ className="w-full h-12 bg-indigo-600 hover:bg-indigo-500 text-white font-medium disabled:opacity-50 disabled:cursor-not-allowed"
+ >
+ {isPending ? "Creating..." : "Create workspace"}
+ </Button>
+ </div>
+ </form>
+ </CardContent>
+ </Card>
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/src/store/user-preferences.ts b/apps/web/src/store/user-preferences.ts
index fffe6705d..9e97d06df 100644
--- a/apps/web/src/store/user-preferences.ts
+++ b/apps/web/src/store/user-preferences.ts
@@ -2,20 +2,113 @@ import { create } from "zustand";
import { createJSONStorage, persist } from "zustand/middleware";
type UserPreferencesStore = {
- isSidebarOpened: boolean;
- setIsSidebarOpened: () => void;
+ theme: "light" | "dark" | "system";
+ setTheme: (
+ theme: "light" | "dark" | "system",
+ coordinates?: { x: number; y: number },
+ ) => void;
+
viewMode: "board" | "list";
setViewMode: (mode: "board" | "list") => void;
+
+ compactMode: boolean;
+ setCompactMode: (compact: boolean) => void;
+
+ showTaskNumbers: boolean;
+ setShowTaskNumbers: (show: boolean) => void;
+ toggleTaskNumbers: () => void;
+ showAssignees: boolean;
+ setShowAssignees: (show: boolean) => void;
+ toggleAssignees: () => void;
+ showDueDates: boolean;
+ setShowDueDates: (show: boolean) => void;
+ toggleDueDates: () => void;
+ showLabels: boolean;
+ setShowLabels: (show: boolean) => void;
+ toggleLabels: () => void;
+ showPriority: boolean;
+ setShowPriority: (show: boolean) => void;
+ togglePriority: () => void;
+ resetDisplayPreferences: () => void;
+
+ sidebarDefaultOpen: boolean;
+ setSidebarDefaultOpen: (open: boolean) => void;
+
+ activeWorkspaceId: string | null;
+ setActiveWorkspaceId: (workspaceId: string | null) => void;
};
export const useUserPreferencesStore = create<UserPreferencesStore>()(
persist(
- (set, get) => ({
- isSidebarOpened: true,
- setIsSidebarOpened: () =>
- set({ isSidebarOpened: !get().isSidebarOpened }),
+ (set) => ({
+ theme: "dark",
+ setTheme: (
+ theme: "light" | "dark" | "system",
+ coordinates?: { x: number; y: number },
+ ) => {
+ if (coordinates) {
+ document.documentElement.style.setProperty(
+ "--x",
+ `${coordinates.x}%`,
+ );
+ document.documentElement.style.setProperty(
+ "--y",
+ `${coordinates.y}%`,
+ );
+ } else {
+ document.documentElement.style.removeProperty("--x");
+ document.documentElement.style.removeProperty("--y");
+ }
+
+ if ("startViewTransition" in document) {
+ document.startViewTransition(() => {
+ set({ theme });
+ });
+ } else {
+ set({ theme });
+ }
+ },
+
viewMode: "board",
setViewMode: (mode) => set({ viewMode: mode }),
+
+ compactMode: false,
+ setCompactMode: (compact) => set({ compactMode: compact }),
+
+ showTaskNumbers: true,
+ setShowTaskNumbers: (show) => set({ showTaskNumbers: show }),
+ toggleTaskNumbers: () =>
+ set((state) => ({ showTaskNumbers: !state.showTaskNumbers })),
+ showAssignees: true,
+ setShowAssignees: (show) => set({ showAssignees: show }),
+ toggleAssignees: () =>
+ set((state) => ({ showAssignees: !state.showAssignees })),
+ showDueDates: true,
+ setShowDueDates: (show) => set({ showDueDates: show }),
+ toggleDueDates: () =>
+ set((state) => ({ showDueDates: !state.showDueDates })),
+ showLabels: true,
+ setShowLabels: (show) => set({ showLabels: show }),
+ toggleLabels: () => set((state) => ({ showLabels: !state.showLabels })),
+ showPriority: true,
+ setShowPriority: (show) => set({ showPriority: show }),
+ togglePriority: () =>
+ set((state) => ({ showPriority: !state.showPriority })),
+ resetDisplayPreferences: () =>
+ set({
+ showAssignees: true,
+ showDueDates: true,
+ showLabels: true,
+ showTaskNumbers: true,
+ showPriority: true,
+ }),
+
+ sidebarDefaultOpen: true,
+ setSidebarDefaultOpen: (open) => set({ sidebarDefaultOpen: open }),
+
+ activeWorkspaceId: null,
+ setActiveWorkspaceId: (workspaceId) =>
+ set({ activeWorkspaceId: workspaceId }),
}),
{
name: "user-preferences",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 449ef9acc..b09e12cf0 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -154,6 +154,9 @@ importers:
'@dnd-kit/core':
specifier: ^6.3.1
+ '@dnd-kit/modifiers':
+ specifier: ^9.0.0
'@dnd-kit/sortable':
specifier: ^10.0.0
@@ -166,27 +169,39 @@ importers:
'@radix-ui/react-accordion':
specifier: ^1.2.10
+ '@radix-ui/react-alert-dialog':
+ specifier: ^1.1.14
'@radix-ui/react-avatar':
- specifier: ^1.1.9
+ specifier: ^1.1.10
+ '@radix-ui/react-collapsible':
+ specifier: ^1.1.11
'@radix-ui/react-context-menu':
- specifier: ^2.2.12
+ specifier: ^2.2.15
'@radix-ui/react-dialog':
- specifier: ^1.1.13
+ specifier: ^1.1.14
'@radix-ui/react-dropdown-menu':
- specifier: ^2.1.14
+ specifier: ^2.1.15
'@radix-ui/react-label':
specifier: ^2.1.6
'@radix-ui/react-popover':
- specifier: ^1.1.13
+ specifier: ^1.1.14
+ '@radix-ui/react-progress':
+ specifier: ^1.1.7
'@radix-ui/react-select':
specifier: ^2.2.2
+ '@radix-ui/react-separator':
+ specifier: ^1.1.7
'@radix-ui/react-slot':
specifier: ^1.2.3
version: 1.2.3(@types/[email protected])([email protected])
@@ -194,7 +209,7 @@ importers:
specifier: ^1.2.4
'@radix-ui/react-tooltip':
- specifier: ^1.2.3
+ specifier: ^1.2.7
'@tanstack/react-query':
specifier: ^5.75.5
@@ -275,8 +290,8 @@ importers:
specifier: ^19.0.0
version: 19.1.0
react-day-picker:
- specifier: 9.7.0
- version: 9.7.0([email protected])
+ specifier: 9.8.0
+ version: 9.8.0([email protected])
react-dom:
specifier: ^19.0.0
version: 19.1.0([email protected])
@@ -665,6 +680,12 @@ packages:
react: '>=16.8.0'
react-dom: '>=16.8.0'
+ '@dnd-kit/[email protected]':
+ resolution: {integrity: sha512-ybiLc66qRGuZoC20wdSSG6pDXFikui/dCNGthxv4Ndy8ylErY0N3KVxY2bgo7AWwIbxDmXDg3ylAFmnrjcbVvw==}
+ peerDependencies:
+ '@dnd-kit/core': ^6.3.0
+ react: '>=16.8.0'
+
'@dnd-kit/[email protected]':
resolution: {integrity: sha512-+xqhmIIzvAYMGfBYYnbKuNicfSsk4RksY2XdmJhT+HAC01nix6fHCztU68jooFiMUB01Ky3F0FyOvhG/BZrWkg==}
peerDependencies:
@@ -1392,6 +1413,19 @@ packages:
'@types/react-dom':
optional: true
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-IOZfZ3nPvN6lXpJTBCunFQPRSvK8MDgSc1FB85xnIpUKOw9en0dJj8JmCAxV7BiZdtYlUpmrQjoTFkVYtdoWzQ==}
+ peerDependencies:
+ '@types/react': '*'
+ '@types/react-dom': '*'
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/[email protected]':
resolution: {integrity: sha512-qz+fxrqgNxG0dYew5l7qR3c7wdgRu1XVUHGnGYX7rg5HM4p9SWaRmJwfgR3J0SgyUKayLmzQIun+N6rWRgiRKw==}
peerDependencies:
@@ -1832,6 +1866,19 @@ packages:
'@types/react-dom':
optional: true
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-vPdg/tF6YC/ynuBIJlk1mm7Le0VgW6ub6J2UWnTQ7/D23KXcPI1qy+0vBkgKgd38RCMJavBXpB83HPNFMTb0Fg==}
+ peerDependencies:
+ '@types/react': '*'
+ '@types/react-dom': '*'
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/[email protected]':
resolution: {integrity: sha512-dT9aOXUen9JSsxnMPv/0VqySQf5eDQ6LCk5Sw28kamz8wSOW2bJdlX2Bg5VUIIcV+6XlHpWTIuTPCf/UNIyq8Q==}
peerDependencies:
@@ -1884,6 +1931,19 @@ packages:
'@types/react-dom':
optional: true
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-0HEb8R9E8A+jZjvmFCy/J4xhbXy3TV+9XSnGJ3KvTtjlIUy/YQ/p6UYZvi7YbeoeXdyU9+Y3scizK6hkY37baA==}
+ peerDependencies:
+ '@types/react': '*'
+ '@types/react-dom': '*'
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/[email protected]':
resolution: {integrity: sha512-YAKxaiGsSQJ38VzKH86/BPRC4rh+b1Jpa+JneA5LRE7skmLPNAyeG8kPJj/oo4STLvlrs8vkf/iYyc3A5stYCQ==}
peerDependencies:
@@ -4176,8 +4236,8 @@ packages:
resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==}
hasBin: true
- resolution: {integrity: sha512-urlK4C9XJZVpQ81tmVgd2O7lZ0VQldZeHzNejbwLWZSkzHH498KnArT0EHNfKBOWwKc935iMLGZdxXPRISzUxQ==}
+ resolution: {integrity: sha512-E0yhhg7R+pdgbl/2toTb0xBhsEAtmAx1l7qjIWYfcxOy8w4rTSVfbtBoSzVVhPwKP/5E9iL38LivzoE3AQDhCQ==}
engines: {node: '>=18'}
peerDependencies:
react: '>=16.8.0'
@@ -5189,6 +5249,13 @@ snapshots:
react-dom: 19.1.0([email protected])
tslib: 2.8.1
+ dependencies:
+ '@dnd-kit/utilities': 3.2.2([email protected])
+ react: 19.1.0
+ tslib: 2.8.1
+
dependencies:
@@ -5797,6 +5864,20 @@ snapshots:
'@types/react': 19.1.8
'@types/react-dom': 19.1.6(@types/[email protected])
+ dependencies:
+ '@radix-ui/primitive': 1.1.2
+ '@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-slot': 1.2.3(@types/[email protected])([email protected])
+ react: 19.1.0
+ react-dom: 19.1.0([email protected])
+ optionalDependencies:
+ '@types/react': 19.1.8
+ '@types/react-dom': 19.1.6(@types/[email protected])
+
dependencies:
@@ -6255,6 +6336,16 @@ snapshots:
'@types/react': 19.1.8
'@types/react-dom': 19.1.6(@types/[email protected])
+ dependencies:
+ '@radix-ui/react-context': 1.1.2(@types/[email protected])([email protected])
+ react: 19.1.0
+ react-dom: 19.1.0([email protected])
+ optionalDependencies:
+ '@types/react': 19.1.8
+ '@types/react-dom': 19.1.6(@types/[email protected])
+
dependencies:
'@radix-ui/primitive': 1.1.2
@@ -6327,10 +6418,19 @@ snapshots:
'@radix-ui/react-use-layout-effect': 1.1.1(@types/[email protected])([email protected])
'@radix-ui/react-use-previous': 1.1.1(@types/[email protected])([email protected])
'@radix-ui/react-visually-hidden': 1.2.3(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
- aria-hidden: 1.2.4
+ aria-hidden: 1.2.6
+ react: 19.1.0
+ react-dom: 19.1.0([email protected])
+ react-remove-scroll: 2.7.1(@types/[email protected])([email protected])
+ optionalDependencies:
+ '@types/react': 19.1.8
+ '@types/react-dom': 19.1.6(@types/[email protected])
+
+ dependencies:
react: 19.1.0
react-dom: 19.1.0([email protected])
- react-remove-scroll: 2.6.3(@types/[email protected])([email protected])
optionalDependencies:
'@types/react': 19.1.8
'@types/react-dom': 19.1.6(@types/[email protected])
@@ -7757,7 +7857,7 @@ snapshots:
dependencies:
+ '@radix-ui/react-collapsible': 1.1.11(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
'@radix-ui/react-direction': 1.1.1(@types/[email protected])([email protected])
'@radix-ui/react-navigation-menu': 1.2.9(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
@@ -8901,7 +9001,7 @@ snapshots:
strip-json-comments: 2.0.1
optional: true
dependencies:
'@date-fns/tz': 1.2.0
date-fns: 4.1.0