diff --git a/containers/api/src/app.controller.ts b/containers/api/src/app.controller.ts index ccd9bc25..685952e3 100644 --- a/containers/api/src/app.controller.ts +++ b/containers/api/src/app.controller.ts @@ -6,7 +6,7 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/06/17 01:00:00 by apommier #+# #+# */ -/* Updated: 2023/06/28 16:50:11 by apommier ### ########.fr */ +/* Updated: 2023/06/28 17:43:13 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ @@ -50,7 +50,6 @@ export class AppController { @Post('/logout') async logout(@Request() req, @Body() data: any) { const user = await this.userService.findOne(req.user.username) - // return await this.userService.refuseInvite(user, data.username); if(!user) return ; if (user.sessionNumber === 1) @@ -304,7 +303,6 @@ export class AppController { return ; if (user.sessionNumber > 0) user.sessionNumber--; - console.log("seesion number=", user.sessionNumber) if (!user.sessionNumber) user.status = 0; await this.userService.save(user); @@ -423,15 +421,12 @@ export class AppController { text: data.text, id: null, } - console.log(data); return await this.chatService.createMessage(message, req.user.username); } @UseGuards(JwtAuthGuard) @Post('/member') async getMember(@Body() data: any) { - console.log(data); - console.log(`get member= ${data.convId}`); return await this.chatService.findConv(data.convId); } @@ -450,14 +445,12 @@ export class AppController { @UseGuards(JwtAuthGuard) @Post('/password') async setPassword(@Body() data: any) { - // console.log("PASSSSSSSSSSSSSSSSSSSSSSSSSSs= ", data.password); return await this.chatService.setPassword(data.convId, data.password) } @UseGuards(JwtAuthGuard) @Post('/verifyPassword') async verifyPassword(@Request() req, @Body() data: any) { - // const user = await this.userService.findOne(req.user.username); return await this.chatService.verifyPassword(data.convId, data.password, req.user.username) } @@ -494,7 +487,6 @@ export class AppController { @UseGuards(JwtAuthGuard) @Post('/isAdmin') async isAdmin(@Request() req, @Body() data: any) { - console.log("isdamin= ", req.user.username, " id=", data.convId) return await this.chatService.isAdmin(data.convId, req.user.username) } diff --git a/containers/api/src/auth/auth.service.ts b/containers/api/src/auth/auth.service.ts index 8f0a2455..8c2d5169 100644 --- a/containers/api/src/auth/auth.service.ts +++ b/containers/api/src/auth/auth.service.ts @@ -21,12 +21,7 @@ export class AuthService { } async login(user: User) { - // const myJSON = JSON.stringify(user); - // console.log(`in login all user= ${myJSON}`) - console.log(`in login user= ${user.username}`) const payload = { username: user.username, sub: user.userId }; - console.log(`in login payload name= ${payload.username}`) - console.log(`in login payload sub= ${payload.sub}`) return { access_token: this.jwtService.sign(payload), }; diff --git a/containers/api/src/auth/jwt.strategy.ts b/containers/api/src/auth/jwt.strategy.ts index 6abae744..24500b15 100644 --- a/containers/api/src/auth/jwt.strategy.ts +++ b/containers/api/src/auth/jwt.strategy.ts @@ -14,8 +14,6 @@ export class JwtStrategy extends PassportStrategy(Strategy) { } async validate(payload: any) { - console.log("in validate function") - console.log(`userid= ${payload.sub} nickname= ${payload.username}`) return { userId: payload.sub, username: payload.username }; } } \ No newline at end of file diff --git a/containers/api/src/auth/login42.ts b/containers/api/src/auth/login42.ts index b9fda15c..1052da5b 100644 --- a/containers/api/src/auth/login42.ts +++ b/containers/api/src/auth/login42.ts @@ -55,7 +55,6 @@ export class loginClass { otp_base32: null, children: null, status: 1, - // doubleAuth: 0, otp_enabled: false, otp_verified: false, friendRequest: null, diff --git a/containers/api/src/chat/chat.service.ts b/containers/api/src/chat/chat.service.ts index 7a53445a..17524f64 100644 --- a/containers/api/src/chat/chat.service.ts +++ b/containers/api/src/chat/chat.service.ts @@ -6,7 +6,7 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/06/17 01:00:25 by apommier #+# #+# */ -/* Updated: 2023/06/26 10:17:36 by apommier ### ########.fr */ +/* Updated: 2023/06/28 17:43:35 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ @@ -153,13 +153,11 @@ async isAdmin(convId: number, username: string) { conv.admin = conv.admin || []; if (conv.admin.find(item => item === username)) return (1); - console.log("nope"); return (0); } async setPrivate(convId: number, bool: boolean) { const conv = await this.findConv(convId); - console.log("bool= ", bool); conv.private = bool; this.save(conv); } diff --git a/containers/api/src/config/config.service.ts b/containers/api/src/config/config.service.ts index 3c1cc837..e14259e9 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: sadjigui +#+ +:+ +#+ */ +/* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/04/09 14:53:49 by apommier #+# #+# */ -/* Updated: 2023/06/24 15:09:20 by sadjigui ### ########.fr */ +/* Updated: 2023/06/28 17:41:26 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ @@ -20,8 +20,6 @@ export const getTypeOrmConfig = (): TypeOrmModuleOptions => ({ password: process.env.POSTGRES_PASSWORD || 'postgres', database: process.env.POSTGRES_DATABASE || 'postgres', entities: ["dist/**/*.entity.js"], - // entities: [join(__dirname, '**', '*.entity.{ts,js}')] - // entities: ['**/*.entity{.ts,.js}'], //basic migrationsTableName: 'migration', migrations: ['src/migration/*.ts'], ssl: process.env.MODE !== 'DEV', diff --git a/containers/api/src/main.ts b/containers/api/src/main.ts index 38813cc9..95a417b8 100644 --- a/containers/api/src/main.ts +++ b/containers/api/src/main.ts @@ -4,7 +4,6 @@ import * as session from 'express-session'; import * as dotenv from 'dotenv'; dotenv.config(); -console.log(process.env); async function bootstrap() { const app = await NestFactory.create(AppModule, { diff --git a/containers/api/src/model/user.entity.ts b/containers/api/src/model/user.entity.ts index e6651e24..902bc53f 100644 --- a/containers/api/src/model/user.entity.ts +++ b/containers/api/src/model/user.entity.ts @@ -1,19 +1,6 @@ -// item.entity.ts -// import { BaseEntity } from './base.entity'; - -// @Column({ type: 'varchar', length: 300 , nullable: true}) -// name: string; - -// @Column({ type: 'varchar', length: 300 , nullable: true}) -// description: string; - - import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm'; import { ManyToOne, OneToMany } from 'typeorm'; - - - @Entity({ name: 'User' }) export class User { @@ -56,7 +43,7 @@ export class User { @Column({ default: 0 }) rank: number; - @Column({ default: 0 }) //0 = offline | 1 = connected | 2 = in game + @Column({ default: 0 }) status: number; @Column({ default: 0 }) diff --git a/containers/api/src/users/users.service.ts b/containers/api/src/users/users.service.ts index 9d01be8d..bbb1172d 100644 --- a/containers/api/src/users/users.service.ts +++ b/containers/api/src/users/users.service.ts @@ -6,7 +6,7 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/06/17 01:00:07 by apommier #+# #+# */ -/* Updated: 2023/06/26 07:52:08 by apommier ### ########.fr */ +/* Updated: 2023/06/28 17:43:46 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ @@ -59,7 +59,6 @@ export class UsersService { const user = await this.findOne(username) let friendsTab = user.friends || []; const friends = await this.userRepository.query("SELECT * FROM \"User\" WHERE username = ANY ($1);", [friendsTab]); - console.log(friends) return (friends) } @@ -80,9 +79,7 @@ export class UsersService { async getInvite(username: string) { const user = await this.findOne(username) let friendsTab = user.friendRequest - console.log(friendsTab) const friends = await this.userRepository.query("SELECT * FROM \"User\" WHERE username = ANY ($1);", [friendsTab]); - console.log(friends) return (friends) } diff --git a/containers/chat/src/chat/chat.gateway.ts b/containers/chat/src/chat/chat.gateway.ts index 0215c96e..2cb4acfa 100644 --- a/containers/chat/src/chat/chat.gateway.ts +++ b/containers/chat/src/chat/chat.gateway.ts @@ -76,8 +76,6 @@ banUser(client: any, payload: any): void { } const bannedClients = this.clientsNames.get(payload.username); bannedClients.forEach(client => { - console.log("Banning client:", client); - console.log("clietn socket=", this.clients[client]) this.clients[client].emit('ban', payload); }); } @@ -106,8 +104,6 @@ muteUser(client: any, payload: any): void { { if (targetClient && targetClient !== client.id) this.clients[targetClient].emit('message', payload) - else - console.log("not sending"); }); } }); diff --git a/containers/chat/src/main.ts b/containers/chat/src/main.ts index 327332c3..5672385a 100644 --- a/containers/chat/src/main.ts +++ b/containers/chat/src/main.ts @@ -6,7 +6,6 @@ import * as socketio from 'socket.io'; import * as dotenv from 'dotenv'; dotenv.config(); -console.log(process.env); async function bootstrap() { const app = await NestFactory.create(AppModule, { diff --git a/containers/pong/src/main.ts b/containers/pong/src/main.ts index c3b316bc..fedffb87 100644 --- a/containers/pong/src/main.ts +++ b/containers/pong/src/main.ts @@ -4,7 +4,6 @@ import * as socketio from 'socket.io'; import * as dotenv from 'dotenv'; dotenv.config(); -console.log(process.env); async function bootstrap() { const app = await NestFactory.create(AppModule, { diff --git a/containers/pong/src/pong/pong.gateway.ts b/containers/pong/src/pong/pong.gateway.ts index ccbd9bcc..083f49b5 100644 --- a/containers/pong/src/pong/pong.gateway.ts +++ b/containers/pong/src/pong/pong.gateway.ts @@ -6,7 +6,7 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/06/19 15:18:38 by apommier #+# #+# */ -/* Updated: 2023/06/26 07:04:47 by apommier ### ########.fr */ +/* Updated: 2023/06/28 17:46:12 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ @@ -69,7 +69,7 @@ export class PongGateway implements OnGatewayInit, OnGatewayConnection, OnGatewa @SubscribeMessage('pong:disconnect') disconnectClient(client: Socket, payload: any): void { - console.log("disconnect forced client= ", client.id) + console.log("Forced disconnect client= ", client.id) for (const key in this.clients) { if (this.clients.hasOwnProperty(key) && this.clients[key] === client) @@ -184,8 +184,6 @@ addPrivateParty(client: Socket, payload: any): void { @SubscribeMessage('pong:power') sendPower(client: Socket, payload: any): void { - console.log(`from: ${client.id}`); - const game = this.games.get(payload.gameId); const playersIds = game.map(socket => socket.id); if (playersIds[0] === payload.id) @@ -197,8 +195,6 @@ addPrivateParty(client: Socket, payload: any): void { @SubscribeMessage('pong:message') handleMessage(client: Socket, payload: any): void { - console.log(`from: ${client.id}`); - const game = this.games.get(payload.gameId); const playersIds = game.map(socket => socket.id); if (playersIds[0] === payload.id) @@ -249,7 +245,6 @@ addPrivateParty(client: Socket, payload: any): void { { const game = this.games.get(payload.gameId); const playersIds = game.map(socket => socket.id); - console.log(`id of 0= ${playersIds[0]}`); if (playersIds[0] === payload.id) { @@ -266,7 +261,6 @@ addPrivateParty(client: Socket, payload: any): void { { const game = this.games.get(payload.gameId); const playersIds = game.map(socket => socket.id); - console.log(`id of 0 mypoint= ${playersIds[0]}`); if (playersIds[0] === payload.id) this.clients[playersIds[1]].emit('pong:hisPoint', payload); @@ -279,7 +273,7 @@ addPrivateParty(client: Socket, payload: any): void { { const game = this.games.get(payload.gameId); const playersIds = game.map(socket => socket.id); - console.log(`name of client= ${payload.name}`); + if (playersIds[0] === payload.id) { this.clients[playersIds[1]].emit('pong:name', payload); diff --git a/containers/react/.env b/containers/react/.env index dff6b578..b60941d2 100644 --- a/containers/react/.env +++ b/containers/react/.env @@ -5,7 +5,6 @@ REACT_APP_SOCKET_URL=paul-f5Ar4s4 REACT_APP_API_SECRET=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 REACT_APP_CLIENT_UID=u-s4t2ud-2bd3c5d4f41e776f2e3d5d699d2a8421f6d0c0468ec882516d9ca89b0c211789 - # REACT_APP_BASE_URL=92.143.191.152 # REACT_APP_BASE_URL=192.168.1.19 REACT_APP_INTRA_URL="https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-2bd3c5d4f41e776f2e3d5d699d2a8421f6d0c0468ec882516d9ca89b0c211789&redirect_uri=http%3A%2F%2Fpaul-f5Ar4s4%3A8080%2Fapi%2Fauth%2Flogin&response_type=code" diff --git a/containers/react/src/components/App.tsx b/containers/react/src/components/App.tsx index a35a8992..6bc79321 100644 --- a/containers/react/src/components/App.tsx +++ b/containers/react/src/components/App.tsx @@ -22,19 +22,7 @@ import api from "../script/axiosApi.tsx" function AnimatedRoute() { - useEffect(() => { - // const handleBeforeUnload = async (event: { preventDefault: () => void; returnValue: string; }) => { - // console.log("git ") - // if (!localStorage.getItem('token')) - // return; - // try { - // await api.post("/quit"); - // // navigator.sendBeacon("http://" + process.env.REACT_APP_BASE_URL + "/api/quit", {username: user.username}) - // } catch (err) { - // console.log(err); - // } - // }; - + useEffect(() => { const handleLoad = async () => { if (!localStorage.getItem('token')) return; @@ -52,14 +40,7 @@ function AnimatedRoute() { return; await api.post("/quit"); }); - // window.addEventListener("unload", async (event) => { - // await api.post("/quit"); - // }); - - - return () => { - // window.removeEventListener('beforeunload', handleBeforeUnload); - }; + return () => {}; }, []); const location = useLocation(); diff --git a/containers/react/src/components/Footer.tsx b/containers/react/src/components/Footer.tsx deleted file mode 100644 index 87bec15c..00000000 --- a/containers/react/src/components/Footer.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import React from 'react'; - -function Footer() { - return ( -
-

© 2023 Paris France

-
- ); -} - -export default Footer; \ No newline at end of file diff --git a/containers/react/src/components/Game/Rank.tsx b/containers/react/src/components/Game/Rank.tsx index 8c16948e..df780134 100644 --- a/containers/react/src/components/Game/Rank.tsx +++ b/containers/react/src/components/Game/Rank.tsx @@ -6,17 +6,14 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/06/09 08:49:24 by apommier #+# #+# */ -/* Updated: 2023/06/23 17:16:40 by apommier ### ########.fr */ +/* Updated: 2023/06/28 17:39:43 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ -// import React from "react" import React, { useState, useEffect, useRef } from "react"; -// import {Rank} from '../../DataBase/DataRank.js' import DefaultPicture from '../../assets/profile.jpg' import api from '../../script/axiosApi.tsx'; -import {Matchlog, User} from "../../../interfaces.tsx" -// import { Match } from "@testing-library/react"; +import {User} from "../../../interfaces.tsx" interface RankProps { user: User diff --git a/containers/react/src/components/Messages/Modal.tsx b/containers/react/src/components/Messages/Modal.tsx index 86ba9a7c..b6552491 100644 --- a/containers/react/src/components/Messages/Modal.tsx +++ b/containers/react/src/components/Messages/Modal.tsx @@ -75,9 +75,8 @@ const Modal = ({handleClose}: ModalProps) => { return; try { const ret = await api.post("/verifyPassword", {convId: channel, password: PassWord}) - if (ret) - console.log("ici ret password", ret); - // window.location.reload(); + if (ret.data) + window.location.reload(); } catch (err) { console.log(err); } @@ -100,7 +99,7 @@ const Modal = ({handleClose}: ModalProps) => { const joinChannel = async () => { try { await api.post("/join", {convId: channel}) - // window.location.reload(); + window.location.reload(); } catch(err) { console.log(err); } @@ -183,12 +182,14 @@ const Modal = ({handleClose}: ModalProps) => { {askPass ? ( setPassWord(e.target.value)} onKeyDown={handlePassword}/> - ):("") } + ):( +
+ Join +
+ )} -
- Join -
+ diff --git a/containers/react/src/components/Profile/EditName.tsx b/containers/react/src/components/Profile/EditName.tsx index e1cc0596..173c58cd 100644 --- a/containers/react/src/components/Profile/EditName.tsx +++ b/containers/react/src/components/Profile/EditName.tsx @@ -30,7 +30,6 @@ const ModalEdit = () => { } const handlePostNickname = async () => { - console.log("nickname=", nickname) try { if (nickname.length > 3) { const ret = await api.post("/nickname", { nickname: nickname }); diff --git a/containers/react/src/components/Profile/Win_Loss.tsx b/containers/react/src/components/Profile/Win_Loss.tsx index 7b298225..e8ea4a43 100644 --- a/containers/react/src/components/Profile/Win_Loss.tsx +++ b/containers/react/src/components/Profile/Win_Loss.tsx @@ -4,7 +4,6 @@ import React, { useState, useEffect, useRef } from "react"; import { useParams } from 'react-router-dom'; import api from '../../script/axiosApi.tsx'; - function WinLoss() { const [user, setUser] = useState(); @@ -16,7 +15,6 @@ function WinLoss() { useEffect(()=> { const getUser = async ()=>{ try{ - console.log("username win loss=", username) let tmpUser; let tmpHistory; diff --git a/containers/react/src/components/Social/Friend.tsx b/containers/react/src/components/Social/Friend.tsx index 8774b814..133146a2 100644 --- a/containers/react/src/components/Social/Friend.tsx +++ b/containers/react/src/components/Social/Friend.tsx @@ -6,7 +6,7 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/06/09 08:18:58 by apommier #+# #+# */ -/* Updated: 2023/06/23 17:12:07 by apommier ### ########.fr */ +/* Updated: 2023/06/28 17:46:36 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,7 +16,6 @@ import DefaultPicture from '../../assets/profile.jpg' import styled from "styled-components"; import { RxCircle } from "react-icons/rx"; -import { CgFontSpacing } from "react-icons/cg"; import React from "react"; import {User} from "../../../interfaces.tsx" @@ -34,16 +33,10 @@ const UserChat = styled.div ` } ` -const SideP = styled.p` - font-size: 14px; - color: lightgray; - margin-left: 15px; -` interface UserProps { currentUser: User } -// export default function Friend({currentUser}) export default function Friend({currentUser}: UserProps) { const [profilePicture, setProfilePicture] = useState(''); @@ -51,10 +44,7 @@ export default function Friend({currentUser}: UserProps) useEffect(() => { const fetchProfilePicture = async () => { try { - // const user = await api.get("/profile"); const pic = await api.post("/getPicture", {username: currentUser.username}) - // console.log(`user naem profile pic222= ${currentUser.username}`) - // console.log(` profile pic222= ${pic.data}`) setProfilePicture(pic.data); } catch (error) { console.error('Error fetching profile picture:', error); @@ -67,8 +57,6 @@ export default function Friend({currentUser}: UserProps) { let status = friend.status let session =friend.sessionNumber - console.log(`session= ${session}`) - console.log(`status= ${status}`) let statusColor; if (status === 0) @@ -80,17 +68,8 @@ export default function Friend({currentUser}: UserProps) return statusColor; } - const handleSpectate = (user: User) => { - //socket connection and add to party with one with username - console.log(`spectate hehe`) - console.log(`user= ${user}`) - }; - const handleButtonClick = (user: User) => { let path = `http://` + process.env.REACT_APP_BASE_URL + `/profile/${user.username}`; - console.log("path= ", path) - // history(path, { replace: true }); - // window.location.replace(path); window.history.pushState({}, '', path); window.location.reload(); }; @@ -111,9 +90,3 @@ export default function Friend({currentUser}: UserProps) ) } -// spectate visible -// {getStatus(currentUser) !== 'blue' ? ( -// <> -// ) : ( -// -// )} diff --git a/containers/react/src/components/Social/FriendRequest.tsx b/containers/react/src/components/Social/FriendRequest.tsx index bf83fd03..cc0c30b0 100644 --- a/containers/react/src/components/Social/FriendRequest.tsx +++ b/containers/react/src/components/Social/FriendRequest.tsx @@ -21,12 +21,6 @@ const UserChat = styled.div ` } ` -const SideP = styled.p` - font-size: 14px; - color: lightgray; - margin-left: 15px; -` - interface UserProps { currentUser: User } @@ -36,19 +30,13 @@ export default function Friend({currentUser}: UserProps) const [profilePicture, setProfilePicture] = useState(''); const [request, setRequest] = useState(); //user who invite const [clickEvent, setClickEvent] = useState(false); - // const [user, setUser] = useState(null); useEffect(() => { const fetchProfilePicture = async () => { try { - // const user = await api.get("/profile");\ - // const tmpUser = await api.get("/profile") const pic = await api.post("/getPicture", {username: currentUser.username}) const tmpRequest = await api.post("/user", {username: currentUser.username}) - // setUser(tmpUser.data); setRequest(tmpRequest.data); - // console.log(`user naem profile pic222= ${currentUser.username}`) - // console.log(` profile pic222= ${pic.data}`) setProfilePicture(pic.data); } catch (error) { console.error('Error fetching profile picture:', error); @@ -60,8 +48,6 @@ export default function Friend({currentUser}: UserProps) const handleButtonClick = (user: User) => { let path = `http://` + process.env.REACT_APP_BASE_URL + `/profile/${user.username}`; - // history(path, { replace: true }); - // window.location.replace(path); window.history.pushState({}, '', path); window.location.reload(); }; @@ -73,8 +59,7 @@ export default function Friend({currentUser}: UserProps) } catch(err) { console.log(err); } - console.log("accept") - console.log(`request = ${request}`) + window.location.reload(); } const Refuse = async (request: User) => { @@ -84,13 +69,11 @@ export default function Friend({currentUser}: UserProps) } catch(err) { console.log(err); } - console.log("refuse") - console.log(`request = ${request}`) + window.location.reload(); } - // Vérifier si le contenu doit être caché if (clickEvent) { - return null; // Rendre null pour ne pas afficher le contenu + return (<>); } return ( diff --git a/containers/react/src/components/Social/Social.tsx b/containers/react/src/components/Social/Social.tsx index 53a2c9d4..ab400704 100644 --- a/containers/react/src/components/Social/Social.tsx +++ b/containers/react/src/components/Social/Social.tsx @@ -1,6 +1,5 @@ -import DefaultPicture from '../../assets/profile.jpg' import api from '../../script/axiosApi.tsx'; -import React, { useState, useEffect, useRef } from "react"; +import React, { useState, useEffect} from "react"; import styled from "styled-components"; @@ -8,14 +7,8 @@ import Friend from './Friend.tsx'; import FriendRequest from './FriendRequest.tsx'; import {IoMdPeople} from 'react-icons/io' -import { ImBlocked } from 'react-icons/im'; -import { MdOutlineGroupAdd } from 'react-icons/md'; import {User} from "../../../interfaces.tsx" -// import React from "react"; - -import { useNavigate } from "react-router-dom"; - @@ -52,8 +45,6 @@ function Social (){ setProfilePicture(pic.data); setUser(tmpUser.data); setFriends(tmpFriends.data); - // return tmpUser; - console.log(`user= ${tmpUser.data.username}`); setIsLoading(false) } @@ -65,30 +56,9 @@ function Social (){ }, []) - - - - - // const { status } = this.props; - // let statusColor = ''; - // // let statusIcon = RxCircle; - // let status = 0 - - // if (status === 0) { - // // statusIcon = faCircle; - // statusColor = 'green'; - // } else if (status === 1) { - // // statusIcon = faCircle; - // statusColor = 'red'; - // } else if (status === 2) { - // // statusIcon = faCircle; - // statusColor = 'blue'; - // } - return (
- {/* profile */} {isLoading || !user ? ( @@ -100,8 +70,6 @@ function Social (){
-{/* map with fiend request */} - {invite.map(c=> ( ))} diff --git a/containers/react/src/pages/Field.tsx b/containers/react/src/pages/Field.tsx index 3b367630..77c8e2aa 100644 --- a/containers/react/src/pages/Field.tsx +++ b/containers/react/src/pages/Field.tsx @@ -44,7 +44,6 @@ function Field() useEffect(() => { const queryParams = queryString.parse(window.location.search); - console.log("launch canva hehe") let Modifiers = 0; let info: GameProps; @@ -66,19 +65,16 @@ function Field() } if (queryParams.username) { - console.log("user= ", queryParams.username) info = { privateParty: true, username: queryParams.username as string, gameId: queryParams.gameId as unknown as number } - console.log("info of param vefore canvas=", info) } const cleanup = DrawCanvas(Modifiers, info); return () => { - console.log("Cleanup"); if (cleanup) cleanup(); }; diff --git a/containers/react/src/pages/Home.tsx b/containers/react/src/pages/Home.tsx index 82dc185e..60422487 100644 --- a/containers/react/src/pages/Home.tsx +++ b/containers/react/src/pages/Home.tsx @@ -6,7 +6,7 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/06/09 08:19:04 by apommier #+# #+# */ -/* Updated: 2023/06/26 11:31:57 by apommier ### ########.fr */ +/* Updated: 2023/06/28 17:47:35 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ @@ -56,16 +56,13 @@ function Profile () { useEffect(()=> { const getUser = async ()=>{ - console.log(`username= ${username}`) let pic; try{ - console.log("before request") const me = await api.get("/profile") if (!username) { setMine(true); setUser(me.data); - console.log(`mine= true = ${mine}`) pic = await api.post("/getPicture", {username: me.data.username}) //good one? } else diff --git a/containers/react/src/pages/QrCode.tsx b/containers/react/src/pages/QrCode.tsx index 4432810e..54643f57 100644 --- a/containers/react/src/pages/QrCode.tsx +++ b/containers/react/src/pages/QrCode.tsx @@ -82,7 +82,7 @@ function QrCode () { window.location.reload(); } else - console.log("bad code") + console.log("Bad code") } catch(err){ console.log(err) diff --git a/containers/react/src/pages/canvas.tsx b/containers/react/src/pages/canvas.tsx index ed815264..4e55082b 100644 --- a/containers/react/src/pages/canvas.tsx +++ b/containers/react/src/pages/canvas.tsx @@ -108,7 +108,6 @@ socket.on('pong:win', async () => { }); socket.on('pong:privateId', async (data) => { - console.log("private id = ", data) try{ await api.post("/partyInvite", {username: gameParam.username, gameId: data}); } catch(err) { @@ -376,11 +375,8 @@ socket.on('pong:hisPoint', (data) => { const stopDrawCanvas = async () => { running = false; - console.log("stopDrawCanvas 1") - if (gameParam.privateParty && !gameId) //delete invite { - console.log("stopDrawCanvas2") try{ await api.post('/status', {status: 1}); await api.post("deleteInvite", {username: gameParam.username}) @@ -585,7 +581,6 @@ async function draw(timestamp: number) else if (event.code === "KeyW") { let date = new Date(); - console.log("last time =", date.getTime() - lastPower) if (date.getTime() - lastPower < 15000)//10000 + 5000 return ; if (!superpowerModifier) diff --git a/containers/react/src/script/axiosApi.tsx b/containers/react/src/script/axiosApi.tsx index b75141d5..9cf65274 100644 --- a/containers/react/src/script/axiosApi.tsx +++ b/containers/react/src/script/axiosApi.tsx @@ -3,14 +3,9 @@ import axios from 'axios'; function getToken() { const token = localStorage.getItem('token'); - if (typeof token === 'string') { - console.log("is a string !!!") - } return token; } -console.log(`getToken = ${getToken()}`) -console.log(`Bearer ${localStorage.getItem("token")}`) let api = axios.create({ baseURL: 'http://' + process.env.REACT_APP_BASE_URL + '/api', headers: { diff --git a/containers/react/src/script/tokenSuccess.tsx b/containers/react/src/script/tokenSuccess.tsx index 2a6faecd..9c880a92 100644 --- a/containers/react/src/script/tokenSuccess.tsx +++ b/containers/react/src/script/tokenSuccess.tsx @@ -14,7 +14,6 @@ function SuccessToken() { useEffect(() => { if (!data) { - console.log("No data"); return ; } @@ -59,7 +58,7 @@ function SuccessToken() { window.location.replace("http://" + process.env.REACT_APP_BASE_URL + "/pong"); } else - console.log("bad code") + console.log("Bad code") } catch(err){ console.log(err)