Refactor ProfileSettings and SecuritySettings components to improve code clarity and add input types

This commit is contained in:
2025-06-05 21:01:06 +02:00
parent 3276fd98c2
commit 734b98d286
3 changed files with 9 additions and 18 deletions

View File

@@ -7,7 +7,7 @@ interface ProfileSettingsProps {
onInputChange: (key: keyof UserProfileSettings, value: string) => void;
}
const ProfileSettingsComponent: React.FC<ProfileSettingsProps> = ({
const ProfileSettings: React.FC<ProfileSettingsProps> = ({
settings,
onInputChange,
}) => (
@@ -15,18 +15,22 @@ const ProfileSettingsComponent: React.FC<ProfileSettingsProps> = ({
<Stack gap="md">
<TextInput
label="Display Name"
type="text"
value={settings.displayName || ''}
onChange={(e) => onInputChange('displayName', e.currentTarget.value)}
placeholder="Enter display name"
data-testid="display-name-input"
/>
<TextInput
label="Email"
type="email"
value={settings.email || ''}
onChange={(e) => onInputChange('email', e.currentTarget.value)}
placeholder="Enter email"
data-testid="email-input"
/>
</Stack>
</Box>
);
export default ProfileSettingsComponent;
export default ProfileSettings;

View File

@@ -41,6 +41,7 @@ const SecuritySettings: React.FC<SecuritySettingsProps> = ({
<Stack gap="md">
<PasswordInput
label="Current Password"
type="password"
value={settings.currentPassword || ''}
onChange={(e) =>
handlePasswordChange('currentPassword', e.currentTarget.value)
@@ -49,6 +50,7 @@ const SecuritySettings: React.FC<SecuritySettingsProps> = ({
/>
<PasswordInput
label="New Password"
type="password"
value={settings.newPassword || ''}
onChange={(e) =>
handlePasswordChange('newPassword', e.currentTarget.value)
@@ -57,6 +59,7 @@ const SecuritySettings: React.FC<SecuritySettingsProps> = ({
/>
<PasswordInput
label="Confirm New Password"
type="password"
value={confirmPassword}
onChange={(e) =>
handlePasswordChange('confirmNewPassword', e.currentTarget.value)