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.

chore: updating logic for sidebar

Andrejf35965345044
diff --git a/apps/web/src/components/common/sidebar/sections/projects/index.tsx b/apps/web/src/components/common/sidebar/sections/projects/index.tsx
index 39ad1d5a1..d760f03dd 100644
--- a/apps/web/src/components/common/sidebar/sections/projects/index.tsx
+++ b/apps/web/src/components/common/sidebar/sections/projects/index.tsx
@@ -1,3 +1,9 @@
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
import useGetProjects from "@/hooks/queries/project/use-get-projects";
import { cn } from "@/lib/cn";
import useProjectStore from "@/store/project";
@@ -82,47 +88,57 @@ function Projects({ workspaceId }: ProjectsProps) {
</div>
<div className="space-y-0.5">
{projects && projects.length > 0
- ? projects.map((project) => (
- <button
- type="button"
- key={project.id}
- onClick={() => handleSelectProject(project)}
- className={cn(
- "w-full px-4 py-2 rounded-md flex items-center text-sm transition-all group relative",
- !isSidebarOpened && "px-3",
- !isSidebarOpened && "justify-center px-2",
- location.pathname.includes("/board") &&
- 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: cn(
- "shrink-0",
- !isSidebarOpened ? "w-6 h-6" : "w-4 h-4 mr-2",
- ),
- },
- )}
-
- {!isSidebarOpened && (
- <div
- className={cn(
- "fixed z-[100] px-2 py-1 bg-black text-white text-xs rounded-md whitespace-nowrap opacity-0 transition-opacity",
- "group-hover:opacity-100",
- )}
- >
- {project.name.length < 5
- ? project.name
- : `${project.name.substring(0, 5)}...`}
- </div>
- )}
-
- {isSidebarOpened && project.name}
- </button>
- ))
+ ? projects.map((project) =>
+ !isSidebarOpened ? (
+ <TooltipProvider key={project.id}>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button
+ type="button"
+ onClick={() => handleSelectProject(project)}
+ className={cn(
+ "w-full px-4 py-2 rounded-md flex items-center text-sm transition-all group",
+ "justify-center px-2",
+ location.pathname.includes("/board") &&
+ 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>
+ </TooltipTrigger>
+ <TooltipContent side="right">{project.name}</TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ ) : (
+ <button
+ type="button"
+ key={project.id}
+ onClick={() => handleSelectProject(project)}
+ className={cn(
+ "w-full px-4 py-2 rounded-md flex items-center text-sm transition-all group",
+ location.pathname.includes("/board") &&
+ 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-4 h-4 mr-2 shrink-0",
+ },
+ )}
+ {project.name}
+ </button>
+ ),
+ )
: 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">