From 5683d94d0c6f9d4c48e63afbf6c859d901136a24 Mon Sep 17 00:00:00 2001 From: gakshita Date: Tue, 11 Feb 2025 16:09:27 +0530 Subject: [PATCH 1/6] fix: Handled workspace switcher closing on click --- .../workspace/sidebar/dropdown-item.tsx | 5 +++- .../components/workspace/sidebar/dropdown.tsx | 25 +++++-------------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/web/core/components/workspace/sidebar/dropdown-item.tsx b/web/core/components/workspace/sidebar/dropdown-item.tsx index 183a8fdb396..7638b657276 100644 --- a/web/core/components/workspace/sidebar/dropdown-item.tsx +++ b/web/core/components/workspace/sidebar/dropdown-item.tsx @@ -19,9 +19,10 @@ type TProps = { activeWorkspace: IWorkspace | null; handleItemClick: () => void; handleWorkspaceNavigation: (workspace: IWorkspace) => void; + handleClose: () => void; }; const SidebarDropdownItem = observer((props: TProps) => { - const { workspace, activeWorkspace, handleItemClick, handleWorkspaceNavigation } = props; + const { workspace, activeWorkspace, handleItemClick, handleWorkspaceNavigation, handleClose } = props; // router const { workspaceSlug } = useParams(); // hooks @@ -89,6 +90,7 @@ const SidebarDropdownItem = observer((props: TProps) => {
@@ -96,6 +98,7 @@ const SidebarDropdownItem = observer((props: TProps) => { diff --git a/web/core/components/workspace/sidebar/dropdown.tsx b/web/core/components/workspace/sidebar/dropdown.tsx index 8d131594840..ac9acf42e5b 100644 --- a/web/core/components/workspace/sidebar/dropdown.tsx +++ b/web/core/components/workspace/sidebar/dropdown.tsx @@ -46,20 +46,10 @@ export const SidebarDropdown = observer(() => { // popper-js init const { styles, attributes } = usePopper(referenceElement, popperElement, { placement: "right", - modifiers: [ - { - name: "preventOverflow", - options: { - padding: 12, - }, - }, - ], + modifiers: [{ name: "preventOverflow", options: { padding: 12 } }], }); - const handleWorkspaceNavigation = (workspace: IWorkspace) => - updateUserProfile({ - last_workspace_id: workspace?.id, - }); + const handleWorkspaceNavigation = (workspace: IWorkspace) => updateUserProfile({ last_workspace_id: workspace?.id }); const handleSignOut = async () => { await signOut().catch(() => @@ -86,14 +76,12 @@ export const SidebarDropdown = observer(() => { "flex-grow-0 justify-center": sidebarCollapsed, })} > - {({ open }) => ( + {({ open, close }) => ( <>
@@ -108,9 +96,7 @@ export const SidebarDropdown = observer(() => {
From d383cc1257d68ac769396c15d2afa23c4709ccea Mon Sep 17 00:00:00 2001 From: gakshita Date: Tue, 18 Feb 2025 12:57:59 +0530 Subject: [PATCH 2/6] chore: code splitting for search --- web/ce/components/workspace/index.ts | 1 + .../workspace/sidebar/app-search.tsx | 26 +++++++++++++++++++ web/ce/components/workspace/sidebar/index.ts | 1 + .../workspace/sidebar/quick-actions.tsx | 18 ++++--------- .../workspace/sidebar/app-search.tsx | 1 + web/ee/components/workspace/sidebar/index.ts | 1 + 6 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 web/ce/components/workspace/sidebar/app-search.tsx create mode 100644 web/ce/components/workspace/sidebar/index.ts create mode 100644 web/ee/components/workspace/sidebar/app-search.tsx create mode 100644 web/ee/components/workspace/sidebar/index.ts diff --git a/web/ce/components/workspace/index.ts b/web/ce/components/workspace/index.ts index ab13bb3907e..80df908c429 100644 --- a/web/ce/components/workspace/index.ts +++ b/web/ce/components/workspace/index.ts @@ -3,3 +3,4 @@ export * from "./upgrade-badge"; export * from "./billing"; export * from "./delete-workspace-section"; export * from "./members"; +export * from "./sidebar"; diff --git a/web/ce/components/workspace/sidebar/app-search.tsx b/web/ce/components/workspace/sidebar/app-search.tsx new file mode 100644 index 00000000000..6ab92b99604 --- /dev/null +++ b/web/ce/components/workspace/sidebar/app-search.tsx @@ -0,0 +1,26 @@ +import { observer } from "mobx-react"; +import { Search } from "lucide-react"; +// helpers +import { cn } from "@/helpers/common.helper"; +// hooks +import { useAppTheme, useCommandPalette } from "@/hooks/store"; + +export const AppSearch = observer(() => { + // store hooks + const { sidebarCollapsed } = useAppTheme(); + const { toggleCommandPaletteModal } = useCommandPalette(); + + return ( + + ); +}); diff --git a/web/ce/components/workspace/sidebar/index.ts b/web/ce/components/workspace/sidebar/index.ts new file mode 100644 index 00000000000..7562f6934ad --- /dev/null +++ b/web/ce/components/workspace/sidebar/index.ts @@ -0,0 +1 @@ +export * from "./app-search"; diff --git a/web/core/components/workspace/sidebar/quick-actions.tsx b/web/core/components/workspace/sidebar/quick-actions.tsx index c0c8eee9c78..fa44d24b4ee 100644 --- a/web/core/components/workspace/sidebar/quick-actions.tsx +++ b/web/core/components/workspace/sidebar/quick-actions.tsx @@ -1,7 +1,7 @@ import { useRef, useState } from "react"; import { observer } from "mobx-react"; import { useParams } from "next/navigation"; -import { ChevronUp, PenSquare, Search } from "lucide-react"; +import { PenSquare } from "lucide-react"; import { EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; // types @@ -14,6 +14,8 @@ import { cn } from "@/helpers/common.helper"; // hooks import { useAppTheme, useCommandPalette, useEventTracker, useProject, useUserPermissions } from "@/hooks/store"; import useLocalStorage from "@/hooks/use-local-storage"; +// plane web components +import { AppSearch } from "@/plane-web/components/workspace/sidebar/app-search"; export const SidebarQuickActions = observer(() => { const { t } = useTranslation(); @@ -27,7 +29,7 @@ export const SidebarQuickActions = observer(() => { const { workspaceSlug: routerWorkspaceSlug } = useParams(); const workspaceSlug = routerWorkspaceSlug?.toString(); // store hooks - const { toggleCreateIssueModal, toggleCommandPaletteModal } = useCommandPalette(); + const { toggleCreateIssueModal } = useCommandPalette(); const { sidebarCollapsed: isSidebarCollapsed } = useAppTheme(); const { setTrackElement } = useEventTracker(); const { joinedProjectIds } = useProject(); @@ -98,17 +100,7 @@ export const SidebarQuickActions = observer(() => { {t("sidebar.new_work_item")} )} - +
); diff --git a/web/ee/components/workspace/sidebar/app-search.tsx b/web/ee/components/workspace/sidebar/app-search.tsx new file mode 100644 index 00000000000..83826dc2b0e --- /dev/null +++ b/web/ee/components/workspace/sidebar/app-search.tsx @@ -0,0 +1 @@ +export * from "ce/components/workspace/sidebar/app-search"; diff --git a/web/ee/components/workspace/sidebar/index.ts b/web/ee/components/workspace/sidebar/index.ts new file mode 100644 index 00000000000..7562f6934ad --- /dev/null +++ b/web/ee/components/workspace/sidebar/index.ts @@ -0,0 +1 @@ +export * from "./app-search"; From ccea695cc248cbfea371c7a2b573554ea4834a96 Mon Sep 17 00:00:00 2001 From: gakshita Date: Tue, 18 Feb 2025 13:04:02 +0530 Subject: [PATCH 3/6] fix: refactor --- web/ce/components/workspace/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/ce/components/workspace/index.ts b/web/ce/components/workspace/index.ts index 80df908c429..d68c6eca2f5 100644 --- a/web/ce/components/workspace/index.ts +++ b/web/ce/components/workspace/index.ts @@ -2,5 +2,5 @@ export * from "./edition-badge"; export * from "./upgrade-badge"; export * from "./billing"; export * from "./delete-workspace-section"; -export * from "./members"; export * from "./sidebar"; +export * from "./members"; From a12cd5147649bb48c6645e57bd7801472b63fc22 Mon Sep 17 00:00:00 2001 From: gakshita Date: Tue, 18 Feb 2025 13:10:43 +0530 Subject: [PATCH 4/6] fix: quick link error validation --- web/core/components/home/widgets/links/use-links.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/core/components/home/widgets/links/use-links.tsx b/web/core/components/home/widgets/links/use-links.tsx index a2ad8a0cc84..2f2a9c78f37 100644 --- a/web/core/components/home/widgets/links/use-links.tsx +++ b/web/core/components/home/widgets/links/use-links.tsx @@ -42,9 +42,9 @@ export const useLinks = (workspaceSlug: string) => { }); toggleLinkModal(false); } catch (error: any) { - console.error("error", error?.data?.url?.error); + console.error("error", error?.data?.error); setToast({ - message: error?.data?.url?.error ?? t("links.toasts.not_created.message"), + message: error?.data?.error ?? t("links.toasts.not_created.message"), type: TOAST_TYPE.ERROR, title: t("links.toasts.not_created.title"), }); From b91209aa48bf0d91ca87187ca251a0f819660d6a Mon Sep 17 00:00:00 2001 From: gakshita Date: Tue, 18 Feb 2025 13:17:28 +0530 Subject: [PATCH 5/6] fix: refactor --- web/ee/components/workspace/sidebar/app-search.tsx | 1 - web/ee/components/workspace/sidebar/index.ts | 1 - 2 files changed, 2 deletions(-) delete mode 100644 web/ee/components/workspace/sidebar/app-search.tsx diff --git a/web/ee/components/workspace/sidebar/app-search.tsx b/web/ee/components/workspace/sidebar/app-search.tsx deleted file mode 100644 index 83826dc2b0e..00000000000 --- a/web/ee/components/workspace/sidebar/app-search.tsx +++ /dev/null @@ -1 +0,0 @@ -export * from "ce/components/workspace/sidebar/app-search"; diff --git a/web/ee/components/workspace/sidebar/index.ts b/web/ee/components/workspace/sidebar/index.ts index 3891c161c23..eb17e4018f4 100644 --- a/web/ee/components/workspace/sidebar/index.ts +++ b/web/ee/components/workspace/sidebar/index.ts @@ -1,2 +1 @@ -export * from "./app-search"; export * from "ce/components/workspace/sidebar"; From 6549196d6cae8cfcfa19fc13e97342a1a8c09c4c Mon Sep 17 00:00:00 2001 From: gakshita Date: Tue, 18 Feb 2025 13:21:43 +0530 Subject: [PATCH 6/6] fix: refactor --- web/core/components/workspace/sidebar/quick-actions.tsx | 2 +- web/ee/components/workspace/index.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/web/core/components/workspace/sidebar/quick-actions.tsx b/web/core/components/workspace/sidebar/quick-actions.tsx index fa44d24b4ee..150c08d6838 100644 --- a/web/core/components/workspace/sidebar/quick-actions.tsx +++ b/web/core/components/workspace/sidebar/quick-actions.tsx @@ -15,7 +15,7 @@ import { cn } from "@/helpers/common.helper"; import { useAppTheme, useCommandPalette, useEventTracker, useProject, useUserPermissions } from "@/hooks/store"; import useLocalStorage from "@/hooks/use-local-storage"; // plane web components -import { AppSearch } from "@/plane-web/components/workspace/sidebar/app-search"; +import { AppSearch } from "@/plane-web/components/workspace"; export const SidebarQuickActions = observer(() => { const { t } = useTranslation(); diff --git a/web/ee/components/workspace/index.ts b/web/ee/components/workspace/index.ts index 94a16694754..b0b8ffd3ad0 100644 --- a/web/ee/components/workspace/index.ts +++ b/web/ee/components/workspace/index.ts @@ -2,3 +2,4 @@ export * from "./edition-badge"; export * from "./upgrade-badge"; export * from "./billing"; export * from "./delete-workspace-section"; +export * from "./sidebar";