forked from React-Group/interstellar_ai
Modified | Change Account Settings
This commit is contained in:
parent
7c77e43be8
commit
d12c850df0
2 changed files with 9 additions and 10 deletions
|
@ -580,26 +580,23 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
|
||||||
<TextSettings
|
<TextSettings
|
||||||
label="New Name"
|
label="New Name"
|
||||||
value={newName}
|
value={newName}
|
||||||
type='text'
|
|
||||||
setValue={setNewName}
|
setValue={setNewName}
|
||||||
|
type="text"
|
||||||
|
placeholder={localStorage.getItem("accountName") || "Current Name"} // Show current name or a default
|
||||||
/>
|
/>
|
||||||
<TextSettings
|
<TextSettings
|
||||||
label="New Email"
|
label="New Email"
|
||||||
value={newEmail}
|
value={newEmail}
|
||||||
setValue={setNewEmail}
|
setValue={setNewEmail}
|
||||||
type="email" // Input type is email
|
type="email"
|
||||||
|
placeholder={localStorage.getItem("accountEmail") || "Current Email"} // Show current email or a default
|
||||||
/>
|
/>
|
||||||
<TextSettings
|
<TextSettings
|
||||||
label="New Password"
|
label="New Password"
|
||||||
value={newPassword}
|
value={newPassword}
|
||||||
setValue={setNewPassword}
|
setValue={setNewPassword}
|
||||||
type="password" // Input type is password
|
type="password"
|
||||||
/>
|
placeholder={newPassword ? "********" : "Enter new Password"} // Show asterisks or a default
|
||||||
<TextSettings
|
|
||||||
label="Current Password"
|
|
||||||
value={currentPassword}
|
|
||||||
setValue={setCurrentPassword}
|
|
||||||
type="password" // Input type is password
|
|
||||||
/>
|
/>
|
||||||
<ButtonSetting
|
<ButtonSetting
|
||||||
label="Log Out" // Button label
|
label="Log Out" // Button label
|
||||||
|
|
|
@ -5,9 +5,10 @@ interface TextSettingProps {
|
||||||
value: string; // The current text value
|
value: string; // The current text value
|
||||||
setValue: (newText: string) => void; // The method to update the state
|
setValue: (newText: string) => void; // The method to update the state
|
||||||
type: 'text' | 'email' | 'password'; // The type of input field
|
type: 'text' | 'email' | 'password'; // The type of input field
|
||||||
|
placeholder?: string; // Optional placeholder text
|
||||||
}
|
}
|
||||||
|
|
||||||
const TextSetting: React.FC<TextSettingProps> = ({ label, value, setValue, type }) => {
|
const TextSetting: React.FC<TextSettingProps> = ({ label, value, setValue, type, placeholder }) => {
|
||||||
const handleTextChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
const handleTextChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
const newText = e.target.value; // Get the new value from the input
|
const newText = e.target.value; // Get the new value from the input
|
||||||
setValue(newText); // Update the state in the parent component
|
setValue(newText); // Update the state in the parent component
|
||||||
|
@ -20,6 +21,7 @@ const TextSetting: React.FC<TextSettingProps> = ({ label, value, setValue, type
|
||||||
type={type} // Use the type prop for the input
|
type={type} // Use the type prop for the input
|
||||||
value={value} // Set the current value
|
value={value} // Set the current value
|
||||||
onChange={handleTextChange} // Handle input changes
|
onChange={handleTextChange} // Handle input changes
|
||||||
|
placeholder={placeholder} // Set the placeholder text
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue