diff --git a/.env b/.env index 8f4c4911..fcdde945 100644 --- a/.env +++ b/.env @@ -7,18 +7,17 @@ # POSTGRES_PASSWORD=pass # POSTGRES_DB=postgreDB # POSTGRES_ROOT_PASSWORD=pass -# POSTGRES_HOST=bess-f2r5s13 +# POSTGRES_HOST=localhost # POSTGRES_HOST_AUTH_METHOD=trust #URL NGINX_ENVSUBST_TEMPLATE_SUFFIX=".conf" -# BASE_URL=http://bess-f2r5s13 -# SOCKET_URL=bess-f2r5s13:8080 -BASE_URL=bess-f2r5s13:8080 -REACT_APP_BASE_URL=bess-f2r5s13:8080 -REDIRECT_URI=http://bess-f2r5s13:8080/api/auth/login -INTRA_URL="https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-2bd3c5d4f41e776f2e3d5d699d2a8421f6d0c0468ec882516d9ca89b0c211789&redirect_uri=http%3A%2F%2Fbess-f2r5s13%3A8080%2Fapi%2Fauth%2Flogin&response_type=code" +# BASE_URL=http://localhost +# SOCKET_URL=localhost:8080 +BASE_URL=localhost:8080 +REACT_APP_BASE_URL=localhost:8080 +REDIRECT_URI=http://localhost:8080/api/auth/login #postgres var # POSTGRES_HOST=127.0.0.1 # DB_TYPE=postgres @@ -35,7 +34,7 @@ NGINX_PORT=8080 PONG_PORT=4000 CHAT_PORT=4001 POSTGRES_PORT=5432 - + #???? RUN_MIGRATIONS=true REACT_HOST=0.0.0.0 @@ -43,6 +42,6 @@ REACT_HOST=0.0.0.0 #auth var JWT_SECRET=secrethere -# REDIRECT_URI=http://bess-f2r5s13:80/api/auth/login -API_SECRET=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 -CLIENT_UID=u-s4t2ud-2bd3c5d4f41e776f2e3d5d699d2a8421f6d0c0468ec882516d9ca89b0c211789 +# REDIRECT_URI=http://localhost:80/api/auth/login +API_SECRET=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 +CLIENT_UID=u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41 diff --git a/containers/api/src/app.controller.ts b/containers/api/src/app.controller.ts index 342c41f0..149f9483 100644 --- a/containers/api/src/app.controller.ts +++ b/containers/api/src/app.controller.ts @@ -6,13 +6,12 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/06/17 01:00:00 by apommier #+# #+# */ -/* Updated: 2023/06/26 03:23:42 by apommier ### ########.fr */ +/* Updated: 2023/06/26 04:10:56 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ import { Controller, Request, Req, Get, Post, UseGuards, Redirect, Res, Body, UploadedFile, UseInterceptors} from '@nestjs/common'; import { FileInterceptor } from '@nestjs/platform-express'; - import { JwtAuthGuard } from './auth/jwt-auth.guard'; import { AuthService } from './auth/auth.service'; import { loginClass } from './auth/login42' @@ -42,7 +41,7 @@ import { formatWithOptions } from 'util'; @Controller('/api') export class AppController { - constructor(private authService: AuthService, + constructor(private authService: AuthService, private loginClass: loginClass, private chatService: ChatService, private userService: UsersService, ) {} @@ -53,7 +52,7 @@ export class AppController { //======================================================================================================== //======================================================================================================== -// User +// User //======================================================================================================== //======================================================================================================== @@ -127,7 +126,7 @@ export class AppController { await this.chatService.createConv(conv); return await this.userService.addFriend(user, data.username); - + } @UseGuards(JwtAuthGuard) @@ -168,7 +167,7 @@ export class AppController { async refuseInvite(@Request() req, @Body() data: any) { // return await this.userService.getFriends(req.user.username); // console.log(`useawdawd\n\n\nr= ${req.user.username}`) - const user = await this.userService.findOne(req.user.username) + const user = await this.userService.findOne(req.user.username) return await this.userService.refuseInvite(user, data.username); } @@ -223,7 +222,7 @@ export class AppController { //======================================================================================================== //======================================================================================================== -// Pong +// Pong //======================================================================================================== //======================================================================================================== @@ -261,7 +260,7 @@ export class AppController { const Esp = 1 / (1 + Math.pow(10, (data.opRank - user.rank) / this.scaleFactor)) const newRank = user.rank + this.kFactor * (0 - Esp); - + user.rank = newRank; console.log(`loss new rank= ${newRank}`); console.log(`data loss = ${data}`) @@ -324,8 +323,8 @@ export class AppController { { console.log("delete invite user= ", data.username) const user = await this.userService.findOne(req.user.username); - - + + // user.partyInvite = user.partyInvite.filter(item => Object.values(item)[1] !== req.user.username); console.log("user.partyInvite before", user.partyInvite) user.partyInvite = user.partyInvite.filter((item) => Object.values(item)[1] !== data.username); @@ -340,10 +339,10 @@ export class AppController { // const user = await this.userService.findOne(req.user.username); // return user.rank; return await this.userService.getHistory(data.username); - + // if (user) { // const children = user.children; - // console.log(user); + // console.log(user); // console.log(user.children); // or perform any operations with the children // return children; // // You can also access specific properties of each child @@ -358,7 +357,7 @@ export class AppController { //======================================================================================================== //======================================================================================================== -// Auth +// Auth //======================================================================================================== //======================================================================================================== @@ -452,18 +451,26 @@ export class AppController { @UseGuards(JwtAuthGuard) @Post('/quit') async setOffline(@Request() req) { - const user = await this.userService.findOne(req.user.username); - - user.status = 0; + user.sessionNumber-- ; + if (!user.sessionNumber) + user.status = 0; await this.userService.save(user); console.log("User quit"); } + @UseGuards(JwtAuthGuard) + @Post('/addSession') + async addSession(@Request() req) { + + const user = await this.userService.findOne(req.user.username); + user.sessionNumber++ ; + await this.userService.save(user); + } //======================================================================================================== //======================================================================================================== -// Chat +// Chat //======================================================================================================== //======================================================================================================== @@ -511,7 +518,7 @@ export class AppController { @Post('/message') async postMessage(@Request() req, @Body() data: any) { //if i can post post ? - let message = + let message = { convid: data.convId, sender: data.sender, @@ -522,7 +529,7 @@ export class AppController { console.log(data); return await this.chatService.createMessage(message, req.user.username); } - + @UseGuards(JwtAuthGuard) @Post('/member') async getMember(@Body() data: any) { @@ -530,7 +537,7 @@ export class AppController { console.log(`get member= ${data.convId}`); return await this.chatService.findConv(data.convId); } - + @UseGuards(JwtAuthGuard) @Post('/getMessage') async getMessage(@Body() data: any) { @@ -542,11 +549,11 @@ export class AppController { return await this.chatService.getMessages(data.convId); // return await this.chatService.getConv(req.user.username); - - + + // res.json(messages); } - + @UseGuards(JwtAuthGuard) @Post('/name') async setName(@Body() data: any) { @@ -554,13 +561,13 @@ export class AppController { // data.convId return await this.chatService.setName(data.convId, data.name) } - + @UseGuards(JwtAuthGuard) @Post('/password') async setPassword(@Body() data: any) { return await this.chatService.setPassword(data.convId, data.password) } - + @UseGuards(JwtAuthGuard) @Post('/verifyPassword') async verifyPassword(@Body() data: any) { @@ -580,7 +587,7 @@ export class AppController { return ; return await this.chatService.banUser(data.convId, data.username) } - + @UseGuards(JwtAuthGuard) @Post('/admin') async setAdmin(@Body() data: any) { @@ -588,7 +595,7 @@ export class AppController { return ; return await this.chatService.setAdmin(data.convId, data.username) } - + @UseGuards(JwtAuthGuard) @Post('/mute') async muteUser(@Body() data: any) { @@ -596,14 +603,14 @@ export class AppController { return ; return await this.chatService.muteUser(data.convId, data.username, data.time) } - + @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) } - + @UseGuards(JwtAuthGuard) @Post('/private') async setPrivate(@Body() data: any) { @@ -628,4 +635,4 @@ export class AppController { return await this.chatService.joinChannel(data.convId, req.user.username) } -} \ No newline at end of file +} diff --git a/containers/api/src/auth/login42.ts b/containers/api/src/auth/login42.ts index 6bdbdc1d..ceb2ebb0 100644 --- a/containers/api/src/auth/login42.ts +++ b/containers/api/src/auth/login42.ts @@ -17,8 +17,6 @@ export class loginClass { let userId = null; let userName = null; - console.log("process.env.REDIRECT_URI=", process.env.REDIRECT_URI) - const params = new URLSearchParams(url.split('?')[1]); const code = params.get('code'); @@ -62,11 +60,11 @@ export class loginClass { password: null, username: userName, nickname: userName, - win: 0, + win: 0, loss: 0, rank: 1200, userId: userId, - otp_base32: null, + otp_base32: null, children: null, status: 1, // doubleAuth: 0, @@ -76,15 +74,16 @@ export class loginClass { friends: null, blocked: null, photo: null, + sessionNumber: 1, }; await this.usersService.create(user); } // console.log(`in login42 user= ${user}`) const myJSON = JSON.stringify(user); console.log(`in login42 user= ${myJSON}`) - + console.log("end of login"); return (user); // return (await this.usersService.findOne(userName)); } -} \ No newline at end of file +} diff --git a/containers/api/src/chat/chat.service.ts b/containers/api/src/chat/chat.service.ts index 56f5755b..cbdfe6e3 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 04:02:50 by apommier ### ########.fr */ +/* Updated: 2023/06/26 04:11:00 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ @@ -84,10 +84,15 @@ async banUser(convId: number, username: string) { conv.banned = conv.banned || []; if (conv.banned.find(item => item === username)) - return (1); + { + conv.banned = conv.banned.filter((item) => item !== username); + this.save(conv); + return (2); + } conv.members = conv.members.filter((item) => item !== username); conv.banned.push(username); this.save(conv); + return (1); } async inviteUser(convId: number, username: string) { diff --git a/containers/api/src/model/user.entity.ts b/containers/api/src/model/user.entity.ts index 55d93f59..cac928c5 100644 --- a/containers/api/src/model/user.entity.ts +++ b/containers/api/src/model/user.entity.ts @@ -34,7 +34,7 @@ export class User { @Column({ nullable: true }) nickname: string; - + @Column({ nullable: true }) username: string; @@ -46,22 +46,25 @@ export class User { @Column({ default: 0 }) win: number; - + @Column({ default: 0 }) loss: number; - + + @Column({ default: 0 }) + sessionNumber: number; + @Column({ default: 0 }) rank: number; @Column({ default: 0 }) //0 = offline | 1 = connected | 2 = in game status: number; - + @Column({ default: 0 }) userId: number; // @Column({ default: 0 }) // doubleAuth: number; - + @Column('text', { array: true, nullable: true }) friendRequest: string[]; @@ -98,4 +101,4 @@ export class MatchLog { @ManyToOne(() => User, parent => parent.children) parent: User; -} \ No newline at end of file +} diff --git a/containers/api/src/users/users.service.ts b/containers/api/src/users/users.service.ts index cb71de7a..958b2769 100644 --- a/containers/api/src/users/users.service.ts +++ b/containers/api/src/users/users.service.ts @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* users.service.ts :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: apommier +#+ +:+ +#+ */ +/* By: sadjigui +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/06/17 01:00:07 by apommier #+# #+# */ -/* Updated: 2023/06/24 23:30:52 by apommier ### ########.fr */ +/* Updated: 2023/06/26 02:23:16 by sadjigui ### ########.fr */ /* */ /* ************************************************************************** */ @@ -143,7 +143,11 @@ export class UsersService { return (0); user.blocked = user.blocked || []; if (user.blocked.find(item => item === username)) - return (1); + { + this.save(user); + user.blocked = user.blocked.filter((item) => item !== username); + return (2); + } user.blocked.push(username); this.save(user); return (1); diff --git a/containers/react/.env b/containers/react/.env index 0ad277ad..0e54b8cc 100644 --- a/containers/react/.env +++ b/containers/react/.env @@ -1,8 +1,11 @@ -REACT_APP_BASE_URL=bess-f2r5s13:8080 -REACT_APP_SOCKET_URL=bess-f2r5s13 -REACT_APP_API_SECRET=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 -REACT_APP_CLIENT_UID=u-s4t2ud-2bd3c5d4f41e776f2e3d5d699d2a8421f6d0c0468ec882516d9ca89b0c211789 -REACT_APP_INTRA_URL="https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-2bd3c5d4f41e776f2e3d5d699d2a8421f6d0c0468ec882516d9ca89b0c211789&redirect_uri=http%3A%2F%2Fbess-f2r5s13%3A8080%2Fapi%2Fauth%2Flogin&response_type=code" +REACT_APP_BASE_URL=localhost:8080 +REACT_APP_SOCKET_URL=localhost +REACT_APP_API_SECRET=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 +REACT_APP_CLIENT_UID=u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41 # REACT_APP_BASE_URL=92.143.191.152 -# REACT_APP_BASE_URL=192.168.1.19 \ No newline at end of file +# REACT_APP_BASE_URL=192.168.1.19 +REACT_APP_INTRA_URL="https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fapi%2Fauth%2Flogin&response_type=code" + +# REACT_APP_BASE_URL=92.143.191.152 +# REACT_APP_BASE_URL=192.168.1.19 diff --git a/containers/react/src/components/Alert/GreenAlert.tsx b/containers/react/src/components/Alert/GreenAlert.tsx index 11832c45..9f39d2d6 100644 --- a/containers/react/src/components/Alert/GreenAlert.tsx +++ b/containers/react/src/components/Alert/GreenAlert.tsx @@ -23,8 +23,9 @@ interface AlertProps { } function GreenAlert ({handleClose, text}: AlertProps){ - + {setTimeout(handleClose, 1500)} return( + e.stopPropagation()} @@ -37,7 +38,6 @@ function GreenAlert ({handleClose, text}: AlertProps){

{text}

- {setTimeout(handleClose, 1500)}
) } diff --git a/containers/react/src/components/Alert/RedAlert.tsx b/containers/react/src/components/Alert/RedAlert.tsx index 98062543..37a02323 100644 --- a/containers/react/src/components/Alert/RedAlert.tsx +++ b/containers/react/src/components/Alert/RedAlert.tsx @@ -23,6 +23,7 @@ interface AlertProps { } function RedAlert ({handleClose, text}: AlertProps) { + {setTimeout(handleClose, 1500)} return(

{text}

- {setTimeout(handleClose, 1500)}
) } diff --git a/containers/react/src/components/Alert/YellowAlert.tsx b/containers/react/src/components/Alert/YellowAlert.tsx index eab74971..7eb7570c 100644 --- a/containers/react/src/components/Alert/YellowAlert.tsx +++ b/containers/react/src/components/Alert/YellowAlert.tsx @@ -25,6 +25,7 @@ interface AlertProps { } function YellowAlert ({handleClose, text, icon}: AlertProps) { + {setTimeout(handleClose, 3000)} return( {text} - {setTimeout(handleClose, 3000)} ) } diff --git a/containers/react/src/components/App.tsx b/containers/react/src/components/App.tsx index 6c22aa80..ece4ec07 100644 --- a/containers/react/src/components/App.tsx +++ b/containers/react/src/components/App.tsx @@ -40,9 +40,9 @@ function AnimatedRoute () { // Perform your desired actions before the user leaves the page // For example, you can show a confirmation dialog or save user data }; - + window.addEventListener('beforeunload', handleBeforeUnload); - + return () => { window.removeEventListener('beforeunload', handleBeforeUnload); }; @@ -73,7 +73,7 @@ function AnimatedRoute () { }/> }/> }/> - + }/> }/> @@ -94,4 +94,4 @@ function AnimatedRoute () { ) } -export default AnimatedRoute \ No newline at end of file +export default AnimatedRoute diff --git a/containers/react/src/components/Game/PlayButton.tsx b/containers/react/src/components/Game/PlayButton.tsx index 28010cdd..2d40c3eb 100644 --- a/containers/react/src/components/Game/PlayButton.tsx +++ b/containers/react/src/components/Game/PlayButton.tsx @@ -1,35 +1,23 @@ import React from 'react'; import '../../styles/field.css'; -// import { useHistory } from 'react-router-dom'; import { useNavigate } from "react-router-dom"; function PlayButton() { - const history = useNavigate(); - // const handleButtonClick = () => { - // let path = `play`; - // history(path); - // }; const handleButtonClick = () => { let path = `play?`; - + const superpowerCheckbox = document.querySelector('input[value="superpower"]'); if (superpowerCheckbox && superpowerCheckbox.checked) { path += 'superpower=true&'; } - // const obstacleCheckbox = document.querySelector('input[value="obstacle"]'); - // if (obstacleCheckbox && obstacleCheckbox.checked) { - // path += 'obstacle=true&'; - // } - const speedCheckbox = document.querySelector('input[value="speed"]'); if (speedCheckbox && speedCheckbox.checked) { path += 'speed=true&'; } - - // Remove the trailing '&' character + path = path.slice(0, -1); console.log(path) history(path); @@ -40,12 +28,11 @@ function PlayButton() { {/* !buttonClicked && */}
-

Super Power

- {/*

Obstacle

*/} +

Super Power
( w = wall power )

Faster and Faster

); } -export default PlayButton; \ No newline at end of file +export default PlayButton; diff --git a/containers/react/src/components/Messages/Chats.tsx b/containers/react/src/components/Messages/Chats.tsx index c1ce0fe1..ff551bae 100644 --- a/containers/react/src/components/Messages/Chats.tsx +++ b/containers/react/src/components/Messages/Chats.tsx @@ -17,6 +17,7 @@ import { ImBlocked } from 'react-icons/im'; import { MdOutlineGroupAdd } from 'react-icons/md'; import { GrAdd } from 'react-icons/gr'; import { RiListSettingsLine } from 'react-icons/ri' +import { HiChatBubbleLeft } from 'react-icons/hi2' // import { Rank } from "../../DataBase/DataRank"; import GreenAlert from "../Alert/GreenAlert.tsx"; @@ -36,7 +37,7 @@ const TouchDiv = styled.div` margin-top: 21px; cursor: pointer; justify-content: space-around; - + &:hover { color: #F4F3EF; } @@ -71,7 +72,7 @@ const SideP = styled.p` //======================================================================================================== //======================================================================================================== -// Logical part +// Logical part //======================================================================================================== //======================================================================================================== @@ -84,7 +85,7 @@ interface MessageProps { } function Chats(){ - + const [isLoading, setIsLoading] = useState(true); const [conversations, setConversation] = useState([]); const [partyInvite, setPartyInvite] = useState([]); @@ -100,7 +101,7 @@ function Chats(){ const socket = useRef(null); // const socket = Socket | null // socket = useRef( useRef(null)); - + useEffect(()=> { @@ -137,7 +138,7 @@ function Chats(){ console.log("muted hehe"); //set mute var to true and do nothing }); - + setIsLoading(false) } @@ -159,7 +160,7 @@ function Chats(){ }, []) useEffect(()=> { - + const updateChat = async ()=> { // if (currentChat) // console.log(currentChat.id) @@ -188,7 +189,7 @@ function Chats(){ }, [incomingMessage, currentChat]) - useEffect(()=> { + useEffect(()=> { const getMessage = async ()=> { if (!currentChat) @@ -238,7 +239,7 @@ function Chats(){ setNewMessage(""); if (socket.current) socket.current.emit('sendMessage', message); - } + } catch(err){ console.log(err) } @@ -250,38 +251,40 @@ function Chats(){ return ; handleSubmit(e); } - - + + const [friend, setFriend] = useState(""); // const [modalOpen, setModalOpen] = useState(false); const [addFriend, setAddFriend] = useState(false); const [block, setBlock] = useState(false); - + const [showAddFriendAlert, setShowAddFriendAlert] = useState(false); const [showBlockAlert, setShowBlockAlert] = useState(false); - + const [setting, setSetting] = useState(false); - + const [newGameModalOpen, setNewGameModalOpen] = useState(false); const [newConversationModalOpen, setNewConversationModalOpen] = useState(false); - + const [selectTags, setSelectTag] = useState([{ id: 1, selectedOption: ''}]); const [users, setUsers] = useState([]); + + const [unblock, setUnblock] = useState(false); + const closeUnblock = () => setUnblock(false); - const openNewGameModal = () => { setNewGameModalOpen(true); }; - + const closeNewGameModal = () => { setNewGameModalOpen(false); }; - + const openNewConversationModal = () => { setNewConversationModalOpen(true); }; - + const closeNewConversationModal = () => { setNewConversationModalOpen(false); }; @@ -300,7 +303,7 @@ function Chats(){ const handleFriend = (event: { target: { value: React.SetStateAction; }; }) => { setFriend(event.target.value); }; - + const handleAddFriend = async () => { try{ console.log("friend= ", friend); @@ -321,11 +324,14 @@ function Chats(){ console.log(err) } }; - + + const handleBlockFriend = async () => { try{ const res = await api.post("/block", {username: friend}) // if(1) + if (res.data === 2) + setUnblock(true); if (res.data === 1) { setBlock(true); @@ -339,12 +345,12 @@ function Chats(){ console.log(err) } }; - + const closeAddFriend = () => { setAddFriend(false); setShowAddFriendAlert(false); }; - + const closeBlock = () => { setBlock(false); setShowBlockAlert(false); @@ -353,7 +359,7 @@ function Chats(){ const handleOptionChange = (selectId: number, selectedOption: string) => { console.log("selected Option=", selectedOption) setFriend(selectedOption); - setSelectTag((prevTags) => + setSelectTag((prevTags) => prevTags.map((tag) => tag.id === selectId ? { ...tag, selectedOption } : tag ) @@ -362,14 +368,14 @@ function Chats(){ //======================================================================================================== //======================================================================================================== -// HTML +// HTML //======================================================================================================== //======================================================================================================== return (
- +
{/* profile */} @@ -395,7 +401,7 @@ function Chats(){ - (block ? setBlock(false) : setBlock(true))} > @@ -410,7 +416,7 @@ function Chats(){ {currentChat ? ( - (setting ? setSetting(false) : setSetting(true))} > @@ -434,7 +440,7 @@ function Chats(){ onChange={(a) => handleOptionChange(selectTag.id, a.target.value)} > {users.filter((item) => !selectTags.some((tag) => tag.selectedOption === item.username)).map((item, index) => ( {currentChat && isAdmin ? ( - (setting ? setSetting(false) : setSetting(true))} > - + null} @@ -526,14 +535,15 @@ function Chats(){
setCurrentChat(c)}> - User + {/* User */} +
{c.name} {/* Desc? */}
- + )})}
@@ -569,7 +579,7 @@ function Chats(){
// - ); + ); } -export default Chats \ No newline at end of file +export default Chats diff --git a/containers/react/src/components/Messages/Modal.tsx b/containers/react/src/components/Messages/Modal.tsx index 86c2e2f0..925d6801 100644 --- a/containers/react/src/components/Messages/Modal.tsx +++ b/containers/react/src/components/Messages/Modal.tsx @@ -59,7 +59,7 @@ const Modal = ({handleClose}: ModalProps) => { const handleOptionChange = (selectId: number, selectedOption: string) => { console.log("selected Option=", selectedOption) - setSelectTag((prevTags) => + setSelectTag((prevTags) => prevTags.map((tag) => tag.id === selectId ? { ...tag, selectedOption } : tag ) @@ -123,7 +123,7 @@ const Modal = ({handleClose}: ModalProps) => { onChange={(a) => handleOptionChange(selectTag.id, a.target.value)} > {users.filter((item) => !selectTags.some((tag) => tag.selectedOption === item.nickname)).map((item, index) => (