Skip to content

Commit

Permalink
Merge pull request #172 from TheUpperPart/Feat/#171
Browse files Browse the repository at this point in the history
Feat: 관리의 채팅도 제대로된 프로필로 보이도록 추가
  • Loading branch information
pp449 authored Oct 17, 2023
2 parents 9205bd5 + 221f07a commit 28c1c53
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 18 deletions.
8 changes: 4 additions & 4 deletions __mocks__/handlers/boardHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface BoardsInfo {
[key: string]: {
myMatchRound: number;
myMatchId: number;
channelBoardLoadDtdList: Channels[];
channelBoardLoadDtoList: Channels[];
};
}

Expand Down Expand Up @@ -45,7 +45,7 @@ const boardsInfo: BoardsInfo = {
'123': {
myMatchRound: 0,
myMatchId: 0,
channelBoardLoadDtdList: [
channelBoardLoadDtoList: [
{
boardId: 'aaa',
boardTitle: '공지사항',
Expand All @@ -66,7 +66,7 @@ const boardsInfo: BoardsInfo = {
'234': {
myMatchRound: 1,
myMatchId: 1,
channelBoardLoadDtdList: [
channelBoardLoadDtoList: [
{
boardId: 'bbb',
boardTitle: '리그 공지사항',
Expand All @@ -87,7 +87,7 @@ const boardsInfo: BoardsInfo = {
'456': {
myMatchRound: 2,
myMatchId: 2,
channelBoardLoadDtdList: [
channelBoardLoadDtoList: [
{
boardId: 'eee',
boardTitle: '리그 공지사항',
Expand Down
2 changes: 1 addition & 1 deletion __mocks__/handlers/matchHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const players: GetMatchPlayerScoreInfos = {
matchPlayerResultStatus: '진행중',
},
],
matchMessage: [
matchMessages: [
{
channelId: 123,
content: '안녕하세요',
Expand Down
15 changes: 8 additions & 7 deletions src/components/RoundCheckIn/CallAdminChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@ import Image from 'next/image';
import { Client } from '@stomp/stompjs';
import React, { useEffect, useState, ChangeEvent } from 'react';
import { useRouter } from 'next/router';
import { BASE_PROFILE_IMG } from '@config/index';

interface CallAdminChatProps {
client: Client | undefined;
matchId: string;
players: MatchPlayerScoreInfos[];
matchMessage: MatchMessages[];
matchMessages: MatchMessages[];
requestUser: number;
}

const CallAdminChat = ({
client,
matchId,
players,
matchMessage,
matchMessages,
requestUser,
}: CallAdminChatProps) => {
const [chats, setChats] = useState<MatchMessages[]>([]);
Expand Down Expand Up @@ -60,13 +61,13 @@ const CallAdminChat = ({
const findUserIMG = (playerParticipantId: number): string => {
const user = players.find((player) => player.participantId === playerParticipantId);

if (!user) return '';
if (!user) return BASE_PROFILE_IMG;
return user.profileSrc;
};

const findUserName = (playerParticipantId: number): string => {
const user = players.find((player) => player.participantId === playerParticipantId);
if (!user) return '';
if (!user) return '관리자';
return user.gameId;
};

Expand All @@ -88,9 +89,9 @@ const CallAdminChat = ({
}, [client]);

useEffect(() => {
if (!matchMessage || matchMessage.length === 0) return;
setChats(matchMessage);
}, [matchMessage]);
if (!matchMessages || matchMessages.length === 0) return;
setChats(matchMessages);
}, [matchMessages]);

return (
<Container>
Expand Down
6 changes: 3 additions & 3 deletions src/components/RoundCheckIn/CheckInPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface CheckInPageProps {
client: Client | undefined;
matchId: string;
players: MatchPlayerScoreInfos[];
matchMessage: MatchMessages[];
matchMessages: MatchMessages[];
requestUser: number;
checkInUser: number[];
currentMatchRound: number;
Expand All @@ -21,7 +21,7 @@ const CheckInPage = ({
client,
matchId,
players,
matchMessage,
matchMessages,
requestUser,
checkInUser,
currentMatchRound,
Expand Down Expand Up @@ -105,7 +105,7 @@ const CheckInPage = ({
client={client}
matchId={matchId}
players={players}
matchMessage={matchMessage}
matchMessages={matchMessages}
requestUser={requestUser}
/>
</ChattingWrapper>
Expand Down
4 changes: 2 additions & 2 deletions src/components/RoundCheckIn/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface GetMatchPlayerScoreInfos {
matchCurrentSet: number;
matchSetCount: number;
matchPlayerInfos: MatchPlayerScoreInfos[];
matchMessage: MatchMessages[];
matchMessages: MatchMessages[];
}

interface RoundCheckInProps {
Expand Down Expand Up @@ -176,7 +176,7 @@ const RoundCheckIn = ({ channelLink, matchId }: RoundCheckInProps) => {
client={client}
matchId={matchId}
players={matchPlayers ? matchPlayers.matchPlayerInfos : []}
matchMessage={matchPlayers ? matchPlayers.matchMessage : []}
matchMessages={matchPlayers ? matchPlayers.matchMessages : []}
requestUser={matchPlayers ? matchPlayers.requestMatchPlayerId : -1}
checkInUser={checkInUser}
currentMatchRound={matchPlayers ? matchPlayers.matchCurrentSet : -1}
Expand Down
5 changes: 4 additions & 1 deletion src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ if (process.env.NODE_ENV === 'development') {
SERVER_URL = 'http://localhost:8080';
}

export { SERVER_URL, SOCKET_URL };
const BASE_PROFILE_IMG =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAdVBMVEX////MzMxNTU3JycnOzs7R0dFLS0tCQkJISEjT09M9PT1FRUXm5ubq6upAQEDj4+P4+Pja2tq3t7ewsLA6OjpqampTU1PDw8OFhYXy8vJ0dHSVlZW/v79/f3+tra1jY2OdnZ1dXV2NjY2AgIB3d3cyMjKkpKSyTp11AAAIfElEQVR4nO2diXKjOBCGjd3itPHB4fiI8TV5/0dcMEnGydjhbyQB2eq/aqumamoHPkvqS1IzGolEIpFIJBKJRCKRSCQSiUQikUgkEolEIpFIJBL937RYbGbT+XxZaT6fzjabRd+vZEyLzXypHGfyLufzj45azn8952K6pJrqscq/o+X011LOKrqncPeYtJz1/bJ8zQKI7u9YBr8KcrOs8AgnrCmXm75fHNRMcYbvC6P6DQM5p3Z475A07xugQXNHh+/G6AyZcdpyen6HnPYN8kQzrfn5BZGGuB4XgSm+G2MwuDBgapLvxjisqVoOINP7AYhDGsaZ6QF8ZxzMalzaASwRl32j3bRQ5mfo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zprk/A0Sj5YxnwT9IvYBmiPvzugSm5aZfB6BNNT/bsjXcaxIf0Fi+2FmPaq4251yq1Enmnq77B/mpWmHcbYTGYj5LdlGg1GvhXftq7Df2u2dbganTT67AGsNYk1+lFd684t7u/1F5JaqIW5YWDm6B3emt51eJTrue99Q3xsxaHsUZRww3zwwC+B9ikfdFysvppse/75UEtzzE7/ffj+DyMT1aCWl/T8IdPWX3HC9NrT4UKDS0m5/Efr5HS9b0/+bnbaq9BzZPXPE6fYZZwaZy/JoPIHzQ0cw6Xwk/DOPa8qJbnxWEY+sXl4AwxdGmnzZz2yeF43O12x+Mh2dO890+oikQikUgkEolEIpFIJBKJRCKRSCQSiUQikUgkEhnXf0N8pV5TYj8dAAAAAElFTkSuQmCC';

export { SERVER_URL, SOCKET_URL, BASE_PROFILE_IMG };
30 changes: 30 additions & 0 deletions src/contexts/CustomContextMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import styled from '@emotion/styled';

interface CustomContextMenuProps {
x: number;
y: number;
}

const CustomContextMenu = ({ x, y }: CustomContextMenuProps) => {
return (
<ContextMenu style={{ top: y, left: x }}>
<ul>
<li>메뉴 항목 1</li>
<li>메뉴 항목 2</li>
{/* 추가적인 메뉴 항목들 */}
</ul>
</ContextMenu>
);
};

export default CustomContextMenu;

const ContextMenu = styled.div`
position: absolute;
background-color: #ffffff;
border: 1px solid #ccc;
padding: 5px 10px;
z-index: 1000;
color: black;
`;

0 comments on commit 28c1c53

Please sign in to comment.