mirror of
https://github.com/makeplane/plane.git
synced 2025-12-29 00:24:56 +01:00
Merge pull request #392 from makeplane/sync/ce-ee
sync: community changes
This commit is contained in:
1
web/ce/components/sidebar/app-switcher.tsx
Normal file
1
web/ce/components/sidebar/app-switcher.tsx
Normal file
@@ -0,0 +1 @@
|
||||
export const AppSwitcher = () => null;
|
||||
1
web/ce/components/sidebar/index.ts
Normal file
1
web/ce/components/sidebar/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./app-switcher";
|
||||
@@ -8,18 +8,17 @@ import { ArchiveIcon, ContextMenu, CustomMenu, TContextMenuItem, TOAST_TYPE, set
|
||||
import { DeletePageModal } from "@/components/pages";
|
||||
// helpers
|
||||
import { copyUrlToClipboard } from "@/helpers/string.helper";
|
||||
// hooks
|
||||
import { usePage } from "@/hooks/store";
|
||||
// store
|
||||
import { IPageStore } from "@/store/pages/page.store";
|
||||
|
||||
type Props = {
|
||||
pageId: string;
|
||||
page: IPageStore;
|
||||
pageLink: string;
|
||||
parentRef: React.RefObject<HTMLElement>;
|
||||
projectId: string;
|
||||
workspaceSlug: string;
|
||||
};
|
||||
|
||||
export const PageQuickActions: React.FC<Props> = observer((props) => {
|
||||
const { pageId, parentRef, projectId, workspaceSlug } = props;
|
||||
const { page, pageLink, parentRef } = props;
|
||||
// states
|
||||
const [deletePageModal, setDeletePageModal] = useState(false);
|
||||
// store hooks
|
||||
@@ -33,9 +32,8 @@ export const PageQuickActions: React.FC<Props> = observer((props) => {
|
||||
canCurrentUserArchivePage,
|
||||
canCurrentUserChangeAccess,
|
||||
canCurrentUserDeletePage,
|
||||
} = usePage(pageId);
|
||||
} = page;
|
||||
|
||||
const pageLink = `${workspaceSlug}/projects/${projectId}/pages/${pageId}`;
|
||||
const handleCopyText = () =>
|
||||
copyUrlToClipboard(pageLink).then(() => {
|
||||
setToast({
|
||||
@@ -87,7 +85,7 @@ export const PageQuickActions: React.FC<Props> = observer((props) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<DeletePageModal isOpen={deletePageModal} onClose={() => setDeletePageModal(false)} pageId={pageId} />
|
||||
<DeletePageModal isOpen={deletePageModal} onClose={() => setDeletePageModal(false)} pageId={page.id ?? ""} />
|
||||
<ContextMenu parentRef={parentRef} items={MENU_ITEMS} />
|
||||
<CustomMenu placement="bottom-end" ellipsis closeOnSelect>
|
||||
{MENU_ITEMS.map((item) => {
|
||||
|
||||
@@ -24,8 +24,10 @@ export const BlockItemAction: FC<Props> = observer((props) => {
|
||||
const { workspaceSlug, projectId, pageId, parentRef } = props;
|
||||
|
||||
// store hooks
|
||||
const { access, created_at, is_favorite, owned_by, addToFavorites, removeFromFavorites } = usePage(pageId);
|
||||
const page = usePage(pageId);
|
||||
const { getUserDetails } = useMember();
|
||||
// derived values
|
||||
const { access, created_at, is_favorite, owned_by, addToFavorites, removeFromFavorites } = page;
|
||||
|
||||
// derived values
|
||||
const ownerDetails = owned_by ? getUserDetails(owned_by) : undefined;
|
||||
@@ -83,7 +85,11 @@ export const BlockItemAction: FC<Props> = observer((props) => {
|
||||
/>
|
||||
|
||||
{/* quick actions dropdown */}
|
||||
<PageQuickActions parentRef={parentRef} pageId={pageId} projectId={projectId} workspaceSlug={workspaceSlug} />
|
||||
<PageQuickActions
|
||||
parentRef={parentRef}
|
||||
page={page}
|
||||
pageLink={`${workspaceSlug}/projects/${projectId}/pages/${pageId}`}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ export * from "./confirm-workspace-member-remove";
|
||||
export * from "./create-workspace-form";
|
||||
export * from "./delete-workspace-modal";
|
||||
export * from "./help-section";
|
||||
export * from "./logo";
|
||||
export * from "./send-workspace-invitation-modal";
|
||||
export * from "./sidebar-dropdown";
|
||||
export * from "./sidebar-menu";
|
||||
|
||||
@@ -16,7 +16,10 @@ import { Avatar, Loader, TOAST_TYPE, setToast } from "@plane/ui";
|
||||
import { GOD_MODE_URL } from "@/helpers/common.helper";
|
||||
// hooks
|
||||
import { useAppTheme, useUser, useUserProfile, useWorkspace } from "@/hooks/store";
|
||||
// plane web components
|
||||
import { AppSwitcher } from "@/plane-web/components/sidebar";
|
||||
import { WorkspaceLogo } from "./logo";
|
||||
|
||||
// Static Data
|
||||
const userLinks = (workspaceSlug: string) => [
|
||||
{
|
||||
@@ -137,6 +140,7 @@ export const WorkspaceSidebarDropdown = observer(() => {
|
||||
<h6 className="sticky top-0 z-10 h-full w-full bg-custom-sidebar-background-100 pb-1 pt-3 text-sm font-medium text-custom-sidebar-text-400">
|
||||
{currentUser?.email}
|
||||
</h6>
|
||||
<AppSwitcher />
|
||||
{workspacesList ? (
|
||||
<div className="flex h-full w-full flex-col items-start justify-start gap-1.5">
|
||||
{workspacesList.length > 0 &&
|
||||
|
||||
Reference in New Issue
Block a user