@@ -8,6 +8,7 @@ import type {
88import {
99 isIPageInfoForEntity , isIPageInfoForOperation ,
1010} from '@growi/core' ;
11+ import { pagePathUtils } from '@growi/core/dist/utils' ;
1112import { useRect } from '@growi/ui/dist/utils' ;
1213import { useTranslation } from 'next-i18next' ;
1314import { DropdownItem } from 'reactstrap' ;
@@ -17,7 +18,9 @@ import {
1718} from '~/client/services/page-operation' ;
1819import { toastError } from '~/client/util/toastr' ;
1920import OpenDefaultAiAssistantButton from '~/features/openai/client/components/AiAssistant/OpenDefaultAiAssistantButton' ;
20- import { useIsGuestUser , useIsReadOnlyUser , useIsSearchPage } from '~/stores-universal/context' ;
21+ import {
22+ useIsGuestUser , useIsReadOnlyUser , useIsSearchPage , useIsUsersHomepageDeletionEnabled ,
23+ } from '~/stores-universal/context' ;
2124import {
2225 EditorMode , useEditorMode ,
2326} from '~/stores-universal/ui' ;
@@ -27,7 +30,7 @@ import {
2730} from '~/stores/ui' ;
2831import loggerFactory from '~/utils/logger' ;
2932
30- import { useSWRxPageInfo , useSWRxTagsInfo } from '../../../stores/page' ;
33+ import { useSWRxPageInfo , useSWRxTagsInfo , useCurrentPagePath } from '../../../stores/page' ;
3134import { useSWRxUsersList } from '../../../stores/user' ;
3235import type { AdditionalMenuItemsRendererProps , ForceHideMenuItems } from '../Common/Dropdown/PageItemControl' ;
3336import {
@@ -134,6 +137,10 @@ const PageControlsSubstance = (props: PageControlsSubstanceProps): JSX.Element =
134137 const { data : editorMode } = useEditorMode ( ) ;
135138 const { data : isDeviceLargerThanMd } = useIsDeviceLargerThanMd ( ) ;
136139 const { data : isSearchPage } = useIsSearchPage ( ) ;
140+ const { data : isUsersHomepageDeletionEnabled } = useIsUsersHomepageDeletionEnabled ( ) ;
141+ const { data : currentPagePath } = useCurrentPagePath ( ) ;
142+
143+ const isUsersHomepage = currentPagePath == null ? false : pagePathUtils . isUsersHomepage ( currentPagePath ) ;
137144
138145 const { mutate : mutatePageInfo } = useSWRxPageInfo ( pageId , shareLinkId ) ;
139146
@@ -249,6 +256,22 @@ const PageControlsSubstance = (props: PageControlsSubstanceProps): JSX.Element =
249256 }
250257 } , [ expandContentWidth , isGuestUser , isReadOnlyUser , onClickSwitchContentWidth , pageId , pageInfo ] ) ;
251258
259+ const isEnableActions = useMemo ( ( ) => {
260+ if ( isGuestUser ) {
261+ return false ;
262+ }
263+
264+ if ( currentPagePath == null ) {
265+ return false ;
266+ }
267+
268+ if ( isUsersHomepage && ! isUsersHomepageDeletionEnabled ) {
269+ return false ;
270+ }
271+
272+ return true ;
273+ } , [ isGuestUser , isUsersHomepage , isUsersHomepageDeletionEnabled ] ) ;
274+
252275 const additionalMenuItemOnTopRenderer = useMemo ( ( ) => {
253276 if ( ! isIPageInfoForEntity ( pageInfo ) ) {
254277 return undefined ;
@@ -332,7 +355,7 @@ const PageControlsSubstance = (props: PageControlsSubstanceProps): JSX.Element =
332355 < PageItemControl
333356 pageId = { pageId }
334357 pageInfo = { pageInfo }
335- isEnableActions = { ! isGuestUser }
358+ isEnableActions = { isEnableActions }
336359 isReadOnlyUser = { ! ! isReadOnlyUser }
337360 forceHideMenuItems = { forceHideMenuItemsWithAdditions }
338361 additionalMenuItemOnTopRenderer = { ! isReadOnlyUser ? additionalMenuItemOnTopRenderer : undefined }
0 commit comments