From 4eb859256c5c98bb2b53fb39389dca5c9a495359 Mon Sep 17 00:00:00 2001 From: Antoine Moreaux Date: Mon, 23 Jun 2025 22:49:38 +0200 Subject: [PATCH] feat(settings): add loading state to save buttons (#11639) Introduce a loading state to SaveButton and SaveAndCancelButtons components to enhance user feedback during save operations. Update SettingsNewObject to manage the loading state while submitting the form. Fix https://github.com/twentyhq/core-team-issues/issues/572 --------- Co-authored-by: Charles Bochet --- .../SaveAndCancelButtons.tsx | 8 ++++++- .../SaveAndCancelButtons/SaveButton.tsx | 10 ++++++-- .../settings/data-model/SettingsNewObject.tsx | 7 +++++- .../data-model/SettingsObjectFieldEdit.tsx | 20 +++++++++++----- .../SettingsObjectNewFieldConfigure.tsx | 23 +++++++------------ .../src/feedback/loader/components/Loader.tsx | 4 ++-- 6 files changed, 45 insertions(+), 27 deletions(-) diff --git a/packages/twenty-front/src/modules/settings/components/SaveAndCancelButtons/SaveAndCancelButtons.tsx b/packages/twenty-front/src/modules/settings/components/SaveAndCancelButtons/SaveAndCancelButtons.tsx index 5cb0e3677..7abb5ca21 100644 --- a/packages/twenty-front/src/modules/settings/components/SaveAndCancelButtons/SaveAndCancelButtons.tsx +++ b/packages/twenty-front/src/modules/settings/components/SaveAndCancelButtons/SaveAndCancelButtons.tsx @@ -11,6 +11,7 @@ const StyledContainer = styled.div` type SaveAndCancelButtonsProps = { onSave?: () => void; + isLoading?: boolean; onCancel?: () => void; isSaveDisabled?: boolean; isCancelDisabled?: boolean; @@ -18,6 +19,7 @@ type SaveAndCancelButtonsProps = { export const SaveAndCancelButtons = ({ onSave, + isLoading, onCancel, isSaveDisabled, isCancelDisabled, @@ -25,7 +27,11 @@ export const SaveAndCancelButtons = ({ return ( - + ); }; diff --git a/packages/twenty-front/src/modules/settings/components/SaveAndCancelButtons/SaveButton.tsx b/packages/twenty-front/src/modules/settings/components/SaveAndCancelButtons/SaveButton.tsx index 0388ddb18..ee6c24b47 100644 --- a/packages/twenty-front/src/modules/settings/components/SaveAndCancelButtons/SaveButton.tsx +++ b/packages/twenty-front/src/modules/settings/components/SaveAndCancelButtons/SaveButton.tsx @@ -1,13 +1,18 @@ import { t } from '@lingui/core/macro'; -import { Button } from 'twenty-ui/input'; import { IconDeviceFloppy } from 'twenty-ui/display'; +import { Button } from 'twenty-ui/input'; type SaveButtonProps = { onSave?: () => void; disabled?: boolean; + isLoading?: boolean; }; -export const SaveButton = ({ onSave, disabled }: SaveButtonProps) => { +export const SaveButton = ({ + onSave, + disabled, + isLoading, +}: SaveButtonProps) => { return (