✨ Add a loader to users
This commit is contained in:
parent
b14a7a5fbf
commit
ee2b018c2c
@ -83,3 +83,15 @@
|
||||
.remove-my-vote {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.loader-container {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
.loader {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import { useCallback, useEffect, useState } from "react";
|
||||
|
||||
import classes from "./classes.module.scss";
|
||||
import OfficeRoles from "@Front/Api/LeCoffreApi/Admin/OfficeRoles/OfficeRoles";
|
||||
import Loader from "@Front/Components/DesignSystem/Loader";
|
||||
|
||||
type IProps = {};
|
||||
export default function UserInformations(props: IProps) {
|
||||
@ -36,10 +37,12 @@ export default function UserInformations(props: IProps) {
|
||||
|
||||
const [currentAppointment, setCurrentAppointment] = useState<Appointment | null>(null);
|
||||
|
||||
const [isLoading, setIsLoading] = useState<boolean>(true);
|
||||
/** When page change, get the user of the page */
|
||||
|
||||
const getUser = useCallback(async () => {
|
||||
if (!userUid) return;
|
||||
setIsLoading(true);
|
||||
const user = await Users.getInstance().getByUid(userUid as string, {
|
||||
q: {
|
||||
contact: true,
|
||||
@ -66,6 +69,7 @@ export default function UserInformations(props: IProps) {
|
||||
},
|
||||
});
|
||||
if (!roles) return;
|
||||
setIsLoading(false);
|
||||
setUserSelected(user);
|
||||
}, [userUid]);
|
||||
|
||||
@ -201,9 +205,12 @@ export default function UserInformations(props: IProps) {
|
||||
|
||||
return (
|
||||
<DefaultUserDashboard mobileBackText={"Liste des utilisateurs"}>
|
||||
{!isLoading && (
|
||||
<div className={classes["root"]}>
|
||||
<div className={classes["header"]}>
|
||||
<Typography typo={ITypo.H1Bis}>{userSelected?.contact?.first_name + " " + userSelected?.contact?.last_name}</Typography>
|
||||
<Typography typo={ITypo.H1Bis}>
|
||||
{userSelected?.contact?.first_name + " " + userSelected?.contact?.last_name}
|
||||
</Typography>
|
||||
<Typography typo={ITypo.H3} color={ITypoColor.GREY}>
|
||||
Office {userSelected?.office_membership?.name.toLocaleUpperCase()}
|
||||
</Typography>
|
||||
@ -306,8 +313,8 @@ export default function UserInformations(props: IProps) {
|
||||
cancelText={"Annuler"}>
|
||||
<div className={classes["modal-content"]}>
|
||||
<Typography typo={ITypo.P_16} className={classes["text"]}>
|
||||
{superAdminModalType === "add" ? "Nommer" : "Retirer"} une personne Super Administrateur nécessite 3 votes de
|
||||
super administrateurs existants. Souhaitez-vous attribuer un vote ?
|
||||
{superAdminModalType === "add" ? "Nommer" : "Retirer"} une personne Super Administrateur nécessite 3 votes
|
||||
de super administrateurs existants. Souhaitez-vous attribuer un vote ?
|
||||
</Typography>
|
||||
</div>
|
||||
</Confirm>
|
||||
@ -330,6 +337,14 @@ export default function UserInformations(props: IProps) {
|
||||
<div className={classes["modal-content"]}></div>
|
||||
</Confirm>
|
||||
</div>
|
||||
)}
|
||||
{isLoading && (
|
||||
<div className={classes["loader-container"]}>
|
||||
<div className={classes["loader"]}>
|
||||
<Loader />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</DefaultUserDashboard>
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user