Refactor: Add button feedback

This commit is contained in:
gpt-engineer-app[bot]
2025-11-04 18:48:39 +00:00
parent b07004ed03
commit ded4dfd59c
7 changed files with 90 additions and 52 deletions

View File

@@ -525,6 +525,8 @@ export default function Profile() {
setFormErrors({});
return true;
};
const [isSaving, setIsSaving] = useState(false);
const handleSaveProfile = async () => {
if (!profile || !currentUser) return;
if (!validateForm()) return;
@@ -533,6 +535,8 @@ export default function Profile() {
setShowUsernameDialog(true);
return;
}
setIsSaving(true);
try {
const updateData: any = {
display_name: editForm.display_name,
@@ -572,6 +576,8 @@ export default function Profile() {
title: "Error updating profile",
description: getErrorMessage(error)
});
} finally {
setIsSaving(false);
}
};
const confirmUsernameChange = () => {
@@ -730,7 +736,14 @@ export default function Profile() {
</div>
<div className="flex gap-2">
<Button onClick={handleSaveProfile} size="sm" disabled={usernameValidation.isChecking || editForm.username !== profile?.username && !usernameValidation.isValid}>
<Button
onClick={handleSaveProfile}
size="sm"
loading={isSaving}
loadingText="Saving..."
disabled={usernameValidation.isChecking || editForm.username !== profile?.username && !usernameValidation.isValid}
trackingLabel="save-profile-changes"
>
<Save className="w-4 h-4 mr-2" />
Save Changes
</Button>