fix: remove emoji edit for uneditable pages (#6304)
This commit is contained in:
parent
870ca17e13
commit
2622dd691c
1 changed files with 3 additions and 11 deletions
|
|
@ -15,11 +15,10 @@ import { PageEditInformationPopover } from "@/components/pages";
|
||||||
import { convertHexEmojiToDecimal } from "@/helpers/emoji.helper";
|
import { convertHexEmojiToDecimal } from "@/helpers/emoji.helper";
|
||||||
import { getPageName } from "@/helpers/page.helper";
|
import { getPageName } from "@/helpers/page.helper";
|
||||||
// hooks
|
// hooks
|
||||||
import { useProjectPage, useProject, useUser, useUserPermissions } from "@/hooks/store";
|
import { useProjectPage, useProject } from "@/hooks/store";
|
||||||
import { usePlatformOS } from "@/hooks/use-platform-os";
|
import { usePlatformOS } from "@/hooks/use-platform-os";
|
||||||
// plane web components
|
// plane web components
|
||||||
import { PageDetailsHeaderExtraActions } from "@/plane-web/components/pages";
|
import { PageDetailsHeaderExtraActions } from "@/plane-web/components/pages";
|
||||||
import { EUserPermissions, EUserPermissionsLevel } from "ee/constants/user-permissions";
|
|
||||||
|
|
||||||
export interface IPagesHeaderProps {
|
export interface IPagesHeaderProps {
|
||||||
showButton?: boolean;
|
showButton?: boolean;
|
||||||
|
|
@ -33,17 +32,10 @@ export const PageDetailsHeader = observer(() => {
|
||||||
// store hooks
|
// store hooks
|
||||||
const { currentProjectDetails, loader } = useProject();
|
const { currentProjectDetails, loader } = useProject();
|
||||||
const page = useProjectPage(pageId?.toString() ?? "");
|
const page = useProjectPage(pageId?.toString() ?? "");
|
||||||
const { name, logo_props, updatePageLogo, owned_by } = page;
|
const { name, logo_props, updatePageLogo, isContentEditable } = page;
|
||||||
const { allowPermissions } = useUserPermissions();
|
|
||||||
const { data: currentUser } = useUser();
|
|
||||||
// use platform
|
// use platform
|
||||||
const { isMobile } = usePlatformOS();
|
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) => {
|
const handlePageLogoUpdate = async (data: TLogoProps) => {
|
||||||
if (data) {
|
if (data) {
|
||||||
updatePageLogo(data)
|
updatePageLogo(data)
|
||||||
|
|
@ -151,7 +143,7 @@ export const PageDetailsHeader = observer(() => {
|
||||||
? EmojiIconPickerTypes.EMOJI
|
? EmojiIconPickerTypes.EMOJI
|
||||||
: EmojiIconPickerTypes.ICON
|
: EmojiIconPickerTypes.ICON
|
||||||
}
|
}
|
||||||
disabled={!isEditable}
|
disabled={!isContentEditable}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Tooltip tooltipContent={pageTitle} position="bottom" isMobile={isMobile}>
|
<Tooltip tooltipContent={pageTitle} position="bottom" isMobile={isMobile}>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue