🔧 chore(Makefile): remove unnecessary semicolon in 'install_frontend' and 'install_frontendc' targets
🔧 chore(Makefile): remove unnecessary 'rm' command in 'install_frontendc' target ✨ feat(App.tsx): set user data in state when auto-login is triggered to ensure consistent user experience 🔧 chore(UserManagementModal/index.tsx): rename 'isDisabled' state variable to 'isActive' for clarity 🔧 chore(UserManagementModal/index.tsx): rename 'isDisabled' prop and label to 'Active' for clarity 🔧 chore(UserManagementModal/index.tsx): rename 'isDisabled' state variable to 'isActive' in handleInput function 🔧 chore(AdminPage/index.tsx): rename 'confirmationText' prop from 'Edit' to 'Save' for clarity
This commit is contained in:
parent
b319b909e4
commit
76c4d4afe7
4 changed files with 10 additions and 9 deletions
4
Makefile
4
Makefile
|
|
@ -32,10 +32,10 @@ lint:
|
||||||
poetry run ruff . --fix
|
poetry run ruff . --fix
|
||||||
|
|
||||||
install_frontend:
|
install_frontend:
|
||||||
cd src/frontend && npm install;
|
cd src/frontend && npm install
|
||||||
|
|
||||||
install_frontendc:
|
install_frontendc:
|
||||||
cd src/frontend && rm -rf node_modules package-lock.json && npm install;
|
cd src/frontend && rm -rf node_modules package-lock.json && npm install
|
||||||
|
|
||||||
run_frontend:
|
run_frontend:
|
||||||
cd src/frontend && npm start
|
cd src/frontend && npm start
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,7 @@ export default function App() {
|
||||||
if(user && user['access_token']){
|
if(user && user['access_token']){
|
||||||
user['refresh_token'] = "auto";
|
user['refresh_token'] = "auto";
|
||||||
login(user['access_token'], user['refresh_token']);
|
login(user['access_token'], user['refresh_token']);
|
||||||
|
setUserData(user);
|
||||||
setAutoLogin(true);
|
setAutoLogin(true);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ export default function UserManagementModal({
|
||||||
const [password, setPassword] = useState(data?.password ?? "");
|
const [password, setPassword] = useState(data?.password ?? "");
|
||||||
const [username, setUserName] = useState(data?.username ?? "");
|
const [username, setUserName] = useState(data?.username ?? "");
|
||||||
const [confirmPassword, setConfirmPassword] = useState(data?.password ?? "");
|
const [confirmPassword, setConfirmPassword] = useState(data?.password ?? "");
|
||||||
const [isDisabled, setIsDisabled] = useState(data?.is_active ?? false);
|
const [isActive, setIsActive] = useState(data?.is_active ?? false);
|
||||||
const [isSuperUser, setIsSuperUser] = useState(data?.is_superuser ?? false);
|
const [isSuperUser, setIsSuperUser] = useState(data?.is_superuser ?? false);
|
||||||
const [inputState, setInputState] = useState<UserInputType>(CONTROL_NEW_USER);
|
const [inputState, setInputState] = useState<UserInputType>(CONTROL_NEW_USER);
|
||||||
const { userData } = useContext(AuthContext);
|
const { userData } = useContext(AuthContext);
|
||||||
|
|
@ -47,7 +47,7 @@ export default function UserManagementModal({
|
||||||
resetForm();
|
resetForm();
|
||||||
} else {
|
} else {
|
||||||
handleInput({ target: { name: "username", value: username } });
|
handleInput({ target: { name: "username", value: username } });
|
||||||
handleInput({ target: { name: "is_active", value: isDisabled } });
|
handleInput({ target: { name: "is_active", value: isActive } });
|
||||||
handleInput({ target: { name: "is_superuser", value: isSuperUser } });
|
handleInput({ target: { name: "is_superuser", value: isSuperUser } });
|
||||||
}
|
}
|
||||||
}, [open]);
|
}, [open]);
|
||||||
|
|
@ -230,17 +230,17 @@ export default function UserManagementModal({
|
||||||
<Form.Field name="is_active">
|
<Form.Field name="is_active">
|
||||||
<div>
|
<div>
|
||||||
<Form.Label className="data-[invalid]:label-invalid mr-3">
|
<Form.Label className="data-[invalid]:label-invalid mr-3">
|
||||||
Disabled
|
Active
|
||||||
</Form.Label>
|
</Form.Label>
|
||||||
<Form.Control asChild>
|
<Form.Control asChild>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
value={isDisabled}
|
value={isActive}
|
||||||
checked={isDisabled}
|
checked={isActive}
|
||||||
id="is_active"
|
id="is_active"
|
||||||
className="relative top-0.5"
|
className="relative top-0.5"
|
||||||
onCheckedChange={(value) => {
|
onCheckedChange={(value) => {
|
||||||
handleInput({ target: { name: "is_active", value } });
|
handleInput({ target: { name: "is_active", value } });
|
||||||
setIsDisabled(value);
|
setIsActive(value);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Form.Control>
|
</Form.Control>
|
||||||
|
|
|
||||||
|
|
@ -362,7 +362,7 @@ export default function AdminPage() {
|
||||||
title="Edit"
|
title="Edit"
|
||||||
titleHeader={`${user.id}`}
|
titleHeader={`${user.id}`}
|
||||||
cancelText="Cancel"
|
cancelText="Cancel"
|
||||||
confirmationText="Edit"
|
confirmationText="Save"
|
||||||
icon={"UserPlus2"}
|
icon={"UserPlus2"}
|
||||||
data={user}
|
data={user}
|
||||||
index={index}
|
index={index}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue