8978 add navigation inside the command menu for showpage (#9103)
Closes #8978 - Added new options in the actions config files: `shortLabel`, `availableOn` - Added two actions: Navigate to previous records and Navigate to next records - Modified `useRecordShowPagePagination` to loop on records when we are on first record and we hit previous or when we are on last record and we hit next - Introduced a new component state `contextStoreCurrentViewTypeComponentState`
This commit is contained in:
@ -0,0 +1,24 @@
|
||||
import { contextStoreCurrentViewTypeComponentState } from '@/context-store/states/contextStoreCurrentViewTypeComponentState';
|
||||
import { ContextStoreViewType } from '@/context-store/types/ContextStoreViewType';
|
||||
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export const ContextStoreCurrentViewTypeEffect = ({
|
||||
viewType,
|
||||
}: {
|
||||
viewType: ContextStoreViewType | null;
|
||||
}) => {
|
||||
const setContextStoreCurrentViewType = useSetRecoilComponentStateV2(
|
||||
contextStoreCurrentViewTypeComponentState,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
setContextStoreCurrentViewType(viewType);
|
||||
|
||||
return () => {
|
||||
setContextStoreCurrentViewType(null);
|
||||
};
|
||||
}, [setContextStoreCurrentViewType, viewType]);
|
||||
|
||||
return null;
|
||||
};
|
||||
@ -0,0 +1,10 @@
|
||||
import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext';
|
||||
import { ContextStoreViewType } from '@/context-store/types/ContextStoreViewType';
|
||||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2';
|
||||
|
||||
export const contextStoreCurrentViewTypeComponentState =
|
||||
createComponentStateV2<ContextStoreViewType | null>({
|
||||
key: 'contextStoreCurrentViewTypeComponentState',
|
||||
defaultValue: null,
|
||||
componentInstanceContext: ContextStoreComponentInstanceContext,
|
||||
});
|
||||
@ -0,0 +1,5 @@
|
||||
export enum ContextStoreViewType {
|
||||
Table = 'table',
|
||||
Kanban = 'kanban',
|
||||
ShowPage = 'show-page',
|
||||
}
|
||||
Reference in New Issue
Block a user