This commit is contained in:
pro.boooooo 2024-03-31 23:57:58 +02:00
parent 46aa945c1c
commit 61a3513ef4
5 changed files with 36 additions and 28 deletions

View File

@ -0,0 +1,19 @@
import { MagnifyingGlass } from "react-loader-spinner";
import "./LoaderSpace.scss";
export default function LoaderSpace({ isVisible }) {
return (
<div className="loader-space-container">
<MagnifyingGlass
visible={isVisible}
height="100"
width="100"
ariaLabel="magnifying-glass-loading"
wrapperStyle={{}}
wrapperClass="magnifying-glass-wrapper"
glassColor="#ffffff"
color="#7B6A9C"
/>
</div>
);
}

View File

@ -0,0 +1,8 @@
.loader-space-container {
position: absolute;
z-index: 9999;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}

View File

@ -6,7 +6,7 @@ import { useState } from "react";
import Chart from "react-apexcharts";
import "./home.scss";
import { Link } from "react-router-dom";
import { MagnifyingGlass } from "react-loader-spinner";
import LoaderSpace from "../../components/LoaderSpace/LoaderSpace";
export const Home = () => {
const { user } = useAuth();
@ -82,16 +82,7 @@ export const Home = () => {
</div>
)}
<MagnifyingGlass
visible={isLoad}
height="100"
width="100"
ariaLabel="magnifying-glass-loading"
wrapperStyle={{}}
wrapperClass="magnifying-glass-wrapper"
glassColor="#ffffff"
color="#7B6A9C"
/>
<LoaderSpace isVisible={isLoad} />
{dataset ? (
<div id="stats-container">

View File

@ -143,10 +143,11 @@
height: 400px;
display: flex;
flex-direction: column;
position: fixed;
justify-content: center;
gap: 20px;
padding: 20px;
z-index: 9999;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);

View File

@ -2,7 +2,7 @@ import "./Rooms.scss";
import { useState, useEffect } from "react";
import { createRoom, getRooms, deleteRoom } from "../../api";
import { Link } from "react-router-dom";
import { MagnifyingGlass } from "react-loader-spinner";
import LoaderSpace from "../../components/LoaderSpace/LoaderSpace";
export default function Rooms() {
const [rooms, setRooms] = useState(null);
@ -22,11 +22,11 @@ export default function Rooms() {
const onClickDelete = (id, name) => {
const confirmation = prompt(
`Etes-vous sur de vouloir supprimer ${name} ? (Oui ou non)`,
"non",
`Etes-vous sur de vouloir supprimer ${name} ? (oui ou non)`,
"oui",
);
if (!confirmation || !confirmation.toLocaleLowerCase() !== "oui") return;
if (!confirmation || confirmation.toLocaleLowerCase() !== "oui") return;
deleteRoom(id).then((res) => {
const values = rooms.filter((e) => e._id !== id);
@ -83,18 +83,7 @@ export default function Rooms() {
))}
</div>
) : (
<div>
<MagnifyingGlass
visible={isLoad}
height="100"
width="100"
ariaLabel="magnifying-glass-loading"
wrapperStyle={{}}
wrapperClass="magnifying-glass-wrapper"
glassColor="#ffffff"
color="#7B6A9C"
/>
</div>
<LoaderSpace isVisible={isLoad} />
)}
{isErr && !isLoad ? (