diff --git a/apps/admin-x-settings/src/components/settings/general/UserDetailModal.tsx b/apps/admin-x-settings/src/components/settings/general/UserDetailModal.tsx index 3287b9b550..1849377716 100644 --- a/apps/admin-x-settings/src/components/settings/general/UserDetailModal.tsx +++ b/apps/admin-x-settings/src/components/settings/general/UserDetailModal.tsx @@ -424,14 +424,19 @@ const UserMenuTrigger = () => ( const UserDetailModal:React.FC = ({user}) => { const {updateRoute} = useRouting(); const {ownerUser} = useStaffUsers(); - const [userData, setUserData] = useState(user); - const [saveState, setSaveState] = useState(''); + const [userData, _setUserData] = useState(user); + const [saveState, setSaveState] = useState<'' | 'unsaved' | 'saving' | 'saved'>(''); const [errors, setErrors] = useState<{ name?: string; email?: string; url?: string; }>({}); + const setUserData = (newUserData: User | ((current: User) => User)) => { + _setUserData(newUserData); + setSaveState('unsaved'); + }; + const mainModal = useModal(); const {mutateAsync: uploadImage} = useUploadImage(); const {mutateAsync: updateUser} = useEditUser(); @@ -645,6 +650,7 @@ const UserDetailModal:React.FC = ({user}) => { return ( updateRoute('users')} + dirty={saveState === 'unsaved'} okLabel={okLabel} size='lg' stickyFooter={true}