⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
feat: adding project slugs
Andreje4cd25a6b8c7
diff --git a/apps/api/drizzle/0000_unusual_frank_castle.sql b/apps/api/drizzle/0000_broad_veda.sqlsimilarity index 82%rename from apps/api/drizzle/0000_unusual_frank_castle.sqlrename to apps/api/drizzle/0000_broad_veda.sqlindex bc014a716..cfd9f4aca 100644--- a/apps/api/drizzle/0000_unusual_frank_castle.sql+++ b/apps/api/drizzle/0000_broad_veda.sql@@ -1,10 +1,11 @@CREATE TABLE `project` (`id` text PRIMARY KEY NOT NULL,`workspace_id` text NOT NULL,+ `slug` text NOT NULL,`icon` text DEFAULT 'Layout',`name` text NOT NULL,`description` text,- `created_at` integer DEFAULT '"2025-02-08T16:18:40.042Z"' NOT NULL,+ `created_at` integer DEFAULT '"2025-02-08T22:05:26.528Z"' NOT NULL,FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE cascade ON DELETE cascade);--> statement-breakpoint@@ -18,13 +19,14 @@ CREATE TABLE `session` (CREATE TABLE `task` (`id` text PRIMARY KEY NOT NULL,`project_id` text NOT NULL,+ `number` integer DEFAULT 1,`assignee_id` text NOT NULL,`title` text NOT NULL,`description` text,`status` text DEFAULT 'to-do' NOT NULL,`priority` text DEFAULT 'low',`due_date` integer,- `created_at` integer DEFAULT '"2025-02-08T16:18:40.042Z"' NOT NULL,+ `created_at` integer DEFAULT '"2025-02-08T22:05:26.528Z"' NOT NULL,FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON UPDATE cascade ON DELETE cascade,FOREIGN KEY (`assignee_id`) REFERENCES `user`(`id`) ON UPDATE cascade ON DELETE cascade);@@ -34,7 +36,7 @@ CREATE TABLE `user` (`name` text NOT NULL,`password` text NOT NULL,`email` text NOT NULL,- `created_at` integer DEFAULT '"2025-02-08T16:18:40.041Z"' NOT NULL+ `created_at` integer DEFAULT '"2025-02-08T22:05:26.528Z"' NOT NULL);--> statement-breakpointCREATE UNIQUE INDEX `user_email_unique` ON `user` (`email`);--> statement-breakpoint@@ -43,7 +45,7 @@ CREATE TABLE `workspace` (`name` text NOT NULL,`description` text,`owner_id` text NOT NULL,- `created_at` integer DEFAULT '"2025-02-08T16:18:40.041Z"' NOT NULL,+ `created_at` integer DEFAULT '"2025-02-08T22:05:26.528Z"' NOT NULL,FOREIGN KEY (`owner_id`) REFERENCES `user`(`id`) ON UPDATE cascade ON DELETE cascade);--> statement-breakpoint@@ -52,7 +54,7 @@ CREATE TABLE `workspace_member` (`workspace_id` text NOT NULL,`user_id` text NOT NULL,`role` text,- `joined_at` integer DEFAULT '"2025-02-08T16:18:40.042Z"' NOT NULL,+ `joined_at` integer DEFAULT '"2025-02-08T22:05:26.528Z"' NOT NULL,FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE cascade ON DELETE cascade,FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE cascade ON DELETE cascade);diff --git a/apps/api/drizzle/meta/0000_snapshot.json b/apps/api/drizzle/meta/0000_snapshot.jsonindex 186177dfb..d805cfec3 100644--- a/apps/api/drizzle/meta/0000_snapshot.json+++ b/apps/api/drizzle/meta/0000_snapshot.json@@ -1,7 +1,7 @@{"version": "6","dialect": "sqlite",- "id": "29ea78f9-027a-4b6c-b0bc-0746a33ff8f1",+ "id": "6a9833af-80f3-46e9-a34a-f0cad5ddd6f1","prevId": "00000000-0000-0000-0000-000000000000","tables": {"project": {@@ -21,6 +21,13 @@"notNull": true,"autoincrement": false},+ "slug": {+ "name": "slug",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },"icon": {"name": "icon","type": "text",@@ -49,7 +56,7 @@"primaryKey": false,"notNull": true,"autoincrement": false,- "default": "'\"2025-02-08T16:18:40.042Z\"'"+ "default": "'\"2025-02-08T22:05:26.528Z\"'"}},"indexes": {},@@ -126,6 +133,14 @@"notNull": true,"autoincrement": false},+ "number": {+ "name": "number",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": 1+ },"assignee_id": {"name": "assignee_id","type": "text",@@ -176,7 +191,7 @@"primaryKey": false,"notNull": true,"autoincrement": false,- "default": "'\"2025-02-08T16:18:40.042Z\"'"+ "default": "'\"2025-02-08T22:05:26.528Z\"'"}},"indexes": {},@@ -241,7 +256,7 @@"primaryKey": false,"notNull": true,"autoincrement": false,- "default": "'\"2025-02-08T16:18:40.041Z\"'"+ "default": "'\"2025-02-08T22:05:26.528Z\"'"}},"indexes": {@@ -293,7 +308,7 @@"primaryKey": false,"notNull": true,"autoincrement": false,- "default": "'\"2025-02-08T16:18:40.041Z\"'"+ "default": "'\"2025-02-08T22:05:26.528Z\"'"}},"indexes": {},@@ -349,7 +364,7 @@"primaryKey": false,"notNull": true,"autoincrement": false,- "default": "'\"2025-02-08T16:18:40.042Z\"'"+ "default": "'\"2025-02-08T22:05:26.528Z\"'"}},"indexes": {},diff --git a/apps/api/drizzle/meta/_journal.json b/apps/api/drizzle/meta/_journal.jsonindex 2666e75e7..f11e09f6f 100644--- a/apps/api/drizzle/meta/_journal.json+++ b/apps/api/drizzle/meta/_journal.json@@ -5,8 +5,8 @@{"idx": 0,"version": "6",- "when": 1739031520048,- "tag": "0000_unusual_frank_castle",+ "when": 1739052326535,+ "tag": "0000_broad_veda","breakpoints": true}]diff --git a/apps/api/src/database/schema.ts b/apps/api/src/database/schema.tsindex 8e8c250d7..4d534768b 100644--- a/apps/api/src/database/schema.ts+++ b/apps/api/src/database/schema.ts@@ -1,5 +1,5 @@import { createId } from "@paralleldrive/cuid2";-import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";+import { int, integer, sqliteTable, text } from "drizzle-orm/sqlite-core";export const userTable = sqliteTable("user", {id: text("id")@@ -75,6 +75,7 @@ export const projectTable = sqliteTable("project", {onDelete: "cascade",onUpdate: "cascade",}),+ slug: text("slug").notNull(),icon: text("icon").default("Layout"),name: text("name").notNull(),description: text("description"),@@ -93,6 +94,7 @@ export const taskTable = sqliteTable("task", {onDelete: "cascade",onUpdate: "cascade",}),+ number: int().default(1),assigneeId: text("assignee_id").notNull().references(() => userTable.id, {diff --git a/apps/api/src/project/controllers/create-project.ts b/apps/api/src/project/controllers/create-project.tsindex 0145e75e9..088c2fda1 100644--- a/apps/api/src/project/controllers/create-project.ts+++ b/apps/api/src/project/controllers/create-project.ts@@ -3,10 +3,7 @@ import { projectTable } from "../../database/schema";import type { CreateProjectPayload } from "../db/queries";function createProject(- body: Pick<- CreateProjectPayload,- "name" | "description" | "workspaceId" | "icon"- >,+ body: Pick<CreateProjectPayload, "name" | "slug" | "workspaceId" | "icon">,) {return db.insert(projectTable).values(body);}diff --git a/apps/api/src/project/controllers/get-projects.ts b/apps/api/src/project/controllers/get-projects.tsindex 990aed50d..cfe187f3b 100644--- a/apps/api/src/project/controllers/get-projects.ts+++ b/apps/api/src/project/controllers/get-projects.ts@@ -14,6 +14,7 @@ async function getProjects({workspaceId: projectTable.workspaceId,createdAt: projectTable.createdAt,icon: projectTable.icon,+ slug: projectTable.slug,workspace: {id: workspaceTable.id,name: workspaceTable.name,diff --git a/apps/api/src/project/index.ts b/apps/api/src/project/index.tsindex 2062cadf0..9a4808dd4 100644--- a/apps/api/src/project/index.ts+++ b/apps/api/src/project/index.ts@@ -18,8 +18,8 @@ const project = new Elysia({ prefix: "/project" })body: t.Object({name: t.String(),workspaceId: t.String(),- description: t.String(),icon: t.String(),+ slug: t.String(),}),},)diff --git a/apps/api/src/task/controllers/create-task.ts b/apps/api/src/task/controllers/create-task.tsindex e94fca1e0..6e775cd48 100644--- a/apps/api/src/task/controllers/create-task.ts+++ b/apps/api/src/task/controllers/create-task.ts@@ -1,7 +1,16 @@-import { eq } from "drizzle-orm";+import { count, eq } from "drizzle-orm";import db from "../../database";import { taskTable, userTable } from "../../database/schema";+async function getNextTaskNumber(projectId: string) {+ const [task] = await db+ .select({ count: count() })+ .from(taskTable)+ .where(eq(taskTable.projectId, projectId));++ return task.count;+}+async function createTask(body: {projectId: string;assigneeId: string;@@ -20,7 +29,15 @@ async function createTask(body: {throw new Error("Assignee not found");}- const [createdTask] = await db.insert(taskTable).values(body).returning();+ const nextTaskNumber = await getNextTaskNumber(body.projectId);++ const [createdTask] = await db+ .insert(taskTable)+ .values({+ ...body,+ number: nextTaskNumber + 1,+ })+ .returning();return {...createdTask,diff --git a/apps/api/src/task/controllers/get-tasks.ts b/apps/api/src/task/controllers/get-tasks.tsindex da17aede9..a0f476b16 100644--- a/apps/api/src/task/controllers/get-tasks.ts+++ b/apps/api/src/task/controllers/get-tasks.ts@@ -22,6 +22,7 @@ async function getTasks(projectId: string) {.select({id: taskTable.id,title: taskTable.title,+ number: taskTable.number,description: taskTable.description,status: taskTable.status,priority: taskTable.priority,@@ -48,6 +49,7 @@ async function getTasks(projectId: string) {return {id: project.id,name: project.name,+ slug: project.slug,workspaceId: project.workspaceId,columns,};diff --git a/apps/api/src/workspace-user/controllers/get-workspace-users.ts b/apps/api/src/workspace-user/controllers/get-workspace-users.tsindex 8f51f20bc..f7e5a5bd1 100644--- a/apps/api/src/workspace-user/controllers/get-workspace-users.ts+++ b/apps/api/src/workspace-user/controllers/get-workspace-users.ts@@ -14,11 +14,11 @@ function getWorkspaceUsers({ workspaceId }: { workspaceId: string }) {}).from(workspaceTable).where(eq(workspaceTable.id, workspaceId))- .leftJoin(+ .innerJoin(workspaceUserTable,eq(workspaceTable.id, workspaceUserTable.workspaceId),)- .leftJoin(userTable, eq(workspaceUserTable.userId, userTable.id))+ .innerJoin(userTable, eq(workspaceUserTable.userId, userTable.id)).unionAll(db.select({@@ -26,7 +26,7 @@ function getWorkspaceUsers({ workspaceId }: { workspaceId: string }) {userName: userTable.name,}).from(workspaceTable)- .leftJoin(userTable, eq(workspaceTable.ownerId, userTable.id))+ .innerJoin(userTable, eq(workspaceTable.ownerId, userTable.id)).where(eq(workspaceTable.id, workspaceId)),);}diff --git a/apps/api/src/workspace/controllers/create-workspace.ts b/apps/api/src/workspace/controllers/create-workspace.tsindex 598e5b8ac..3088d14d3 100644--- a/apps/api/src/workspace/controllers/create-workspace.ts+++ b/apps/api/src/workspace/controllers/create-workspace.ts@@ -3,7 +3,8 @@ import { workspaceTable } from "../../database/schema";import type { CreateWorkspacePayload } from "../db/queries";async function createWorkspace(body: CreateWorkspacePayload) {- return db.insert(workspaceTable).values(body);+ const [workspace] = await db.insert(workspaceTable).values(body).returning();+ return workspace;}export default createWorkspace;diff --git a/apps/web/package.json b/apps/web/package.jsonindex 00e5de264..1a2a4b215 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -18,6 +18,7 @@"@radix-ui/react-dialog": "^1.1.5","@radix-ui/react-dropdown-menu": "^2.1.5","@radix-ui/react-label": "^2.1.1",+ "@radix-ui/react-select": "^2.1.6","@radix-ui/react-slot": "^1.1.1","@radix-ui/react-tooltip": "^1.1.7","@tanstack/react-query": "^5.64.2",diff --git a/apps/web/src/components/common/sidebar/sections/projects/create-project-modal.tsx b/apps/web/src/components/common/sidebar/sections/projects/create-project-modal.tsxindex 94d11571c..e7a04083f 100644--- a/apps/web/src/components/common/sidebar/sections/projects/create-project-modal.tsx+++ b/apps/web/src/components/common/sidebar/sections/projects/create-project-modal.tsx@@ -3,6 +3,7 @@ import { Input } from "@/components/ui/input";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";@@ -16,13 +17,13 @@ type CreateProjectModalProps = {function CreateProjectModal({ open, onClose }: CreateProjectModalProps) {const [name, setName] = useState("");- const [description, setDescription] = useState("");+ const [slug, setSlug] = useState("");const [selectedIcon, setSelectedIcon] = useState("Layout");const queryClient = useQueryClient();const { workspace } = useWorkspaceStore();const { mutateAsync } = useCreateProject({name,- description,+ slug,workspaceId: workspace?.id ?? "",icon: selectedIcon,});@@ -36,11 +37,17 @@ function CreateProjectModal({ open, onClose }: CreateProjectModalProps) {await queryClient.invalidateQueries({ queryKey: ["projects"] });setName("");- setDescription("");+ setSlug("");setSelectedIcon("Layout");onClose();};+ const handleNameChange = (e: React.ChangeEvent<HTMLInputElement>) => {+ const newName = e.target.value;+ setName(newName);+ setSlug(generateProjectSlug(newName));+ };+return (<Dialog.Root open={open} onOpenChange={onClose}><Dialog.Portal>@@ -67,7 +74,7 @@ function CreateProjectModal({ open, onClose }: CreateProjectModalProps) {</label><Inputvalue={name}- onChange={(e) => setName(e.target.value)}+ onChange={handleNameChange}placeholder="Designers"className="bg-white dark:bg-zinc-800/50"required@@ -76,24 +83,39 @@ function CreateProjectModal({ open, onClose }: CreateProjectModalProps) {<div className="mb-4"><label- htmlFor="projectDescription"- aria-label="Project description"+ htmlFor="slug"className="block text-sm font-medium text-zinc-900 dark:text-zinc-300 mb-1">- Project Description+ Project Slug</label>- <Input- value={description}- onChange={(e) => setDescription(e.target.value)}- placeholder="The design project!"- className="bg-white dark:bg-zinc-800/50"- required- />+ <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+ />+ <Button+ type="button"+ onClick={() => setSlug(generateProjectSlug(name))}+ className="bg-zinc-100 text-zinc-900 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-100 dark:hover:bg-zinc-700"+ >+ Generate+ </Button>+ </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>- {/* biome-ignore lint/a11y/noLabelWithoutControl: TODO: Fix me */}- <label className="block text-sm font-medium text-zinc-900 dark:text-zinc-300 mb-3">+ <label+ htmlFor="icon"+ className="block text-sm font-medium text-zinc-900 dark:text-zinc-300 mb-3"+ >Project Icon</label><div className="relative">diff --git a/apps/web/src/components/common/sidebar/sections/workspaces/components/create-workspace-modal.tsx b/apps/web/src/components/common/sidebar/sections/workspaces/components/create-workspace-modal.tsxindex 37a0be884..2961e94e3 100644--- a/apps/web/src/components/common/sidebar/sections/workspaces/components/create-workspace-modal.tsx+++ b/apps/web/src/components/common/sidebar/sections/workspaces/components/create-workspace-modal.tsx@@ -3,6 +3,7 @@ import { Input } from "@/components/ui/input";import useCreateWorkspace from "@/hooks/queries/workspace/use-create-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";@@ -17,17 +18,24 @@ export function CreateWorkspaceModal({}: CreateWorkspaceModalProps) {const [name, setName] = useState("");const queryClient = useQueryClient();+ const navigate = useNavigate();const { mutateAsync } = useCreateWorkspace({ name });const handleSubmit = async (e: React.FormEvent) => {e.preventDefault();if (!name.trim()) return;- await mutateAsync();+ const createdWorkspace = await mutateAsync();await queryClient.invalidateQueries({ queryKey: ["workspaces"] });setName("");onClose();+ navigate({+ to: "/dashboard/workspace/$workspaceId",+ params: {+ workspaceId: createdWorkspace.id,+ },+ });};return (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.tsxindex da8a03472..a02ef87f3 100644--- 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@@ -72,7 +72,9 @@ function WorkspacePicker() {{workspace.name}</DropdownMenu.Item>))}- <DropdownMenu.Separator className="h-px bg-zinc-200 dark:bg-zinc-700 my-1" />+ {workspaces && workspaces.length > 0 && (+ <DropdownMenu.Separator className="h-px bg-zinc-200 dark:bg-zinc-700 my-1" />+ )}<DropdownMenu.ItemclassName="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={() => setIsCreateWorkspaceOpen(true)}diff --git a/apps/web/src/components/kanban-board/task-card.tsx b/apps/web/src/components/kanban-board/task-card.tsxindex 71807e36a..5394c2a28 100644--- a/apps/web/src/components/kanban-board/task-card.tsx+++ b/apps/web/src/components/kanban-board/task-card.tsx@@ -1,3 +1,4 @@+import useProjectStore from "@/store/project";import type { Task } from "@/types/project";import { useSortable } from "@dnd-kit/sortable";import { CSS } from "@dnd-kit/utilities";@@ -18,6 +19,7 @@ function TaskCard({ task }: TaskCardProps) {transition,isDragging,} = useSortable({ id: task.id });+ const { project } = useProjectStore();const style: CSSProperties = {transform: CSS.Transform.toString(transform),@@ -42,16 +44,16 @@ function TaskCard({ task }: TaskCardProps) {{...listeners}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">+ <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>+<div className="flex items-center gap-2 mb-2"><h3 className="font-medium text-zinc-900 dark:text-zinc-100 max-w-4/5 truncate">{task.title}</h3></div>- <p className="text-sm text-zinc-600 dark:text-zinc-400 truncate mb-3 line-clamp-2">- {task.description}- </p>-<div className="flex items-center gap-2 mt-auto">{task.assigneeName ? (<divdiff --git a/apps/web/src/components/task/create-task-modal.tsx b/apps/web/src/components/task/create-task-modal.tsxindex 09226330b..8ba0107e6 100644--- a/apps/web/src/components/task/create-task-modal.tsx+++ b/apps/web/src/components/task/create-task-modal.tsx@@ -15,9 +15,10 @@ import useWorkspaceStore from "@/store/workspace";import { zodResolver } from "@hookform/resolvers/zod";import * as Dialog from "@radix-ui/react-dialog";import { produce } from "immer";-import { X } from "lucide-react";+import { Flag, UserIcon, X } from "lucide-react";import { useForm } from "react-hook-form";import { z } from "zod";+import { Select } from "../ui/select";interface CreateTaskModalProps {open: boolean;@@ -152,21 +153,23 @@ export function CreateTaskModal({Asignees</FormLabel><FormControl>- <select+ <Select{...field}- className="w-full rounded-md border border-zinc-200 dark:border-zinc-700/50 bg-white dark:bg-zinc-800/50 px-3 py-2 text-sm text-zinc-900 dark:text-zinc-100 focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:focus:ring-indigo-400"- >- {users &&- users.length > 0 &&- users?.map((user) => (- <option- key={user?.userId}- value={user?.userId ?? ""}- >- {user.userName}- </option>- ))}- </select>+ options={[+ {+ value: "",+ label: "Unassigned",+ icon: (+ <UserIcon className="w-4 h-4 text-zinc-400" />+ ),+ },+ ...(users ?? []).map((user) => ({+ value: user.userId ?? "",+ label: user.userName ?? "",+ })),+ ]}+ placeholder="Select assignee"+ /></FormControl><FormMessage /></FormItem>@@ -182,15 +185,38 @@ export function CreateTaskModal({Priority</FormLabel><FormControl>- <select+ <Select{...field}- className="w-full rounded-md border border-zinc-200 dark:border-zinc-700/50 bg-white dark:bg-zinc-800/50 px-3 py-2 text-sm text-zinc-900 dark:text-zinc-100 focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:focus:ring-indigo-400"- >- <option value="low">Low</option>- <option value="medium">Medium</option>- <option value="high">High</option>- <option value="urgent">Urgent</option>- </select>+ 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-orange-500" />+ ),+ },+ {+ value: "urgent",+ label: "Urgent",+ icon: <Flag className="w-4 h-4 text-red-500" />,+ },+ ]}+ placeholder="Select priority"+ /></FormControl><FormMessage /></FormItem>diff --git a/apps/web/src/components/ui/select.tsx b/apps/web/src/components/ui/select.tsxnew file mode 100644index 000000000..ecba3411a--- /dev/null+++ b/apps/web/src/components/ui/select.tsx@@ -0,0 +1,108 @@+import { cn } from "@/lib/cn";+import { Check, ChevronDown } 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;+}++interface SelectProps {+ value: string;+ onChange: (value: string) => void;+ options: SelectOption[];+ placeholder?: string;+ className?: string;+}++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);++ useEffect(() => {+ function handleClickOutside(event: MouseEvent) {+ if (+ containerRef.current &&+ !containerRef.current.contains(event.target as Node)+ ) {+ setIsOpen(false);+ }+ }++ document.addEventListener("mousedown", handleClickOutside);+ return () => document.removeEventListener("mousedown", handleClickOutside);+ }, []);++ return (+ <div className="relative" ref={containerRef}>+ <button+ type="button"+ onClick={() => setIsOpen(!isOpen)}+ 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",+ className,+ )}+ >+ <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>+ )}+ </div>+ <ChevronDown className="w-4 h-4 text-zinc-500 dark:text-zinc-400" />+ </button>++ {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>+ )}+ </div>+ );+}diff --git a/apps/web/src/fetchers/project/create-project.ts b/apps/web/src/fetchers/project/create-project.tsindex 401313ea3..f1e8b3124 100644--- a/apps/web/src/fetchers/project/create-project.ts+++ b/apps/web/src/fetchers/project/create-project.ts@@ -2,15 +2,15 @@ import { api } from "@kaneo/libs";async function createProject({name,- description,+ slug,workspaceId,icon,-}: { name: string; description: string; workspaceId: string; icon: string }) {+}: { name: string; slug: string; workspaceId: string; icon: string }) {const response = await api.project.create.post({name,- description,workspaceId,icon,+ slug,});if (response.error) {diff --git a/apps/web/src/fetchers/workspace/create-workspace.ts b/apps/web/src/fetchers/workspace/create-workspace.tsindex 57f566054..29b297fa6 100644--- a/apps/web/src/fetchers/workspace/create-workspace.ts+++ b/apps/web/src/fetchers/workspace/create-workspace.ts@@ -7,7 +7,7 @@ const createWorkspace = async ({ name }: { name: string }) => {throw new Error(response.error.value.message);}- return response;+ return response.data;};export default createWorkspace;diff --git a/apps/web/src/hooks/mutations/project/use-create-project.ts b/apps/web/src/hooks/mutations/project/use-create-project.tsindex 534d7bdf9..e27033284 100644--- a/apps/web/src/hooks/mutations/project/use-create-project.ts+++ b/apps/web/src/hooks/mutations/project/use-create-project.ts@@ -3,12 +3,12 @@ import { useMutation } from "@tanstack/react-query";function useCreateProject({name,- description,+ slug,workspaceId,icon,-}: { name: string; description: string; workspaceId: string; icon: string }) {+}: { name: string; slug: string; workspaceId: string; icon: string }) {return useMutation({- mutationFn: () => createProject({ name, description, workspaceId, icon }),+ mutationFn: () => createProject({ name, slug, workspaceId, icon }),});}diff --git a/apps/web/src/hooks/mutations/task/use-create-task.ts b/apps/web/src/hooks/mutations/task/use-create-task.tsindex 6efe12096..07592ea7c 100644--- a/apps/web/src/hooks/mutations/task/use-create-task.ts+++ b/apps/web/src/hooks/mutations/task/use-create-task.ts@@ -8,6 +8,7 @@ type CreateTaskInput = {projectId: string;status: string;dueDate: Date;+ number?: number;priority: "low" | "medium" | "high" | "urgent";};diff --git a/apps/web/src/lib/generate-project-id.ts b/apps/web/src/lib/generate-project-id.tsnew file mode 100644index 000000000..18611a640--- /dev/null+++ b/apps/web/src/lib/generate-project-id.ts@@ -0,0 +1,17 @@+function generateProjectSlug(projectName: string) {+ const words = projectName+ .toUpperCase()+ .replace(/[^A-Z0-9\s]/g, "")+ .split(/\s+/);++ if (words.length === 1) {+ return words[0].slice(0, 3);+ }++ return words+ .slice(0, 3)+ .map((word) => word[0])+ .join("");+}++export default generateProjectSlug;diff --git a/apps/web/src/types/project/index.ts b/apps/web/src/types/project/index.tsindex 97932b749..1d4f684a6 100644--- a/apps/web/src/types/project/index.ts+++ b/apps/web/src/types/project/index.ts@@ -1,6 +1,7 @@export type Project = {id: string;name: string;+ slug: string;description: string | null;workspaceId: string;columns?: Column[];@@ -15,6 +16,7 @@ export type Column = {export type Task = {id: string;createdAt: Date;+ number: number | null;description: string | null;projectId: string;assigneeId: string;diff --git a/bun.lockb b/bun.lockbindex 541e6b34e..8be6c823a 100755Binary files a/bun.lockb and b/bun.lockb differ