Merge pull request #392 from makeplane/sync/ce-ee

sync: community changes
This commit is contained in:
Satish Gandham
2024-06-13 12:53:05 +05:30
committed by GitHub
6 changed files with 22 additions and 11 deletions

View File

@@ -0,0 +1 @@
export const AppSwitcher = () => null;

View File

@@ -0,0 +1 @@
export * from "./app-switcher";

View File

@@ -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) => {

View File

@@ -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}`}
/>
</>
);
});

View File

@@ -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";

View File

@@ -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 &&