Fix right drawer actions (#9241)
https://github.com/user-attachments/assets/107e6058-633f-4caa-967c-7017bef75d52
This commit is contained in:
@ -1,15 +1,19 @@
|
||||
import { SingleRecordActionHookWithObjectMetadataItem } from '@/action-menu/actions/types/SingleRecordActionHook';
|
||||
import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext';
|
||||
import { useRecordShowPagePagination } from '@/object-record/record-show/hooks/useRecordShowPagePagination';
|
||||
import { useContext } from 'react';
|
||||
|
||||
export const useNavigateToNextRecordSingleRecordAction: SingleRecordActionHookWithObjectMetadataItem =
|
||||
({ recordId, objectMetadataItem }) => {
|
||||
const { isInRightDrawer } = useContext(ActionMenuContext);
|
||||
|
||||
const { navigateToNextRecord } = useRecordShowPagePagination(
|
||||
objectMetadataItem.nameSingular,
|
||||
recordId,
|
||||
);
|
||||
|
||||
return {
|
||||
shouldBeRegistered: true,
|
||||
shouldBeRegistered: !isInRightDrawer,
|
||||
onClick: navigateToNextRecord,
|
||||
};
|
||||
};
|
||||
|
||||
@ -1,15 +1,18 @@
|
||||
import { SingleRecordActionHookWithObjectMetadataItem } from '@/action-menu/actions/types/SingleRecordActionHook';
|
||||
import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext';
|
||||
import { useRecordShowPagePagination } from '@/object-record/record-show/hooks/useRecordShowPagePagination';
|
||||
import { useContext } from 'react';
|
||||
|
||||
export const useNavigateToPreviousRecordSingleRecordAction: SingleRecordActionHookWithObjectMetadataItem =
|
||||
({ recordId, objectMetadataItem }) => {
|
||||
const { isInRightDrawer } = useContext(ActionMenuContext);
|
||||
const { navigateToPreviousRecord } = useRecordShowPagePagination(
|
||||
objectMetadataItem.nameSingular,
|
||||
recordId,
|
||||
);
|
||||
|
||||
return {
|
||||
shouldBeRegistered: true,
|
||||
shouldBeRegistered: !isInRightDrawer,
|
||||
onClick: navigateToPreviousRecord,
|
||||
};
|
||||
};
|
||||
|
||||
@ -21,7 +21,6 @@ export const RecordShowRightDrawerActionMenu = () => {
|
||||
<ActionMenuContext.Provider
|
||||
value={{
|
||||
isInRightDrawer: true,
|
||||
onActionExecutedCallback: () => {},
|
||||
}}
|
||||
>
|
||||
<RightDrawerActionMenuDropdown />
|
||||
|
||||
Reference in New Issue
Block a user