diff --git a/frontend/src/components/Sidebar/ActiveWorkspaces/index.jsx b/frontend/src/components/Sidebar/ActiveWorkspaces/index.jsx index da052b643..cd2959a89 100644 --- a/frontend/src/components/Sidebar/ActiveWorkspaces/index.jsx +++ b/frontend/src/components/Sidebar/ActiveWorkspaces/index.jsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect, useCallback } from "react"; +import React, { useState, useEffect } from "react"; import * as Skeleton from "react-loading-skeleton"; import "react-loading-skeleton/dist/skeleton.css"; import Workspace from "@/models/workspace"; @@ -8,7 +8,6 @@ import ManageWorkspace, { import paths from "@/utils/paths"; import { useParams } from "react-router-dom"; import { GearSix, SquaresFour, UploadSimple } from "@phosphor-icons/react"; -import truncate from "truncate"; import useUser from "@/hooks/useUser"; import ThreadContainer from "./ThreadContainer"; import { Link, useMatch } from "react-router-dom"; @@ -18,9 +17,6 @@ export default function ActiveWorkspaces() { const [loading, setLoading] = useState(true); const [workspaces, setWorkspaces] = useState([]); const [selectedWs, setSelectedWs] = useState(null); - const [hoverStates, setHoverStates] = useState({}); - const [gearHover, setGearHover] = useState({}); - const [uploadHover, setUploadHover] = useState({}); const { showing, showModal, hideModal } = useManageWorkspaceModal(); const { user } = useUser(); const isInWorkspaceSettings = !!useMatch("/workspace/:slug/settings/:tab"); @@ -33,41 +29,17 @@ export default function ActiveWorkspaces() { } getWorkspaces(); }, []); - const handleMouseEnter = useCallback((workspaceId) => { - setHoverStates((prev) => ({ ...prev, [workspaceId]: true })); - }, []); - - const handleMouseLeave = useCallback((workspaceId) => { - setHoverStates((prev) => ({ ...prev, [workspaceId]: false })); - }, []); - const handleGearMouseEnter = useCallback((workspaceId) => { - setGearHover((prev) => ({ ...prev, [workspaceId]: true })); - }, []); - - const handleGearMouseLeave = useCallback((workspaceId) => { - setGearHover((prev) => ({ ...prev, [workspaceId]: false })); - }, []); - - const handleUploadMouseEnter = useCallback((workspaceId) => { - setUploadHover((prev) => ({ ...prev, [workspaceId]: true })); - }, []); - - const handleUploadMouseLeave = useCallback((workspaceId) => { - setUploadHover((prev) => ({ ...prev, [workspaceId]: false })); - }, []); if (loading) { return ( - <> - - + ); } @@ -75,81 +47,59 @@ export default function ActiveWorkspaces() {
{workspaces.map((workspace) => { const isActive = workspace.slug === slug; - const isHovered = hoverStates[workspace.id]; return (
handleMouseEnter(workspace.id)} - onMouseLeave={() => handleMouseLeave(workspace.id)} + className="flex flex-col w-full group" key={workspace.id} role="listitem" > -
+
-
+

- {isActive || isHovered - ? truncate(workspace.name, 15) - : truncate(workspace.name, 20)} + {workspace.name}

- {(isActive || isHovered || gearHover[workspace.id]) && - user?.role !== "default" ? ( -
-
- -
- - + + handleGearMouseEnter(workspace.id)} - onMouseLeave={() => handleGearMouseLeave(workspace.id)} - className="rounded-md flex items-center justify-center text-[#A7A8A9] hover:text-white ml-auto" + className="rounded-md flex items-center justify-center text-[#A7A8A9] hover:text-white ml-auto p-[2px] hover:bg-[#646768]" aria-label="General appearance settings" > -
- -
+
- ) : null} + )}