From c265a8b47a14268657930e049ebdfa4bf37b0e97 Mon Sep 17 00:00:00 2001 From: 0Jaemin0 Date: Thu, 21 Nov 2024 01:42:48 +0900 Subject: [PATCH 1/4] =?UTF-8?q?refactor:=20=ED=8C=80=20=EC=8A=A4=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=8A=A4=20=EB=AA=A9=EB=A1=9D=20=EC=A4=91=20=ED=98=84?= =?UTF-8?q?=EC=9E=AC=20=EC=84=A0=ED=83=9D=ED=95=9C=20=ED=8C=80=20=EC=8A=A4?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=8A=A4=20=EC=9C=84=EC=B9=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 현재 선택한 팀 스페이스 위치 최상단이 아닌 순서 유지 --- .../GNB/GNBMenu/GNBTeamSpace/GNBTeamSpace.tsx | 31 ++++--------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/src/components/common/GNB/GNBMenu/GNBTeamSpace/GNBTeamSpace.tsx b/src/components/common/GNB/GNBMenu/GNBTeamSpace/GNBTeamSpace.tsx index 788d16a..0329ef3 100644 --- a/src/components/common/GNB/GNBMenu/GNBTeamSpace/GNBTeamSpace.tsx +++ b/src/components/common/GNB/GNBMenu/GNBTeamSpace/GNBTeamSpace.tsx @@ -15,13 +15,6 @@ const GNBTeamSpace = () => { const { mutateRecordTeamSpace } = useRecordTeamSpace(); const navigate = useNavigate(); - const lastSeenTeam = userStatus?.participatedTeamspaces.find( - (team) => team.teamspaceId === userStatus?.profile.lastSeenTeamspaceId - ); - const otherProfiles = userStatus?.participatedTeamspaces.filter( - (teamSpace) => teamSpace.name !== lastSeenTeam?.name - ); - const { increaseChatMessageCount, setChatChannelList } = useSocketStore(); const handleTeamChangeClick = (teamSpaceId: number) => { @@ -33,7 +26,7 @@ const GNBTeamSpace = () => { return ( - {userStatus && lastSeenTeam && otherProfiles && ( + {userStatus && ( <> { paddingRight='16' gap='8'> - - {otherProfiles.map((teamSpace) => ( + {userStatus.participatedTeamspaces.map((teamSpace) => ( { ? `팀장 - 총 ${teamSpace.numOfParticipants}명의 멤버` : '팀원' } + {...(teamSpace.teamspaceId === + userStatus.profile.lastSeenTeamspaceId && { + trailingIcon: 'Check', + })} onClick={() => handleTeamChangeClick(teamSpace.teamspaceId)} /> ))} From a3e3c92ed7b16af51f2288badba34e49164bd158 Mon Sep 17 00:00:00 2001 From: 0Jaemin0 Date: Thu, 21 Nov 2024 12:24:25 +0900 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20=ED=8C=80=EC=8A=A4=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=8A=A4=20=EC=9D=B4=EB=8F=99=20=EC=8B=9C=20=ED=8C=80?= =?UTF-8?q?=EC=8A=A4=ED=8E=98=EC=9D=B4=EC=8A=A4=20=EB=A9=A4=EB=B2=84=20?= =?UTF-8?q?=EB=8B=A4=EC=8B=9C=20=EB=B6=88=EB=9F=AC=EC=98=A4=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/queries/teamspace/useRecordTeamSpace.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hooks/queries/teamspace/useRecordTeamSpace.ts b/src/hooks/queries/teamspace/useRecordTeamSpace.ts index 412853c..ba9de4d 100644 --- a/src/hooks/queries/teamspace/useRecordTeamSpace.ts +++ b/src/hooks/queries/teamspace/useRecordTeamSpace.ts @@ -8,6 +8,7 @@ const useRecordTeamSpace = () => { const handleSettingSucess = () => { queryClient.invalidateQueries({ queryKey: ['userStatus'] }); queryClient.invalidateQueries({ queryKey: ['teamSetting'] }); + queryClient.invalidateQueries({ queryKey: ['teamSpaceUsers'] }); queryClient.refetchQueries({ queryKey: ['chatChannel'] }); }; From d64fb20f30766cdd34c52ab49be1d30fe230b003 Mon Sep 17 00:00:00 2001 From: 0Jaemin0 Date: Thu, 21 Nov 2024 12:45:11 +0900 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20=ED=8C=80=EC=8A=A4=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=8A=A4=20=EC=84=A4=EC=A0=95=20=EC=A1=B0=EA=B1=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 팀스페이스 팀장만이 팀스페이스 설정 가능 --- .../GNB/GNBMenu/GNBTeamInfo/GNBTeamInfo.tsx | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/components/common/GNB/GNBMenu/GNBTeamInfo/GNBTeamInfo.tsx b/src/components/common/GNB/GNBMenu/GNBTeamInfo/GNBTeamInfo.tsx index 6d19975..f015e76 100644 --- a/src/components/common/GNB/GNBMenu/GNBTeamInfo/GNBTeamInfo.tsx +++ b/src/components/common/GNB/GNBMenu/GNBTeamInfo/GNBTeamInfo.tsx @@ -26,6 +26,11 @@ const GNBTeamInfo = () => { const lastSeenTeam = userStatus?.participatedTeamspaces.find( (team) => team.teamspaceId === userStatus?.profile.lastSeenTeamspaceId ); + const teamRole = userStatus?.participatedTeamspaces?.find( + (teamspace) => + teamspace.teamspaceId === userStatus?.profile.lastSeenTeamspaceId + )?.teamspaceRole; + const { formData, submitting, errors, register, handleSubmit } = useForm({ onSubmit: async () => { if (userStatus?.profile.lastSeenTeamspaceId !== undefined) { @@ -121,12 +126,16 @@ const GNBTeamInfo = () => { - navigate(PATH.SETTING)}> - - - 설정 - - + + {teamRole === 'LEADER' && ( + navigate(PATH.SETTING)}> + + + 설정 + + + )} + mutateTeampSpaceCode(lastSeenTeam.teamspaceId)}> From e0f9e5b75deecc5a343de989a6d03e2aa83c2b67 Mon Sep 17 00:00:00 2001 From: 0Jaemin0 Date: Thu, 21 Nov 2024 12:59:44 +0900 Subject: [PATCH 4/4] =?UTF-8?q?refactor:=20=EB=A7=88=EC=A7=80=EB=A7=89=20?= =?UTF-8?q?=EB=B3=B8=20=ED=8C=80=EC=8A=A4=ED=8E=98=EC=9D=B4=EC=8A=A4?= =?UTF-8?q?=EA=B0=80=20=EC=A1=B4=EC=9E=AC=ED=95=98=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EC=9D=84=20=EA=B2=BD=EC=9A=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 가입한 첫 번째 팀스페이스로 이동 - 가입한 첫 번째 팀스페이스를 마지막 본 팀스페이스로 설정 --- src/components/common/GNB/GNB.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/common/GNB/GNB.tsx b/src/components/common/GNB/GNB.tsx index f2722b5..19dec6e 100644 --- a/src/components/common/GNB/GNB.tsx +++ b/src/components/common/GNB/GNB.tsx @@ -7,6 +7,7 @@ import GNBTeamSpace from '@components/common/GNB/GNBMenu/GNBTeamSpace/GNBTeamSpa import Heading from '@components/common/Heading/Heading'; import Icon from '@components/common/Icon/Icon'; import useMenu from '@hooks/common/useMenu'; +import useRecordTeamSpace from '@hooks/queries/teamspace/useRecordTeamSpace'; import useUserStatusQuery from '@hooks/queries/useUserStatusQuery'; import { StompSubscription } from '@stomp/stompjs'; import useSocketStore from '@stores/socketStore'; @@ -19,6 +20,7 @@ const GNB = () => { const lastSeenTeam = userStatus?.participatedTeamspaces.find( (team) => team.teamspaceId === userStatus?.profile.lastSeenTeamspaceId ); + const { mutateRecordTeamSpace } = useRecordTeamSpace(); const { toggleMenu: handleTeamSpace, showMenu: showTeamSpace } = useMenu(); const { toggleMenu: handleTeamInfo, showMenu: showTeamInfo } = useMenu(); @@ -96,6 +98,11 @@ const GNB = () => { }; }, [userStatus, stompClient]); + useEffect(() => { + if (userStatus?.profile.lastSeenTeamspaceId === null && userStatus) + mutateRecordTeamSpace(userStatus.participatedTeamspaces[0].teamspaceId); + }, [userStatus]); + useLayoutEffect(() => { updatePosition(); window.addEventListener('resize', updatePosition);