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

View File

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

View File

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