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 { GrTrophy } from "react-icons/gr";
import '../../styles/Messages.css' import '../../styles/Messages.css'
import React from "react"; import React from "react";
import { MdQrCodeScanner } from "react-icons/md";
import { GiCrownedSkull, GiWingedSword } from "react-icons/gi";
const dropIn = { const dropIn = {
hidden: { hidden: {
@ -18,10 +20,11 @@ const dropIn = {
interface AlertProps { interface AlertProps {
handleClose: Function, handleClose: Function,
text: string text: string,
icon: number
} }
function YellowAlert ({handleClose, text}: AlertProps) { function YellowAlert ({handleClose, text, icon}: AlertProps) {
return( return(
<Backdrop onClick={handleClose}> <Backdrop onClick={handleClose}>
<motion.div <motion.div
@ -32,8 +35,23 @@ function YellowAlert ({handleClose, text}: AlertProps) {
animate="visible" animate="visible"
exit="exit" exit="exit"
> >
<GrTrophy/>
<p>{text}</p> {icon === 0 ? (
<GrTrophy/>
):("")}
{icon === 1 ? (
<MdQrCodeScanner/>
):("")}
{icon === 2 ? (
<GiCrownedSkull/>
):("")}
{icon === 3 ? (
<GiWingedSword/>
):("")}
<h5>{text}</h5>
</motion.div> </motion.div>
{setTimeout(handleClose, 3000)} {setTimeout(handleClose, 3000)}
</Backdrop> </Backdrop>

View File

@ -53,18 +53,7 @@ function Header() {
</Link> </Link>
</motion.div> </motion.div>
<div className='end'> <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'> <Link to="/profile" className='menu-bars'>
<div> <div>

View File

@ -36,6 +36,7 @@ import { IoCloseCircleOutline } from "react-icons/io5";
import React, { useState, useEffect, useRef, ChangeEventHandler } from "react"; import React, { useState, useEffect, useRef, ChangeEventHandler } from "react";
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
import {User, Conv} from "../../interfaces.tsx" import {User, Conv} from "../../interfaces.tsx"
import YellowAlert from '../components/Alert/YellowAlert.tsx';
// axios.get("http://localhost/api") // axios.get("http://localhost/api")
// .then((response) => { // .then((response) => {
// response = response.json() // response = response.json()
@ -185,8 +186,8 @@ function Profile () {
{mine ? ( {mine ? (
<div> <div>
<motion.div onClick={() => (modalOpen ? close() : open())}> <motion.div >
<Link to="#" className="edit_name"> <Link to="#" className="edit_name" onClick={() => (modalOpen ? close() : open())}>
{modalOpen === true ? <IoCloseCircleOutline/> : <CgEditMarkup/>} {modalOpen === true ? <IoCloseCircleOutline/> : <CgEditMarkup/>}
</Link> </Link>
{modalOpen === true ? ("") : ( {modalOpen === true ? ("") : (
@ -220,6 +221,15 @@ function Profile () {
function Home () { function Home () {
const [move, setmove ] = useState(false); const [move, setmove ] = useState(false);
const [user, setUser] = useState([]); 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(() => { useEffect(() => {
const fetchSuccess = async () => { const fetchSuccess = async () => {
try { try {
@ -240,16 +250,16 @@ function Home () {
animate={{opacity: 1}} animate={{opacity: 1}}
exit={{opacity: -1}}> exit={{opacity: -1}}>
<div> <div>
{/* {user.otp_verified ? ( */} {user.otp_verified ? (
<MdQrCodeScanner className='success' /> <MdQrCodeScanner className='success' onClick={() => setSuccessQr(true)}/>
{/* ):("")} */} ):("")}
{/* {user.win >= 2 ? ( */} {user.win >= 2 ? (
<GiWingedSword className="success" /> <GiWingedSword className="success" onClick={() => setSuccessSword(true)}/>
{/* ):("")} */} ):("")}
{/* {user.win >= 5 ? ( */} {user.win >= 5 ? (
<GiCrownedSkull className="success" /> <GiCrownedSkull className="success" onClick={() => setSuccessCrown(true)}/>
{/* ):("")} */} ):("")}
</div> </div>
<div className="home"> <div className="home">
<motion.div animate={{x: move ? -200: 120}} <motion.div animate={{x: move ? -200: 120}}
@ -266,7 +276,20 @@ function Home () {
onClick={ () => setmove(!move)}> onClick={ () => setmove(!move)}>
<Link to="#" className="history"><AiOutlineHistory/> Match History</Link> <Link to="#" className="history"><AiOutlineHistory/> Match History</Link>
</motion.div> </motion.div>
</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); background-color: rgba(212, 175, 55, 0.7);
font-size: 25px; font-size: 25px;
color: rgba(255, 255, 255, 1); color: rgba(255, 255, 255, 1);
flex-wrap: wrap;
}
.yellowAlert::p {
overflow-wrap: break-word;
max-width: 1000px;
} }
.modalSetting{ .modalSetting{