Files
Firelink/src/utils/propertiesFooter.ts
T

16 lines
483 B
TypeScript

export type PropertiesFooterAction = 'discardChanges' | 'save' | 'close' | 'keepEditing';
export type PropertiesFooterState = {
isDirty: boolean;
hasUnsavedNavigation: boolean;
};
export const getPropertiesFooterActions = ({
isDirty,
hasUnsavedNavigation,
}: PropertiesFooterState): PropertiesFooterAction[] => {
if (hasUnsavedNavigation) return ['discardChanges', 'save', 'keepEditing'];
if (isDirty) return ['discardChanges', 'save', 'close'];
return ['close'];
};