feat: ability to pin a manual trigger in the navbar (#13904)
Fixes #13333 This PR adds the ability to pin a manual trigger in the navbar. As suggested, the following changes have been made: **Changes Made** - **Schema updates** - Updated the `workflowSchema.ts` and added `isPinned` to the `workflowManualTriggerSchema` as an optional boolean. - **Defaults** - Updated the `getManualTriggerDefaultSettings.ts` to add `isPinned` to the `WorkflowManualTriggerSettings`, defaulting to false. - **UI updates** - Updated the `ManualTriggerAvailabilityOptions.ts` to improve the Availability labels as suggested in the figma files. - Created a new file `ManualTriggerIsPinnedOptions.ts` that contains the options (label, value and icon) for the `isPinned` select component. - Updated the `WorkflowEditTriggerManualForm.tsx` to incorporate the added `isPinned` select component. - **Action handling** - Modified `useRunWorkflowRecordActions.tsx` to add `isPinned: activeWorkflowVersion.trigger?.settings?.isPinned` to the returned action config. --------- Co-authored-by: Félix Malfait <felix.malfait@gmail.com> Co-authored-by: Félix Malfait <felix@twenty.com> Co-authored-by: Raphaël Bosi <71827178+bosiraphael@users.noreply.github.com> Co-authored-by: bosiraphael <raphael.bosi@gmail.com>
This commit is contained in:
+4
-18
@@ -1,7 +1,6 @@
|
||||
import { type ActionMenuContextType } from '@/action-menu/contexts/ActionMenuContext';
|
||||
import { ActionMenuContextProviderWorkflowObjects } from '@/action-menu/contexts/ActionMenuContextProviderWorkflowObjects';
|
||||
import { ActionMenuContextProviderWorkflowsEnabled } from '@/action-menu/contexts/ActionMenuContextProviderWorkflowsEnabled';
|
||||
import { ActionMenuContextProviderWorkflowsNotEnabled } from '@/action-menu/contexts/ActionMenuContextProviderWorkflowsNotEnabled';
|
||||
import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState';
|
||||
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
@@ -46,31 +45,18 @@ export const ActionMenuContextProvider = ({
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
isDefined(objectMetadataItem) &&
|
||||
(actionMenuType === 'command-menu' ||
|
||||
actionMenuType === 'command-menu-show-page-action-menu-dropdown')
|
||||
) {
|
||||
return (
|
||||
<ActionMenuContextProviderWorkflowsEnabled
|
||||
isInRightDrawer={isInRightDrawer}
|
||||
displayType={displayType}
|
||||
actionMenuType={actionMenuType}
|
||||
objectMetadataItem={objectMetadataItem}
|
||||
>
|
||||
{children}
|
||||
</ActionMenuContextProviderWorkflowsEnabled>
|
||||
);
|
||||
if (!isDefined(objectMetadataItem)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<ActionMenuContextProviderWorkflowsNotEnabled
|
||||
<ActionMenuContextProviderWorkflowsEnabled
|
||||
isInRightDrawer={isInRightDrawer}
|
||||
displayType={displayType}
|
||||
actionMenuType={actionMenuType}
|
||||
objectMetadataItem={objectMetadataItem}
|
||||
>
|
||||
{children}
|
||||
</ActionMenuContextProviderWorkflowsNotEnabled>
|
||||
</ActionMenuContextProviderWorkflowsEnabled>
|
||||
);
|
||||
};
|
||||
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
import {
|
||||
ActionMenuContext,
|
||||
type ActionMenuContextType,
|
||||
} from '@/action-menu/contexts/ActionMenuContext';
|
||||
import { useRegisteredActions } from '@/action-menu/hooks/useRegisteredActions';
|
||||
import { useShouldActionBeRegisteredParams } from '@/action-menu/hooks/useShouldActionBeRegisteredParams';
|
||||
import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
||||
|
||||
export const ActionMenuContextProviderWorkflowsNotEnabled = ({
|
||||
objectMetadataItem,
|
||||
isInRightDrawer,
|
||||
displayType,
|
||||
actionMenuType,
|
||||
children,
|
||||
}: {
|
||||
objectMetadataItem?: ObjectMetadataItem;
|
||||
isInRightDrawer: ActionMenuContextType['isInRightDrawer'];
|
||||
displayType: ActionMenuContextType['displayType'];
|
||||
actionMenuType: ActionMenuContextType['actionMenuType'];
|
||||
children: React.ReactNode;
|
||||
}) => {
|
||||
const params = useShouldActionBeRegisteredParams({
|
||||
objectMetadataItem,
|
||||
});
|
||||
|
||||
const actions = useRegisteredActions(params);
|
||||
|
||||
return (
|
||||
<ActionMenuContext.Provider
|
||||
value={{
|
||||
isInRightDrawer,
|
||||
displayType,
|
||||
actionMenuType,
|
||||
actions,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</ActionMenuContext.Provider>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user