⚡ 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 icons
Andrej500783eb12a2
diff --git a/apps/api/drizzle/0000_powerful_magneto.sql b/apps/api/drizzle/0000_unusual_frank_castle.sqlsimilarity index 83%rename from apps/api/drizzle/0000_powerful_magneto.sqlrename to apps/api/drizzle/0000_unusual_frank_castle.sqlindex f8b850859..bc014a716 100644--- a/apps/api/drizzle/0000_powerful_magneto.sql+++ b/apps/api/drizzle/0000_unusual_frank_castle.sql@@ -1,9 +1,10 @@CREATE TABLE `project` (`id` text PRIMARY KEY NOT NULL,`workspace_id` text NOT NULL,+ `icon` text DEFAULT 'Layout',`name` text NOT NULL,`description` text,- `created_at` integer DEFAULT '"2025-01-25T23:50:45.754Z"' NOT NULL,+ `created_at` integer DEFAULT '"2025-02-08T16:18:40.042Z"' NOT NULL,FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE cascade ON DELETE cascade);--> statement-breakpoint@@ -23,7 +24,7 @@ CREATE TABLE `task` (`status` text DEFAULT 'to-do' NOT NULL,`priority` text DEFAULT 'low',`due_date` integer,- `created_at` integer DEFAULT '"2025-01-25T23:50:45.754Z"' NOT NULL,+ `created_at` integer DEFAULT '"2025-02-08T16:18:40.042Z"' 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);@@ -33,7 +34,7 @@ CREATE TABLE `user` (`name` text NOT NULL,`password` text NOT NULL,`email` text NOT NULL,- `created_at` integer DEFAULT '"2025-01-25T23:50:45.753Z"' NOT NULL+ `created_at` integer DEFAULT '"2025-02-08T16:18:40.041Z"' NOT NULL);--> statement-breakpointCREATE UNIQUE INDEX `user_email_unique` ON `user` (`email`);--> statement-breakpoint@@ -42,7 +43,7 @@ CREATE TABLE `workspace` (`name` text NOT NULL,`description` text,`owner_id` text NOT NULL,- `created_at` integer DEFAULT '"2025-01-25T23:50:45.754Z"' NOT NULL,+ `created_at` integer DEFAULT '"2025-02-08T16:18:40.041Z"' NOT NULL,FOREIGN KEY (`owner_id`) REFERENCES `user`(`id`) ON UPDATE cascade ON DELETE cascade);--> statement-breakpoint@@ -51,7 +52,7 @@ CREATE TABLE `workspace_member` (`workspace_id` text NOT NULL,`user_id` text NOT NULL,`role` text,- `joined_at` integer DEFAULT '"2025-01-25T23:50:45.754Z"' NOT NULL,+ `joined_at` integer DEFAULT '"2025-02-08T16:18:40.042Z"' 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 6d2a10ec7..186177dfb 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": "0bc2ad49-3384-4972-89cf-56af7f84a77f",+ "id": "29ea78f9-027a-4b6c-b0bc-0746a33ff8f1","prevId": "00000000-0000-0000-0000-000000000000","tables": {"project": {@@ -21,6 +21,14 @@"notNull": true,"autoincrement": false},+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "'Layout'"+ },"name": {"name": "name","type": "text",@@ -41,7 +49,7 @@"primaryKey": false,"notNull": true,"autoincrement": false,- "default": "'\"2025-01-25T23:50:45.754Z\"'"+ "default": "'\"2025-02-08T16:18:40.042Z\"'"}},"indexes": {},@@ -168,7 +176,7 @@"primaryKey": false,"notNull": true,"autoincrement": false,- "default": "'\"2025-01-25T23:50:45.754Z\"'"+ "default": "'\"2025-02-08T16:18:40.042Z\"'"}},"indexes": {},@@ -233,7 +241,7 @@"primaryKey": false,"notNull": true,"autoincrement": false,- "default": "'\"2025-01-25T23:50:45.753Z\"'"+ "default": "'\"2025-02-08T16:18:40.041Z\"'"}},"indexes": {@@ -285,7 +293,7 @@"primaryKey": false,"notNull": true,"autoincrement": false,- "default": "'\"2025-01-25T23:50:45.754Z\"'"+ "default": "'\"2025-02-08T16:18:40.041Z\"'"}},"indexes": {},@@ -341,7 +349,7 @@"primaryKey": false,"notNull": true,"autoincrement": false,- "default": "'\"2025-01-25T23:50:45.754Z\"'"+ "default": "'\"2025-02-08T16:18:40.042Z\"'"}},"indexes": {},diff --git a/apps/api/drizzle/meta/_journal.json b/apps/api/drizzle/meta/_journal.jsonindex 8114680ce..2666e75e7 100644--- a/apps/api/drizzle/meta/_journal.json+++ b/apps/api/drizzle/meta/_journal.json@@ -5,8 +5,8 @@{"idx": 0,"version": "6",- "when": 1737849045760,- "tag": "0000_powerful_magneto",+ "when": 1739031520048,+ "tag": "0000_unusual_frank_castle","breakpoints": true}]diff --git a/apps/api/src/database/schema.ts b/apps/api/src/database/schema.tsindex f9af7b318..8e8c250d7 100644--- a/apps/api/src/database/schema.ts+++ b/apps/api/src/database/schema.ts@@ -75,6 +75,7 @@ export const projectTable = sqliteTable("project", {onDelete: "cascade",onUpdate: "cascade",}),+ icon: text("icon").default("Layout"),name: text("name").notNull(),description: text("description"),createdAt: integer("created_at", { mode: "timestamp" })diff --git a/apps/api/src/project/controllers/create-project.ts b/apps/api/src/project/controllers/create-project.tsindex 4730b7cfb..0145e75e9 100644--- a/apps/api/src/project/controllers/create-project.ts+++ b/apps/api/src/project/controllers/create-project.ts@@ -3,7 +3,10 @@ import { projectTable } from "../../database/schema";import type { CreateProjectPayload } from "../db/queries";function createProject(- body: Pick<CreateProjectPayload, "name" | "description" | "workspaceId">,+ body: Pick<+ CreateProjectPayload,+ "name" | "description" | "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 9010798d5..990aed50d 100644--- a/apps/api/src/project/controllers/get-projects.ts+++ b/apps/api/src/project/controllers/get-projects.ts@@ -13,6 +13,7 @@ async function getProjects({description: projectTable.description,workspaceId: projectTable.workspaceId,createdAt: projectTable.createdAt,+ icon: projectTable.icon,workspace: {id: workspaceTable.id,name: workspaceTable.name,diff --git a/apps/api/src/project/index.ts b/apps/api/src/project/index.tsindex d1c203fc7..2062cadf0 100644--- a/apps/api/src/project/index.ts+++ b/apps/api/src/project/index.ts@@ -19,6 +19,7 @@ const project = new Elysia({ prefix: "/project" })name: t.String(),workspaceId: t.String(),description: t.String(),+ icon: t.String(),}),},)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 4220d84ee..94d11571c 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@@ -1,6 +1,8 @@import { Button } from "@/components/ui/button";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 useWorkspaceStore from "@/store/workspace";import * as Dialog from "@radix-ui/react-dialog";import { useQueryClient } from "@tanstack/react-query";@@ -15,13 +17,16 @@ type CreateProjectModalProps = {function CreateProjectModal({ open, onClose }: CreateProjectModalProps) {const [name, setName] = useState("");const [description, setDescription] = useState("");+ const [selectedIcon, setSelectedIcon] = useState("Layout");const queryClient = useQueryClient();const { workspace } = useWorkspaceStore();const { mutateAsync } = useCreateProject({name,description,workspaceId: workspace?.id ?? "",+ icon: selectedIcon,});+ const IconComponent = icons[selectedIcon as keyof typeof icons];const handleSubmit = async (e: React.FormEvent) => {e.preventDefault();@@ -31,6 +36,8 @@ function CreateProjectModal({ open, onClose }: CreateProjectModalProps) {await queryClient.invalidateQueries({ queryKey: ["projects"] });setName("");+ setDescription("");+ setSelectedIcon("Layout");onClose();};@@ -84,6 +91,40 @@ function CreateProjectModal({ open, onClose }: CreateProjectModalProps) {/></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">+ 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]) => (+ <button+ key={name}+ type="button"+ onClick={() => setSelectedIcon(name)}+ className={cn(+ "p-2 rounded-lg transition-colors flex items-center justify-center group",+ selectedIcon === 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-5 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>+ <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>+<div className="flex justify-end gap-2"><Dialog.Close asChild><Buttondiff --git a/apps/web/src/components/common/sidebar/sections/projects/index.tsx b/apps/web/src/components/common/sidebar/sections/projects/index.tsxindex 92d773379..8a19387a0 100644--- a/apps/web/src/components/common/sidebar/sections/projects/index.tsx+++ b/apps/web/src/components/common/sidebar/sections/projects/index.tsx@@ -4,8 +4,8 @@ import useProjectStore from "@/store/project";import { useUserPreferencesStore } from "@/store/user-preferences";import type { Project } from "@/types/project";import { useNavigate } from "@tanstack/react-router";-import { Layout, Plus } from "lucide-react";-import { useState } from "react";+import { Layout, Plus, icons } from "lucide-react";+import { createElement, useState } from "react";import CreateProjectModal from "./create-project-modal";type ProjectsProps = {@@ -76,12 +76,15 @@ function Projects({ workspaceId }: ProjectsProps) {: "text-zinc-601 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",)}>- <Layout- className={cn(- "shrink-0",- !isSidebarOpened ? "w-6 h-6" : "w-4 h-4 mr-2",- )}- />+ {createElement(+ icons[project.icon as keyof typeof icons] || Layout,+ {+ className: cn(+ "shrink-0",+ !isSidebarOpened ? "w-6 h-6" : "w-4 h-4 mr-2",+ ),+ },+ )}{isSidebarOpened && project.name}</button>))}diff --git a/apps/web/src/constants/project-icons.ts b/apps/web/src/constants/project-icons.tsnew file mode 100644index 000000000..0253818b3--- /dev/null+++ b/apps/web/src/constants/project-icons.ts@@ -0,0 +1,129 @@+import {+ BookOpen,+ Bookmark,+ Box,+ Boxes,+ Briefcase,+ Building2,+ Calendar,+ CircuitBoard,+ Code,+ Cog,+ Database,+ FileText,+ Flag,+ FlaskConical,+ Folder,+ FolderKanban,+ GitBranch,+ Globe,+ Heart,+ Home,+ Image,+ Layers,+ Layout,+ Lightbulb,+ Link2,+ List,+ MessageSquare,+ Music,+ Package,+ Palette,+ PenTool,+ Phone,+ PieChart,+ Puzzle,+ Radio,+ Rocket,+ ScrollText,+ Search,+ Settings,+ Share2,+ Shield,+ ShoppingBag,+ Smile,+ Star,+ Table,+ Tags,+ Target,+ Terminal,+ ThumbsUp,+ Timer,+ PenTool as Tool,+ Trash2,+ Trophy,+ Tv2,+ User,+ Users,+ Video,+ Wallet,+ Wand2,+ Watch,+ Zap,+} from "lucide-react";++const icons = {+ Layout,+ Briefcase,+ FolderKanban,+ Target,+ Rocket,+ Code,+ Box,+ Boxes,+ BookOpen,+ Bookmark,+ Building2,+ Calendar,+ CircuitBoard,+ Cog,+ Database,+ FileText,+ Flag,+ FlaskConical,+ Folder,+ GitBranch,+ Globe,+ Heart,+ Home,+ Image,+ Layers,+ Lightbulb,+ Link2,+ List,+ MessageSquare,+ Music,+ Package,+ Palette,+ PenTool,+ Phone,+ PieChart,+ Puzzle,+ Radio,+ ScrollText,+ Search,+ Settings,+ Share2,+ Shield,+ ShoppingBag,+ Smile,+ Star,+ Table,+ Tags,+ Terminal,+ ThumbsUp,+ Timer,+ Tool,+ Trash2,+ Trophy,+ Tv2,+ User,+ Users,+ Video,+ Wallet,+ Wand2,+ Watch,+ Zap,+};++export default icons;diff --git a/apps/web/src/fetchers/project/create-project.ts b/apps/web/src/fetchers/project/create-project.tsindex 31a30a94f..401313ea3 100644--- a/apps/web/src/fetchers/project/create-project.ts+++ b/apps/web/src/fetchers/project/create-project.ts@@ -4,11 +4,13 @@ async function createProject({name,description,workspaceId,-}: { name: string; description: string; workspaceId: string }) {+ icon,+}: { name: string; description: string; workspaceId: string; icon: string }) {const response = await api.project.create.post({name,description,workspaceId,+ icon,});if (response.error) {diff --git a/apps/web/src/hooks/mutations/project/use-create-project.ts b/apps/web/src/hooks/mutations/project/use-create-project.tsindex 26f35f730..534d7bdf9 100644--- a/apps/web/src/hooks/mutations/project/use-create-project.ts+++ b/apps/web/src/hooks/mutations/project/use-create-project.ts@@ -5,9 +5,10 @@ function useCreateProject({name,description,workspaceId,-}: { name: string; description: string; workspaceId: string }) {+ icon,+}: { name: string; description: string; workspaceId: string; icon: string }) {return useMutation({- mutationFn: () => createProject({ name, description, workspaceId }),+ mutationFn: () => createProject({ name, description, workspaceId, icon }),});}