⚡ 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(frontend): :sparkles: adds cmd+k
Andrej70e0407c0cc0
diff --git a/apps/web/src/components/command-palette/command-group.tsx b/apps/web/src/components/command-palette/command-group.tsxnew file mode 100644index 000000000..d3b5ae6b7--- /dev/null+++ b/apps/web/src/components/command-palette/command-group.tsx@@ -0,0 +1,20 @@+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.tsxnew file mode 100644index 000000000..e473be924--- /dev/null+++ b/apps/web/src/components/command-palette/index.tsx@@ -0,0 +1,262 @@+import CreateProjectModal from "@/components/shared/modals/create-project-modal";+import CreateTaskModal from "@/components/shared/modals/create-task-modal";+import CreateWorkspaceModal from "@/components/shared/modals/create-workspace-modal";+import { cn } from "@/lib/cn";+import useProjectStore from "@/store/project";+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, LayoutGrid, Plus, Search, Settings } from "lucide-react";+import { useEffect, useState } from "react";+import CommandGroup from "./command-group";++export function CommandPalette() {+ const [open, setOpen] = useState(false);+ const [isCreateProjectOpen, setIsCreateProjectOpen] = useState(false);+ const [isCreateTaskOpen, setIsCreateTaskOpen] = useState(false);+ const [isCreateWorkspaceOpen, setIsCreateWorkspaceOpen] = useState(false);+ const [pendingAction, setPendingAction] = useState<{+ type: "task" | "project" | "workspace";+ status?: string;+ } | null>(null);+ const { workspace } = useWorkspaceStore();+ const { project } = useProjectStore();+ const navigate = useNavigate();++ useEffect(() => {+ let timeout: Timer;+ 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);+ }, []);++ 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",+ )}+ >+ <Command.Dialog+ open={open}+ onOpenChange={setOpen}+ label="Global Command Menu"+ 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="flex items-center gap-4 px-3 pb-4 mb-4 border-b border-zinc-200 dark:border-zinc-800">+ <Search className="w-5 h-5 text-zinc-500 dark:text-zinc-400" />+ <Command.Input+ placeholder="Type a command or search..."+ 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>+ <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>+ <CommandGroup heading="Tasks">+ <Command.Item+ onSelect={() => {+ setOpen(false);+ setPendingAction({ type: "task", status: "to-do" });+ }}+ disabled={!project}+ className={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",+ )}+ >+ <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={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",+ )}+ >+ <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>++ {project && (+ <Command.Item+ onSelect={() => {+ setOpen(false);+ navigate({+ to: "/dashboard/workspace/$workspaceId/project/$projectId/board",+ params: {+ workspaceId: workspace?.id ?? "",+ projectId: project.id,+ },+ });+ }}+ className={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",+ )}+ >+ <LayoutGrid className="w-4 h-4" />+ Go to board+ </Command.Item>+ )}++ {project && (+ <Command.Item+ onSelect={() => {+ setOpen(false);+ navigate({+ to: "/dashboard/workspace/$workspaceId/project/$projectId/settings",+ params: {+ workspaceId: workspace?.id ?? "",+ projectId: project.id,+ },+ });+ }}+ className={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",+ )}+ >+ <Settings className="w-4 h-4" />+ Project settings+ </Command.Item>+ )}+ </CommandGroup>++ <CommandGroup heading="Workspace" className="mt-4 mb-2">+ <Command.Item+ onSelect={() => {+ setOpen(false);+ setPendingAction({ type: "workspace" });+ }}+ className={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",+ )}+ >+ <Plus className="w-4 h-4" />+ Create new workspace+ </Command.Item>+ </CommandGroup>+ </Command.List>+ </Command.Dialog>+ </motion.div>+ </>+ )}+ </AnimatePresence>++ <CreateProjectModal+ open={isCreateProjectOpen}+ onClose={() => setIsCreateProjectOpen(false)}+ />+ <CreateTaskModal+ open={isCreateTaskOpen}+ onClose={() => setIsCreateTaskOpen(false)}+ status="to-do"+ />+ <CreateWorkspaceModal+ open={isCreateWorkspaceOpen}+ onClose={() => setIsCreateWorkspaceOpen(false)}+ />+ </>+ );+}diff --git a/apps/web/src/components/common/sidebar/sections/projects/index.tsx b/apps/web/src/components/common/sidebar/sections/projects/index.tsxindex 1afc25af6..7a0bf2c73 100644--- a/apps/web/src/components/common/sidebar/sections/projects/index.tsx+++ b/apps/web/src/components/common/sidebar/sections/projects/index.tsx@@ -8,7 +8,7 @@ import type { Project } from "@/types/project";import { useLocation, useNavigate } from "@tanstack/react-router";import { Layout, LayoutDashboard, Plus, Settings } from "lucide-react";import { createElement, useState } from "react";-import CreateProjectModal from "./create-project-modal";+import CreateProjectModal from "../../../../shared/modals/create-project-modal";type ProjectsProps = {workspaceId: string;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.tsxindex 1673159df..bda5f6c66 100644--- 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@@ -1,6 +1,6 @@import { Plus } from "lucide-react";import { useState } from "react";-import { CreateWorkspaceModal } from "./create-workspace-modal";+import CreateWorkspaceModal from "../../../../../shared/modals/create-workspace-modal";function AddWorkspace() {const [isAddWorkspaceModalOpen, setIsAddWorkspaceModalOpen] =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 ffe7a087f..1112851d8 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@@ -8,7 +8,7 @@ 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 "./create-workspace-modal";+import CreateWorkspaceModal from "../../../../../shared/modals/create-workspace-modal";function WorkspacePicker() {const { workspace: selectedWorkspace, setWorkspace } = useWorkspaceStore();diff --git a/apps/web/src/components/dashboard/empty-state.tsx b/apps/web/src/components/dashboard/empty-state.tsxindex 425544685..c5fe4a2cd 100644--- a/apps/web/src/components/dashboard/empty-state.tsx+++ b/apps/web/src/components/dashboard/empty-state.tsx@@ -1,7 +1,7 @@import { motion } from "framer-motion";import { LayoutGrid, Plus, Sparkles } from "lucide-react";import { useState } from "react";-import { CreateWorkspaceModal } from "../common/sidebar/sections/workspaces/components/create-workspace-modal";+import CreateWorkspaceModal from "../shared/modals/create-workspace-modal";function EmptyDashboardState() {const [isCreateWorkspaceOpen, setIsCreateWorkspaceOpen] = useState(false);diff --git a/apps/web/src/components/kanban-board/column/column-header.tsx b/apps/web/src/components/kanban-board/column/column-header.tsxindex 6d4e1aa7d..56300e735 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,4 @@-import { CreateTaskModal } from "@/components/task/create-task-modal";+import CreateTaskModal from "@/components/shared/modals/create-task-modal";import toKebabCase from "@/lib/to-kebab-case";import type { Column } from "@/types/project";import { Plus } from "lucide-react";diff --git a/apps/web/src/components/project/empty-state.tsx b/apps/web/src/components/project/empty-state.tsxindex edad799a5..977dc65cc 100644--- a/apps/web/src/components/project/empty-state.tsx+++ b/apps/web/src/components/project/empty-state.tsx@@ -1,7 +1,7 @@import { motion } from "framer-motion";import { LayoutGrid, Plus, Sparkles } from "lucide-react";import { useState } from "react";-import CreateProjectModal from "../common/sidebar/sections/projects/create-project-modal";+import CreateProjectModal from "../shared/modals/create-project-modal";function EmptyProjectState() {const [isCreateProjectOpen, setIsCreateProjectOpen] = useState(false);diff --git a/apps/web/src/components/common/sidebar/sections/projects/create-project-modal.tsx b/apps/web/src/components/shared/modals/create-project-modal.tsxsimilarity index 100%rename from apps/web/src/components/common/sidebar/sections/projects/create-project-modal.tsxrename to apps/web/src/components/shared/modals/create-project-modal.tsxdiff --git a/apps/web/src/components/task/create-task-modal.tsx b/apps/web/src/components/shared/modals/create-task-modal.tsxsimilarity index 98%rename from apps/web/src/components/task/create-task-modal.tsxrename to apps/web/src/components/shared/modals/create-task-modal.tsxindex 3a2af3b3e..7ac81705b 100644--- a/apps/web/src/components/task/create-task-modal.tsx+++ b/apps/web/src/components/shared/modals/create-task-modal.tsx@@ -21,7 +21,7 @@ import { Flag, UserIcon, X } from "lucide-react";import { useForm } from "react-hook-form";import { toast } from "sonner";import { z } from "zod";-import { Select } from "../ui/select";+import { Select } from "../../ui/select";interface CreateTaskModalProps {open: boolean;@@ -38,11 +38,7 @@ const taskSchema = z.object({type TaskFormValues = z.infer<typeof taskSchema>;-export function CreateTaskModal({- open,- onClose,- status,-}: CreateTaskModalProps) {+function CreateTaskModal({ open, onClose, status }: CreateTaskModalProps) {const { project, setProject } = useProjectStore();const { workspace } = useWorkspaceStore();const { mutate: updateTask } = useUpdateTask();@@ -264,3 +260,5 @@ export function CreateTaskModal({</Dialog.Root>);}++export default CreateTaskModal;diff --git a/apps/web/src/components/common/sidebar/sections/workspaces/components/create-workspace-modal.tsx b/apps/web/src/components/shared/modals/create-workspace-modal.tsxsimilarity index 97%rename from apps/web/src/components/common/sidebar/sections/workspaces/components/create-workspace-modal.tsxrename to apps/web/src/components/shared/modals/create-workspace-modal.tsxindex cf109451d..4bf15cb86 100644--- a/apps/web/src/components/common/sidebar/sections/workspaces/components/create-workspace-modal.tsx+++ b/apps/web/src/components/shared/modals/create-workspace-modal.tsx@@ -12,11 +12,7 @@ interface CreateWorkspaceModalProps {open: boolean;onClose: () => void;}--export function CreateWorkspaceModal({- open,- onClose,-}: CreateWorkspaceModalProps) {+function CreateWorkspaceModal({ open, onClose }: CreateWorkspaceModalProps) {const [name, setName] = useState("");const queryClient = useQueryClient();const navigate = useNavigate();@@ -114,3 +110,5 @@ export function CreateWorkspaceModal({</Dialog.Root>);}++export default CreateWorkspaceModal;diff --git a/apps/web/src/components/workspace/empty-state.tsx b/apps/web/src/components/workspace/empty-state.tsxindex c26f59b37..6a873c7b1 100644--- a/apps/web/src/components/workspace/empty-state.tsx+++ b/apps/web/src/components/workspace/empty-state.tsx@@ -1,4 +1,4 @@-import { CreateWorkspaceModal } from "../common/sidebar/sections/workspaces/components/create-workspace-modal";+import CreateWorkspaceModal from "../shared/modals/create-workspace-modal";import { LayoutGrid, Plus } from "lucide-react";import { useState } from "react";diff --git a/apps/web/src/routes/__root.tsx b/apps/web/src/routes/__root.tsxindex 534e8121b..cbe89c965 100644--- a/apps/web/src/routes/__root.tsx+++ b/apps/web/src/routes/__root.tsx@@ -1,3 +1,4 @@+import { CommandPalette } from "@/components/command-palette";import useTheme from "@/components/providers/theme-provider/hooks/use-theme";import TanStackRouterDevtools from "@/tanstack/router";import type { LoggedInUser } from "@/types/user";@@ -40,6 +41,7 @@ function RootComponent() {<><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"><Outlet />+ <CommandPalette /></div><Toasterposition="bottom-right"