From f04ea2557409f391ebad4494907b1889429e9e48 Mon Sep 17 00:00:00 2001 From: Little Dipper Date: Thu, 22 Jun 2023 00:31:59 +0200 Subject: [PATCH] remise des success a 0 ajout de l'interaction --- .../src/components/Alert/YellowAlert.tsx | 26 ++++++++-- containers/react/src/components/Header.tsx | 13 +---- containers/react/src/pages/Home.tsx | 47 ++++++++++++++----- containers/react/src/styles/Messages.css | 6 +++ 4 files changed, 64 insertions(+), 28 deletions(-) diff --git a/containers/react/src/components/Alert/YellowAlert.tsx b/containers/react/src/components/Alert/YellowAlert.tsx index 1537dd54..eab74971 100644 --- a/containers/react/src/components/Alert/YellowAlert.tsx +++ b/containers/react/src/components/Alert/YellowAlert.tsx @@ -3,6 +3,8 @@ import { motion } from 'framer-motion' import { GrTrophy } from "react-icons/gr"; import '../../styles/Messages.css' import React from "react"; +import { MdQrCodeScanner } from "react-icons/md"; +import { GiCrownedSkull, GiWingedSword } from "react-icons/gi"; const dropIn = { hidden: { @@ -18,10 +20,11 @@ const dropIn = { interface AlertProps { handleClose: Function, - text: string + text: string, + icon: number } -function YellowAlert ({handleClose, text}: AlertProps) { +function YellowAlert ({handleClose, text, icon}: AlertProps) { return( - -

{text}

+ + {icon === 0 ? ( + + ):("")} + {icon === 1 ? ( + + ):("")} + + {icon === 2 ? ( + + ):("")} + + {icon === 3 ? ( + + ):("")} + +
{text}
{setTimeout(handleClose, 3000)}
diff --git a/containers/react/src/components/Header.tsx b/containers/react/src/components/Header.tsx index 9a607f9a..27ce65a3 100644 --- a/containers/react/src/components/Header.tsx +++ b/containers/react/src/components/Header.tsx @@ -53,18 +53,7 @@ function Header() {
- - {success.otp_verified ? ( - - ):("")} - {success.win >= 2 ? ( - - ):("")} - - {success.win >= 5 ? ( - - ):("")} - +
diff --git a/containers/react/src/pages/Home.tsx b/containers/react/src/pages/Home.tsx index 9bb31121..ecfbc71e 100644 --- a/containers/react/src/pages/Home.tsx +++ b/containers/react/src/pages/Home.tsx @@ -36,6 +36,7 @@ import { IoCloseCircleOutline } from "react-icons/io5"; import React, { useState, useEffect, useRef, ChangeEventHandler } from "react"; import { useParams } from 'react-router-dom'; import {User, Conv} from "../../interfaces.tsx" +import YellowAlert from '../components/Alert/YellowAlert.tsx'; // axios.get("http://localhost/api") // .then((response) => { // response = response.json() @@ -185,8 +186,8 @@ function Profile () { {mine ? (
- (modalOpen ? close() : open())}> - + + (modalOpen ? close() : open())}> {modalOpen === true ? : } {modalOpen === true ? ("") : ( @@ -220,6 +221,15 @@ function Profile () { function Home () { const [move, setmove ] = useState(false); const [user, setUser] = useState([]); + + const [successQr, setSuccessQr] = useState(false); + const [successSword, setSuccessSword] = useState(false); + const [successCrown, setSuccessCrown] = useState(false); + const closeQr = () => setSuccessQr(false); + const closeSword = () => setSuccessSword(false); + const closeCrown = () => setSuccessCrown(false); + + useEffect(() => { const fetchSuccess = async () => { try { @@ -240,16 +250,16 @@ function Home () { animate={{opacity: 1}} exit={{opacity: -1}}>
- {/* {user.otp_verified ? ( */} - - {/* ):("")} */} - {/* {user.win >= 2 ? ( */} - - {/* ):("")} */} + {user.otp_verified ? ( + setSuccessQr(true)}/> + ):("")} + {user.win >= 2 ? ( + setSuccessSword(true)}/> + ):("")} - {/* {user.win >= 5 ? ( */} - - {/* ):("")} */} + {user.win >= 5 ? ( + setSuccessCrown(true)}/> + ):("")}
setmove(!move)}> Match History - + null}> + {successQr ? ( + + ) : ("")} + + {successCrown ? ( + + ) : ("")} + + {successSword ? ( + + ) : ("")} + + ) } diff --git a/containers/react/src/styles/Messages.css b/containers/react/src/styles/Messages.css index 39c457fc..81d05423 100644 --- a/containers/react/src/styles/Messages.css +++ b/containers/react/src/styles/Messages.css @@ -288,6 +288,12 @@ p { background-color: rgba(212, 175, 55, 0.7); font-size: 25px; color: rgba(255, 255, 255, 1); + flex-wrap: wrap; +} + +.yellowAlert::p { + overflow-wrap: break-word; + max-width: 1000px; } .modalSetting{