Chore: search code splitting (#6628)
* fix: Handled workspace switcher closing on click * chore: code splitting for search * fix: refactor * fix: quick link error validation * fix: refactor * fix: refactor
This commit is contained in:
parent
3f6ef56a0f
commit
a49d899ea1
6 changed files with 36 additions and 15 deletions
|
|
@ -2,4 +2,5 @@ export * from "./edition-badge";
|
||||||
export * from "./upgrade-badge";
|
export * from "./upgrade-badge";
|
||||||
export * from "./billing";
|
export * from "./billing";
|
||||||
export * from "./delete-workspace-section";
|
export * from "./delete-workspace-section";
|
||||||
|
export * from "./sidebar";
|
||||||
export * from "./members";
|
export * from "./members";
|
||||||
|
|
|
||||||
26
web/ce/components/workspace/sidebar/app-search.tsx
Normal file
26
web/ce/components/workspace/sidebar/app-search.tsx
Normal file
|
|
@ -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 (
|
||||||
|
<button
|
||||||
|
className={cn(
|
||||||
|
"flex-shrink-0 size-8 aspect-square grid place-items-center rounded hover:bg-custom-sidebar-background-90 outline-none",
|
||||||
|
{
|
||||||
|
"border-[0.5px] border-custom-sidebar-border-300": !sidebarCollapsed,
|
||||||
|
}
|
||||||
|
)}
|
||||||
|
onClick={() => toggleCommandPaletteModal(true)}
|
||||||
|
>
|
||||||
|
<Search className="size-4 text-custom-sidebar-text-300" />
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
export * from "./app-search";
|
||||||
export * from "./extended-sidebar-item";
|
export * from "./extended-sidebar-item";
|
||||||
export * from "./helper";
|
export * from "./helper";
|
||||||
export * from "./sidebar-item";
|
export * from "./sidebar-item";
|
||||||
|
|
|
||||||
|
|
@ -42,9 +42,9 @@ export const useLinks = (workspaceSlug: string) => {
|
||||||
});
|
});
|
||||||
toggleLinkModal(false);
|
toggleLinkModal(false);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error("error", error?.data?.url?.error);
|
console.error("error", error?.data?.error);
|
||||||
setToast({
|
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,
|
type: TOAST_TYPE.ERROR,
|
||||||
title: t("links.toasts.not_created.title"),
|
title: t("links.toasts.not_created.title"),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { useRef, useState } from "react";
|
import { useRef, useState } from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { useParams } from "next/navigation";
|
import { useParams } from "next/navigation";
|
||||||
import { ChevronUp, PenSquare, Search } from "lucide-react";
|
import { PenSquare } from "lucide-react";
|
||||||
import { EUserPermissions, EUserPermissionsLevel } from "@plane/constants";
|
import { EUserPermissions, EUserPermissionsLevel } from "@plane/constants";
|
||||||
import { useTranslation } from "@plane/i18n";
|
import { useTranslation } from "@plane/i18n";
|
||||||
// types
|
// types
|
||||||
|
|
@ -14,6 +14,8 @@ import { cn } from "@/helpers/common.helper";
|
||||||
// hooks
|
// hooks
|
||||||
import { useAppTheme, useCommandPalette, useEventTracker, useProject, useUserPermissions } from "@/hooks/store";
|
import { useAppTheme, useCommandPalette, useEventTracker, useProject, useUserPermissions } from "@/hooks/store";
|
||||||
import useLocalStorage from "@/hooks/use-local-storage";
|
import useLocalStorage from "@/hooks/use-local-storage";
|
||||||
|
// plane web components
|
||||||
|
import { AppSearch } from "@/plane-web/components/workspace";
|
||||||
|
|
||||||
export const SidebarQuickActions = observer(() => {
|
export const SidebarQuickActions = observer(() => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
@ -27,7 +29,7 @@ export const SidebarQuickActions = observer(() => {
|
||||||
const { workspaceSlug: routerWorkspaceSlug } = useParams();
|
const { workspaceSlug: routerWorkspaceSlug } = useParams();
|
||||||
const workspaceSlug = routerWorkspaceSlug?.toString();
|
const workspaceSlug = routerWorkspaceSlug?.toString();
|
||||||
// store hooks
|
// store hooks
|
||||||
const { toggleCreateIssueModal, toggleCommandPaletteModal } = useCommandPalette();
|
const { toggleCreateIssueModal } = useCommandPalette();
|
||||||
const { sidebarCollapsed: isSidebarCollapsed } = useAppTheme();
|
const { sidebarCollapsed: isSidebarCollapsed } = useAppTheme();
|
||||||
const { setTrackElement } = useEventTracker();
|
const { setTrackElement } = useEventTracker();
|
||||||
const { joinedProjectIds } = useProject();
|
const { joinedProjectIds } = useProject();
|
||||||
|
|
@ -98,17 +100,7 @@ export const SidebarQuickActions = observer(() => {
|
||||||
<span className="text-sm font-medium truncate max-w-[145px]">{t("sidebar.new_work_item")}</span>
|
<span className="text-sm font-medium truncate max-w-[145px]">{t("sidebar.new_work_item")}</span>
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<AppSearch />
|
||||||
className={cn(
|
|
||||||
"flex-shrink-0 size-8 aspect-square grid place-items-center rounded hover:bg-custom-sidebar-background-90 outline-none",
|
|
||||||
{
|
|
||||||
"border-[0.5px] border-custom-sidebar-border-300": !isSidebarCollapsed,
|
|
||||||
}
|
|
||||||
)}
|
|
||||||
onClick={() => toggleCommandPaletteModal(true)}
|
|
||||||
>
|
|
||||||
<Search className="size-4 text-custom-sidebar-text-300" />
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,4 @@ export * from "./edition-badge";
|
||||||
export * from "./upgrade-badge";
|
export * from "./upgrade-badge";
|
||||||
export * from "./billing";
|
export * from "./billing";
|
||||||
export * from "./delete-workspace-section";
|
export * from "./delete-workspace-section";
|
||||||
|
export * from "./sidebar";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue