Skip to content

Commit

Permalink
fix: remove emoji edit for uneditable pages (#6304)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaryan610 authored Jan 3, 2025
1 parent 870ca17 commit 2622dd6
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ import { PageEditInformationPopover } from "@/components/pages";
import { convertHexEmojiToDecimal } from "@/helpers/emoji.helper";
import { getPageName } from "@/helpers/page.helper";
// hooks
import { useProjectPage, useProject, useUser, useUserPermissions } from "@/hooks/store";
import { useProjectPage, useProject } from "@/hooks/store";
import { usePlatformOS } from "@/hooks/use-platform-os";
// plane web components
import { PageDetailsHeaderExtraActions } from "@/plane-web/components/pages";
import { EUserPermissions, EUserPermissionsLevel } from "ee/constants/user-permissions";

export interface IPagesHeaderProps {
showButton?: boolean;
Expand All @@ -33,17 +32,10 @@ export const PageDetailsHeader = observer(() => {
// store hooks
const { currentProjectDetails, loader } = useProject();
const page = useProjectPage(pageId?.toString() ?? "");
const { name, logo_props, updatePageLogo, owned_by } = page;
const { allowPermissions } = useUserPermissions();
const { data: currentUser } = useUser();
const { name, logo_props, updatePageLogo, isContentEditable } = page;
// use platform
const { isMobile } = usePlatformOS();

const isAdmin = allowPermissions([EUserPermissions.ADMIN], EUserPermissionsLevel.PROJECT);
const isOwner = owned_by === currentUser?.id;

const isEditable = isAdmin || isOwner;

const handlePageLogoUpdate = async (data: TLogoProps) => {
if (data) {
updatePageLogo(data)
Expand Down Expand Up @@ -151,7 +143,7 @@ export const PageDetailsHeader = observer(() => {
? EmojiIconPickerTypes.EMOJI
: EmojiIconPickerTypes.ICON
}
disabled={!isEditable}
disabled={!isContentEditable}
/>
</div>
<Tooltip tooltipContent={pageTitle} position="bottom" isMobile={isMobile}>
Expand Down

0 comments on commit 2622dd6

Please sign in to comment.