remise des success a 0 ajout de l'interaction

This commit is contained in:
Little Dipper 2023-06-22 00:31:59 +02:00
parent 6bf99bd55e
commit f04ea25574
4 changed files with 64 additions and 28 deletions

View File

@ -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(
<Backdrop onClick={handleClose}>
<motion.div
@ -32,8 +35,23 @@ function YellowAlert ({handleClose, text}: AlertProps) {
animate="visible"
exit="exit"
>
{icon === 0 ? (
<GrTrophy/>
<p>{text}</p>
):("")}
{icon === 1 ? (
<MdQrCodeScanner/>
):("")}
{icon === 2 ? (
<GiCrownedSkull/>
):("")}
{icon === 3 ? (
<GiWingedSword/>
):("")}
<h5>{text}</h5>
</motion.div>
{setTimeout(handleClose, 3000)}
</Backdrop>

View File

@ -54,17 +54,6 @@ function Header() {
</motion.div>
<div className='end'>
{success.otp_verified ? (
<MdQrCodeScanner className='success' />
):("")}
{success.win >= 2 ? (
<GiWingedSword className="success" />
):("")}
{success.win >= 5 ? (
<GiCrownedSkull className="success" />
):("")}
<Link to="/profile" className='menu-bars'>
<div>

View File

@ -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 ? (
<div>
<motion.div onClick={() => (modalOpen ? close() : open())}>
<Link to="#" className="edit_name">
<motion.div >
<Link to="#" className="edit_name" onClick={() => (modalOpen ? close() : open())}>
{modalOpen === true ? <IoCloseCircleOutline/> : <CgEditMarkup/>}
</Link>
{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}}>
<div>
{/* {user.otp_verified ? ( */}
<MdQrCodeScanner className='success' />
{/* ):("")} */}
{/* {user.win >= 2 ? ( */}
<GiWingedSword className="success" />
{/* ):("")} */}
{user.otp_verified ? (
<MdQrCodeScanner className='success' onClick={() => setSuccessQr(true)}/>
):("")}
{user.win >= 2 ? (
<GiWingedSword className="success" onClick={() => setSuccessSword(true)}/>
):("")}
{/* {user.win >= 5 ? ( */}
<GiCrownedSkull className="success" />
{/* ):("")} */}
{user.win >= 5 ? (
<GiCrownedSkull className="success" onClick={() => setSuccessCrown(true)}/>
):("")}
</div>
<div className="home">
<motion.div animate={{x: move ? -200: 120}}
@ -266,6 +276,19 @@ function Home () {
onClick={ () => setmove(!move)}>
<Link to="#" className="history"><AiOutlineHistory/> Match History</Link>
</motion.div>
<AnimatePresence initial={false} onExitComplete={() => null}>
{successQr ? (
<YellowAlert handleClose={closeQr} text={"Success: You have the 2fa success!"} icon={1} />
) : ("")}
{successCrown ? (
<YellowAlert handleClose={closeCrown} text={"Success: 5 victory ? You won king slayer success!"} icon={2}/>
) : ("")}
{successSword ? (
<YellowAlert handleClose={closeSword} text={"Success: 2 victory ? You won the noobi warrior success!"} icon={3}/>
) : ("")}
</AnimatePresence>
</motion.div>
)
}

View File

@ -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{