diff --git a/.gitignore b/.gitignore index ace7e3a2..d9d0b8f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -#.env +.env +containers/react/.env backend/node_modules/ containers/backend/dist/ diff --git a/conf/init.sql b/conf/init.sql index 468babfc..91175420 100644 --- a/conf/init.sql +++ b/conf/init.sql @@ -1 +1 @@ -ALTER USER postgres WITH PASSWORD 'pass'; \ No newline at end of file +ALTER USER postgres WITH PASSWORD 'postgres'; \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf index f6d88f01..b8a40b8b 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -10,7 +10,7 @@ server { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; - proxy_pass http://react_app:8001; + proxy_pass http://react_app:8081; } location /api { diff --git a/containers/api/src/config/config.service.ts b/containers/api/src/config/config.service.ts index 5ac28d33..3c1cc837 100644 --- a/containers/api/src/config/config.service.ts +++ b/containers/api/src/config/config.service.ts @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* config.service.ts :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: apommier +#+ +:+ +#+ */ +/* By: sadjigui +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/04/09 14:53:49 by apommier #+# #+# */ -/* Updated: 2023/06/22 20:42:32 by apommier ### ########.fr */ +/* Updated: 2023/06/24 15:09:20 by sadjigui ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/containers/react/package.json b/containers/react/package.json index 705f72d4..46c0fdf3 100644 --- a/containers/react/package.json +++ b/containers/react/package.json @@ -22,7 +22,7 @@ "web-vitals": "^2.1.4" }, "scripts": { - "start": "HOST=0.0.0.0 PORT=8001 react-scripts start", + "start": "HOST=0.0.0.0 PORT=8081 react-scripts start", "start:dev": "npm run start --watch", "build": "react-scripts build", "test": "react-scripts test", diff --git a/containers/react/src/components/Alert/RedAlert.tsx b/containers/react/src/components/Alert/RedAlert.tsx index 9ec3c4bc..98062543 100644 --- a/containers/react/src/components/Alert/RedAlert.tsx +++ b/containers/react/src/components/Alert/RedAlert.tsx @@ -32,11 +32,11 @@ function RedAlert ({handleClose, text}: AlertProps) { initial="hidden" animate="visible" exit="exit" - > + >

{text}

- {setTimeout(handleClose, 1500)} + {setTimeout(handleClose, 1500)} ) } diff --git a/containers/react/src/components/Game/PlayButton.tsx b/containers/react/src/components/Game/PlayButton.tsx index 7e018a04..c42523c2 100644 --- a/containers/react/src/components/Game/PlayButton.tsx +++ b/containers/react/src/components/Game/PlayButton.tsx @@ -40,9 +40,9 @@ function PlayButton() { {/* !buttonClicked && */}
-

Super Power

-

Obstacle

-

Faster and Faster

+

Super Power

+

Obstacle

+

Faster and Faster

); diff --git a/containers/react/src/components/Messages/Chats.tsx b/containers/react/src/components/Messages/Chats.tsx index 24e5e3f2..c1ce0fe1 100644 --- a/containers/react/src/components/Messages/Chats.tsx +++ b/containers/react/src/components/Messages/Chats.tsx @@ -27,6 +27,7 @@ import PartyInvite from "./PartyInvite.tsx"; // import {User, Conv, Message} from "../../../interfaces.tsx" import {User, Conv} from "../../../interfaces.tsx" +import { IoLogoOctocat } from "react-icons/io5"; const TouchDiv = styled.div` margin-left: 10px; @@ -370,12 +371,13 @@ function Chats(){
- profile + {/* profile */} + {isLoading || !user ? (

Loading...

) : ( -

{user.nickname}

+

Chat

)}
{/*
@@ -444,7 +446,7 @@ function Chats(){ ))} - + null}> {showAddFriendAlert && addFriend && ( @@ -457,7 +459,7 @@ function Chats(){ - + null}> {showBlockAlert && block && ( diff --git a/containers/react/src/components/Messages/Message.tsx b/containers/react/src/components/Messages/Message.tsx index 34d98bd8..38814ba3 100644 --- a/containers/react/src/components/Messages/Message.tsx +++ b/containers/react/src/components/Messages/Message.tsx @@ -6,7 +6,7 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/06/01 18:24:46 by apommier #+# #+# */ -/* Updated: 2023/06/24 15:36:48 by apommier ### ########.fr */ +/* Updated: 2023/06/24 16:00:48 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ @@ -34,11 +34,11 @@ interface MessageMeProps { } function MessageMe({message, own}: MessageMeProps){ - + const [profilePicture, setProfilePicture] = useState(''); const [sender, setSender] = useState(); const [conv, setConv] = useState(); - + const [user, setUser] = useState(); const scrollRef = useRef(null); @@ -130,8 +130,8 @@ function MessageMe({message, own}: MessageMeProps){ {message.text}
- + ) } -export default MessageMe \ No newline at end of file +export default MessageMe diff --git a/containers/react/src/components/Profile/EditName.tsx b/containers/react/src/components/Profile/EditName.tsx index 35123169..da364971 100644 --- a/containers/react/src/components/Profile/EditName.tsx +++ b/containers/react/src/components/Profile/EditName.tsx @@ -1,12 +1,13 @@ -import {motion} from "framer-motion" +import { AnimatePresence, motion } from "framer-motion" // import Backdrop from "../Sidebar/Backdrop" -import {Link} from 'react-router-dom'; -import { UserProfile } from "../../DataBase/DataUserProfile"; -import {useState} from 'react'; +import { Link } from 'react-router-dom'; +// import { UserProfile } from "../../DataBase/DataUserProfile"; +import { useState } from 'react'; import "../../styles/Profile.css" import api from '../../script/axiosApi.tsx'; import React from "react"; +import RedAlert from "../Alert/RedAlert.tsx"; const dropIn = { hidden: { @@ -26,37 +27,55 @@ const dropIn = { // ) // } -const ModalEdit = ( handleClose ) => { +const ModalEdit = (handleClose) => { // let new_name = ""; const [nickname, setNickname] = useState(""); - - const handler = e => - { + const [errTaken, setErrTaken] = useState(false); + const closeTaken = () => setErrTaken(false); + const [errTooShort, setErrTooShort] = useState(false); + const closeTooShort = () => setErrTooShort(false); + + const handler = e => { setNickname(e.target.value); console.log("testeeeee") - const postNickname = async ()=>{ - try{ - await api.post("/nickname", {nickname: nickname}) - // setUser(tmpUser.data); - // setIsLoading(false) - } - catch(err){ - console.log(err); - } + const postNickname = async () => { + // try{ + // await api.post("/nickname", {nickname: nickname}) + // // setUser(tmpUser.data); + // // setIsLoading(false) + // } + // catch(err){ + // console.log(err); + // } }; postNickname(); } - const handlePostNickname = async () => - { - console.log("nickname=" ,nickname) - try{ - await api.post("/nickname", {nickname: nickname}) - window.location.reload(); + const handlePostNickname = async () => { + console.log("nickname=", nickname) + try { + const ret = await api.post("/nickname", { nickname: nickname }); + // console.log("cest ici = ",ret); + // if (!ret) + console.log("test ret =", ret.data); + if (nickname.length < 3) { + setErrTooShort(true); + } + else if (ret.data) { + console.log("ici error = ", ret.data); + window.location.reload(); + } + else { + console.log("nickname already set = ", ret.data); + + setErrTaken(true); + } + + // setUser(tmpUser.data); // setIsLoading(false) } - catch(err){ + catch (err) { console.log(err); } } @@ -66,23 +85,34 @@ const ModalEdit = ( handleClose ) => { // //do nothing // } return ( - -

Type your new name

- -
-
handlePostNickname()}> - change - {/* change */} -
+ +

Type your new name

+ +
+
+ change + {/* change */}
- - - + null}> + { + errTaken ? ( + + ) : ("") + } + { + errTooShort ? ( + + ) : ("") + } + + +
+
) } diff --git a/containers/react/src/pages/Home.tsx b/containers/react/src/pages/Home.tsx index 15f44bc2..10292d57 100644 --- a/containers/react/src/pages/Home.tsx +++ b/containers/react/src/pages/Home.tsx @@ -3,7 +3,7 @@ /* ::: :::::::: */ /* Home.tsx :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: apommier +#+ +:+ +#+ */ +/* By: sadjigui +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/06/09 08:19:04 by apommier #+# #+# */ /* Updated: 2023/06/23 22:11:28 by apommier ### ########.fr */ @@ -20,7 +20,7 @@ import { motion, AnimatePresence } from 'framer-motion' // import { GrClose } from 'react-icons/gr' import { Link } from "react-router-dom"; import ModalEdit from "../components/Profile/EditName.tsx"; -import {AiOutlineHistory} from 'react-icons/ai' +import {AiOutlineCloseCircle, AiOutlineHistory} from 'react-icons/ai' import { MdQrCodeScanner, MdOutlinePhotoLibrary } from 'react-icons/md'; import { GiWingedSword, GiCrownedSkull } from 'react-icons/gi'; @@ -78,7 +78,7 @@ function Profile () { } catch (error) { console.error('Error uploading file:', error); } - } + } // } }; @@ -130,7 +130,7 @@ function Profile () { {isLoading || !user ? (

Loading...

) : ( -

{user.nickname}

+

{user.nickname}

)} @@ -149,7 +149,7 @@ function Profile () { )} - + {/*
*/} {/* */} {/* */} @@ -215,13 +215,13 @@ function Home () {
{user && user.otp_verified ? ( setSuccessQr(true)}/> - ):("")} + ):("")} {user && user.win >= 2 ? ( setSuccessSword(true)}/> ):("")} {user && user.win >= 5 ? ( setSuccessCrown(true)}/> - ):("")} + ):("")}
setmove(!move)}> - Match History + {move ? ():()} Match History null}> {successQr ? ( @@ -251,8 +251,8 @@ function Home () { ) : ("")} - + ) } -export default Home \ No newline at end of file +export default Home diff --git a/containers/react/src/styles/Game.css b/containers/react/src/styles/Game.css index 38a0055a..7b2adb2a 100644 --- a/containers/react/src/styles/Game.css +++ b/containers/react/src/styles/Game.css @@ -3,6 +3,7 @@ margin: 50px; } + .rank_elements { border-width:1px; border-style:solid; @@ -25,4 +26,14 @@ height: 30px; width: 30px; border-radius: 50%; -} \ No newline at end of file +} + +@media screen and (max-width: 755px){ + .game{ + display: grid; + height: 20vh; + } + .scroll{ + height: 20vh; + } + } \ No newline at end of file diff --git a/containers/react/src/styles/Messages.css b/containers/react/src/styles/Messages.css index 7894a564..0c6a9d4c 100644 --- a/containers/react/src/styles/Messages.css +++ b/containers/react/src/styles/Messages.css @@ -375,3 +375,13 @@ input.in_howLong{ width: auto; margin-left: 10px; } + +.catchat{ + font-size: 30px; + margin-left: 12px; +} + +.block{ + font-size: 25px; + margin-left: 12px; +} diff --git a/containers/react/src/styles/Profile.css b/containers/react/src/styles/Profile.css index b26c6f4b..aaa20ee4 100644 --- a/containers/react/src/styles/Profile.css +++ b/containers/react/src/styles/Profile.css @@ -154,6 +154,13 @@ text-decoration: none; font-weight: bold; } + +.user_name{ + /* background-image: linear-gradient(90deg, #5843e4, #5a0760); */ + background: -webkit-linear-gradient(60deg, #5843e4, #5a0760); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; +} /* canvas { margin-top: 20px; border: solid 0px #ccc; diff --git a/containers/react/src/styles/field.css b/containers/react/src/styles/field.css index 1af64da6..0ff5ad5f 100644 --- a/containers/react/src/styles/field.css +++ b/containers/react/src/styles/field.css @@ -11,6 +11,10 @@ font-size: 300%; } + .inside_checkbox{ + height : 70%; + width: 70%; + } .field { background-color: rgb(249, 249, 249); @@ -65,6 +69,18 @@ } } +.responsive{ + display: flex; + flex-direction: column; +} + +/* @media screen and (max-width: 350px){ + .responsive{ + display:list-item; + flex-direction: column; + } + } */ + #myCanvas { background-color: rgb(124, 47, 47); /* position: absolute; */