From 1efba598dc37959bf082da1b0b6cad42d9f1d581 Mon Sep 17 00:00:00 2001 From: irenee-14 Date: Sun, 8 Sep 2024 16:12:43 +0900 Subject: [PATCH 01/13] =?UTF-8?q?Feat:=20=ED=8C=80=20=EC=83=81=ED=83=9C=20?= =?UTF-8?q?CANCEL=EC=97=90=EC=84=9C=20OPEN/CONFIRM=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20=EC=8B=9C=20=ED=8C=80=EC=9E=A5=20=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=20=EC=9E=90=EB=8F=99=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/agenda/Form/AdminTeamForm.tsx | 96 +++++++++++++----------- 1 file changed, 52 insertions(+), 44 deletions(-) diff --git a/components/agenda/Form/AdminTeamForm.tsx b/components/agenda/Form/AdminTeamForm.tsx index abd4be503..56acd42a4 100644 --- a/components/agenda/Form/AdminTeamForm.tsx +++ b/components/agenda/Form/AdminTeamForm.tsx @@ -2,7 +2,7 @@ import router from 'next/router'; import { useState } from 'react'; import { TeamDetailProps } from 'types/agenda/teamDetail/TeamDetailTypes'; import { transformTeamLocation } from 'utils/agenda/transformLocation'; -import { Coalition } from 'constants/agenda/agenda'; +import { Coalition, TeamStatus } from 'constants/agenda/agenda'; import Participant from 'components/agenda/agendaDetail/tabs/Participant'; import { AddElementBtn, CancelBtn } from 'components/agenda/button/Buttons'; import CheckBoxInput from 'components/agenda/Input/CheckboxInput'; @@ -18,7 +18,7 @@ interface AdminTeamFormProps { teamLocation: string; } -const AdminTeamFrom = ({ +const AdminTeamForm = ({ teamKey, teamData, teamLocation, @@ -27,18 +27,14 @@ const AdminTeamFrom = ({ const [teamMates, setTeamMates] = useState(teamData.teamMates); const transformFormData = (formData: FormData) => { - const data = JSON.parse(JSON.stringify(Object.fromEntries(formData))); - - data.teamIsPrivate = data.teamIsPrivate === 'on'; - - // 팀 위치 변환 - data.teamLocation = transformTeamLocation(data.teamLocation); - - // 트림 처리 - data.teamName = data.teamName.trim(); - data.teamContent = data.teamContent.trim(); // 추가 - - return data; + const data = Object.fromEntries(formData) as any; + return { + ...data, + teamIsPrivate: data.teamIsPrivate === 'on', + teamLocation: transformTeamLocation(data.teamLocation), + teamName: data.teamName.trim(), + teamContent: data.teamContent.trim(), + }; }; const handleDeleteParticipant = (index: number) => { @@ -50,12 +46,11 @@ const AdminTeamFrom = ({ }; const handleAddMember = () => { - const newMemberIdInput = document.getElementById( - 'newMemberId' - ) as HTMLInputElement; - const newMemberId = newMemberIdInput?.value.trim(); + const newMemberId = ( + document.getElementById('newMemberId') as HTMLInputElement + )?.value.trim(); - if (newMemberId === '') { + if (!newMemberId) { alert('intra ID를 입력해주세요.'); return; } @@ -67,40 +62,51 @@ const AdminTeamFrom = ({ ...prev, { intraId: newMemberId, coalition: Coalition.OTHER }, ]); - newMemberIdInput.value = ''; // 입력 필드 초기화 + (document.getElementById('newMemberId') as HTMLInputElement).value = ''; + }; + + const AddLeader = (e: React.ChangeEvent) => { + if ( + teamData.teamStatus === TeamStatus.CANCEL && + e.target.value !== TeamStatus.CANCEL + ) { + if ( + !teamMates.some( + (member) => member.intraId === teamData.teamLeaderIntraId + ) + ) { + setTeamMates((prev) => [ + { intraId: teamData.teamLeaderIntraId, coalition: Coalition.OTHER }, // 팀장을 가장 앞에 추가 + ...prev, + ]); + } + } }; - const SubmitTeamForm = (target: React.FormEvent) => { - target.preventDefault(); + const SubmitTeamForm = (event: React.FormEvent) => { + event.preventDefault(); - const formData = new FormData(target.currentTarget); + const formData = new FormData(event.currentTarget); const data = transformFormData(formData); - if ( - data.teamName === '' || - data.teamContent === '' || - data.teamStatus === '' - ) { - alert('모든 항목을 입력해주세요.'); // 임시 + if (!data.teamName || !data.teamContent || !data.teamStatus) { + alert('모든 항목을 입력해주세요.'); return; } - data.teamKey = teamKey; - data.teamMates = teamMates; - data.teamAward = teamData.teamAward; - data.teamAwardPriority = teamData.teamAwardPriority; - sendRequest( 'PATCH', 'admin/team', - data, - {}, - (res: any) => { - router.back(); + { + ...data, + teamKey, + teamMates, + teamAward: teamData.teamAward, + teamAwardPriority: teamData.teamAwardPriority, }, - (err: string) => { - console.error(err); - } + {}, + () => router.back(), + (err: string) => console.error(err) ); }; @@ -130,10 +136,12 @@ const AdminTeamFrom = ({ { + AddLeader(e); + }} /> - {teamLocation === 'MIX' ? ( ) : ( @@ -202,4 +210,4 @@ const AdminTeamFrom = ({ ); }; -export default AdminTeamFrom; +export default AdminTeamForm; From d303c33cacd2066fc24f110e632ad31741c8e1b7 Mon Sep 17 00:00:00 2001 From: irenee-14 Date: Sun, 8 Sep 2024 16:20:22 +0900 Subject: [PATCH 02/13] =?UTF-8?q?Feat:=20CANCEL=20=EC=83=81=ED=83=9C?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=88=98=EC=A0=95=20=EB=B6=88=EA=B0=80=20?= =?UTF-8?q?=EC=95=88=EB=82=B4=20=EB=AC=B8=EA=B5=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/agenda/Form/AdminTeamForm.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/components/agenda/Form/AdminTeamForm.tsx b/components/agenda/Form/AdminTeamForm.tsx index 56acd42a4..868de14fc 100644 --- a/components/agenda/Form/AdminTeamForm.tsx +++ b/components/agenda/Form/AdminTeamForm.tsx @@ -76,7 +76,7 @@ const AdminTeamForm = ({ ) ) { setTeamMates((prev) => [ - { intraId: teamData.teamLeaderIntraId, coalition: Coalition.OTHER }, // 팀장을 가장 앞에 추가 + { intraId: teamData.teamLeaderIntraId, coalition: Coalition.OTHER }, ...prev, ]); } @@ -117,6 +117,18 @@ const AdminTeamForm = ({ className={styles.container} >
+ {teamData.teamStatus === TeamStatus.CANCEL ? ( +
+
+ 팀 상태 : CANCEL +
+
+ CANCEL 상태에서는 수정이 불가능합니다.{' '} + [ OPEN/CONFIM ]으로 팀 상태를 + 변경 후 이용해주세요. +
+
+ ) : null}
상 이름 : {teamData.teamAward}
From 421c275e981ed6a0819b958fd92e616970719af2 Mon Sep 17 00:00:00 2001 From: irenee-14 Date: Sun, 8 Sep 2024 16:31:46 +0900 Subject: [PATCH 03/13] =?UTF-8?q?Fix:=20=ED=8B=B0=EC=BC=93=20=EB=82=B4?= =?UTF-8?q?=EC=97=AD=20=EC=95=88=EB=9C=A8=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/agenda/ticket/history.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/pages/agenda/ticket/history.tsx b/pages/agenda/ticket/history.tsx index 1e32e34ad..b38bbff7f 100644 --- a/pages/agenda/ticket/history.tsx +++ b/pages/agenda/ticket/history.tsx @@ -10,6 +10,7 @@ const TicketHistoryPage = () => { url: '/ticket/history', size: size, useIdx: true, + isReady: true, } ); From b4644308a74d0bc4257b594f32a6489d035c1f2f Mon Sep 17 00:00:00 2001 From: irenee-14 Date: Sun, 8 Sep 2024 22:28:22 +0900 Subject: [PATCH 04/13] =?UTF-8?q?Fix:=20=EB=8C=80=ED=9A=8C=20=EC=84=A4?= =?UTF-8?q?=EB=AA=85=20=EB=88=84=EB=9D=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/agenda/agendaDetail/tabs/AgendaDescription.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/agenda/agendaDetail/tabs/AgendaDescription.tsx b/components/agenda/agendaDetail/tabs/AgendaDescription.tsx index 9080fede9..fc7bf383f 100644 --- a/components/agenda/agendaDetail/tabs/AgendaDescription.tsx +++ b/components/agenda/agendaDetail/tabs/AgendaDescription.tsx @@ -35,6 +35,10 @@ export default function AgendaDescription({ agendaData }: AgendaProps) { {AgendaTags(agendaData)}
+
+

대회 설명

+ {agendaContent} +

모집 완료 기간

{formatDate(agendaDeadLine)} From 15671e5b33c54e8c170f96efd04bde3998c94efa Mon Sep 17 00:00:00 2001 From: irenee-14 Date: Sun, 8 Sep 2024 22:28:40 +0900 Subject: [PATCH 05/13] =?UTF-8?q?Feat:=20=EA=B0=9C=EC=9D=B8=20=EC=B0=B8?= =?UTF-8?q?=EC=97=AC=EC=9E=90=20=ED=83=9C=EA=B7=B8=EC=97=90=20=EB=A7=81?= =?UTF-8?q?=ED=81=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agenda/agendaDetail/tabs/Participant.tsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/components/agenda/agendaDetail/tabs/Participant.tsx b/components/agenda/agendaDetail/tabs/Participant.tsx index 7486ee24c..6507273dc 100644 --- a/components/agenda/agendaDetail/tabs/Participant.tsx +++ b/components/agenda/agendaDetail/tabs/Participant.tsx @@ -1,3 +1,4 @@ +import Link from 'next/link'; import React from 'react'; import { ParticipantProps } from 'types/agenda/agendaDetail/tabs/participantTypes'; import { colorMapping, iconMapping } from 'types/agenda/utils/colorList'; @@ -18,13 +19,17 @@ export default function Participant({ const IconComponent = iconMapping[coalitionEnum[0]]; return ( -
-
-
{teamName}
- {IconComponent ? : ''} + +
+
+
{teamName}
+ {IconComponent ? : ''} +
-
+ ); } From 6788b0991624c9c8037c40fac6153008a76dcf31 Mon Sep 17 00:00:00 2001 From: irenee-14 Date: Sun, 8 Sep 2024 22:30:38 +0900 Subject: [PATCH 06/13] =?UTF-8?q?=20Fix:=20=EC=95=84=EC=A0=A0=EB=8B=A4=20?= =?UTF-8?q?=ED=99=88=20=ED=99=94=EB=A9=B4=EC=97=90=EC=84=9C=20=EB=AA=A8?= =?UTF-8?q?=EC=A7=91=EC=99=84=EB=A3=8C/=EC=A7=84=ED=96=89=EC=99=84?= =?UTF-8?q?=EB=A3=8C=20=ED=95=84=ED=84=B0=20=EB=B3=80=EA=B2=BD=20=EC=8B=9C?= =?UTF-8?q?=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=A0=84=EC=B2=B4=20width=20?= =?UTF-8?q?=EB=8B=AC=EB=9D=BC=EC=A7=80=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=EB=B0=8F=20=EC=A0=84=EC=B2=B4=EC=A0=81=20padding=20=EC=A1=B0?= =?UTF-8?q?=EC=A0=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- styles/agenda/Home/AgendaList.module.scss | 5 +++-- styles/agenda/agendaDetail/AgendaDetail.module.scss | 2 +- styles/agenda/utils/AgendaTag.module.scss | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/styles/agenda/Home/AgendaList.module.scss b/styles/agenda/Home/AgendaList.module.scss index 4a401e17f..456f463b4 100644 --- a/styles/agenda/Home/AgendaList.module.scss +++ b/styles/agenda/Home/AgendaList.module.scss @@ -29,12 +29,13 @@ justify-content: space-between; align-items: center; > h2 { - margin: 0.5rem; + margin: 1rem; @include text(sub-menu); } > div { + max-width: 15rem; height: max-content; - margin-right: 0.5rem; + margin-right: 1rem; color: var(--text-color); } } diff --git a/styles/agenda/agendaDetail/AgendaDetail.module.scss b/styles/agenda/agendaDetail/AgendaDetail.module.scss index e91672a22..b898ca251 100644 --- a/styles/agenda/agendaDetail/AgendaDetail.module.scss +++ b/styles/agenda/agendaDetail/AgendaDetail.module.scss @@ -10,7 +10,7 @@ @include pageContainer; max-width: 100%; height: 100%; - padding: 0 2rem; + padding: 0 1rem; } .headWrapper { // @include gridHidden(web); diff --git a/styles/agenda/utils/AgendaTag.module.scss b/styles/agenda/utils/AgendaTag.module.scss index d3ebf8d22..f530d469c 100644 --- a/styles/agenda/utils/AgendaTag.module.scss +++ b/styles/agenda/utils/AgendaTag.module.scss @@ -1,8 +1,9 @@ -@import '../common.scss'; +@import 'styles/agenda/common.scss'; .agendaItemTagBox { display: flex; gap: 0.3rem; + max-width: 16rem; } $tags: ( From 15638832e2135e6639a09d20a0cc4110979ffd72 Mon Sep 17 00:00:00 2001 From: irenee-14 Date: Sun, 8 Sep 2024 23:44:55 +0900 Subject: [PATCH 07/13] =?UTF-8?q?Style:=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20=EA=B0=84=20=EA=B0=84=EA=B2=A9=20=EC=A1=B0=EC=A0=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/agenda/Profile/CurrentList.tsx | 3 ++- styles/agenda/Profile/AgendaProfile.module.scss | 2 +- styles/agenda/Profile/CurrentList.module.scss | 5 ++++- styles/agenda/Profile/HistoryList.module.scss | 4 ++-- styles/agenda/Profile/ProfileCard.module.scss | 1 + 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/components/agenda/Profile/CurrentList.tsx b/components/agenda/Profile/CurrentList.tsx index 6591eb7ea..c137c4f8f 100644 --- a/components/agenda/Profile/CurrentList.tsx +++ b/components/agenda/Profile/CurrentList.tsx @@ -11,8 +11,9 @@ const CurrentList = ({ isHost: boolean; }) => { const listTitle = isHost ? '개최중 아젠다' : '참여중 아젠다'; + const bottomMargin = isHost ? '' : styles.bottomMargin; return ( -
+
{listTitle}
diff --git a/styles/agenda/Profile/AgendaProfile.module.scss b/styles/agenda/Profile/AgendaProfile.module.scss index 690cb01df..ae0f09802 100644 --- a/styles/agenda/Profile/AgendaProfile.module.scss +++ b/styles/agenda/Profile/AgendaProfile.module.scss @@ -6,7 +6,7 @@ justify-content: flex-start; align-items: center; padding: 1rem; - gap: 1.5rem; + gap: 1rem; } .agendaUserSearchBarWrap { diff --git a/styles/agenda/Profile/CurrentList.module.scss b/styles/agenda/Profile/CurrentList.module.scss index d8c43fa22..0222bba56 100644 --- a/styles/agenda/Profile/CurrentList.module.scss +++ b/styles/agenda/Profile/CurrentList.module.scss @@ -11,6 +11,9 @@ border-radius: $radius-big; box-shadow: var(--default-box-shadow); gap: 1rem; + &.bottomMargin { + margin-bottom: 1rem; + } } .currentListTitle { @@ -22,7 +25,7 @@ width: 100%; height: 100%; flex-direction: column; - gap: 0.5rem; + gap: 0.7rem; } .currentTeamEmpty { diff --git a/styles/agenda/Profile/HistoryList.module.scss b/styles/agenda/Profile/HistoryList.module.scss index 0a3adee78..be6e11aa9 100644 --- a/styles/agenda/Profile/HistoryList.module.scss +++ b/styles/agenda/Profile/HistoryList.module.scss @@ -4,7 +4,7 @@ display: flex; width: 22rem; height: auto; - max-height: 32rem; + max-height: 34rem; flex-direction: column; padding: 1rem 1.5rem; background-color: var(--box-bg-2); @@ -22,7 +22,7 @@ width: 100%; height: 100%; flex-direction: column; - gap: 0.5rem; + gap: 0.7rem; } .historyEmpty { diff --git a/styles/agenda/Profile/ProfileCard.module.scss b/styles/agenda/Profile/ProfileCard.module.scss index 86c76c85a..de91d199d 100644 --- a/styles/agenda/Profile/ProfileCard.module.scss +++ b/styles/agenda/Profile/ProfileCard.module.scss @@ -4,6 +4,7 @@ width: 22rem; height: 31rem; perspective: 1000px; + margin-bottom: 1rem; } .cardInner { From ab132c49f6d3ae6362e85e2653df52e86d9df2ba Mon Sep 17 00:00:00 2001 From: irenee-14 Date: Sun, 8 Sep 2024 23:46:53 +0900 Subject: [PATCH 08/13] =?UTF-8?q?Style:=20floating=20Button=20=EB=82=B4?= =?UTF-8?q?=EB=B6=80=20=EA=B8=80=EC=9E=90=20=EC=A0=95=EB=A0=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- styles/agenda/Layout/Layout.module.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/styles/agenda/Layout/Layout.module.scss b/styles/agenda/Layout/Layout.module.scss index ba0d5c09f..3d2873246 100644 --- a/styles/agenda/Layout/Layout.module.scss +++ b/styles/agenda/Layout/Layout.module.scss @@ -22,6 +22,8 @@ position: fixed; right: 2rem; bottom: 2rem; + + display: flex; width: 2.5rem; height: 2.5rem; font-size: var(--font-size-xl); @@ -33,6 +35,8 @@ border-radius: $radius-circle; box-shadow: var(--box-shadow-light); transition: background-color 0.3s; + align-items: center; + justify-content: center; &:hover { width: 3rem; From 8a3ee088554b0affb7eb056a245cd8235b1b6893 Mon Sep 17 00:00:00 2001 From: irenee-14 Date: Mon, 9 Sep 2024 12:02:00 +0900 Subject: [PATCH 09/13] =?UTF-8?q?Sytle:=20tag=20padding=20=EC=A1=B0?= =?UTF-8?q?=EC=A0=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- styles/agenda/utils/AgendaTag.module.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/styles/agenda/utils/AgendaTag.module.scss b/styles/agenda/utils/AgendaTag.module.scss index f530d469c..619260259 100644 --- a/styles/agenda/utils/AgendaTag.module.scss +++ b/styles/agenda/utils/AgendaTag.module.scss @@ -39,7 +39,7 @@ $tags: ( width: max-content; min-width: 3.3rem; height: 1.2rem; - padding: 0.2rem 0.5rem; + padding: 0.2rem 0.3rem; background-color: var(--box-bg-2-light); border-radius: $radius-medium; From c050e954ee3e2f6297fd3845e43526b2f531b564 Mon Sep 17 00:00:00 2001 From: irenee-14 Date: Mon, 9 Sep 2024 12:36:01 +0900 Subject: [PATCH 10/13] =?UTF-8?q?Fix:=20url=EB=B3=80=EA=B2=BD=EC=8B=9C=20p?= =?UTF-8?q?ageNation=20=EC=82=AC=EC=9A=A9=ED=95=98=EB=8A=94=20listData=20?= =?UTF-8?q?=EB=B6=88=EB=9F=AC=EC=98=A4=EC=A7=80=20=EC=95=8A=EB=8A=94=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hooks/agenda/usePageNation.ts | 45 +++++++++++++++++++++-------------- pages/agenda/profile/user.tsx | 37 +++++++++++++--------------- 2 files changed, 44 insertions(+), 38 deletions(-) diff --git a/hooks/agenda/usePageNation.ts b/hooks/agenda/usePageNation.ts index c22888734..7afd1afff 100644 --- a/hooks/agenda/usePageNation.ts +++ b/hooks/agenda/usePageNation.ts @@ -27,45 +27,54 @@ const usePageNation = ({ const getData = useCallback( async (page: number, size: number) => { - const res = await instanceInAgenda.get(url, { params }); - const content = res.data.content ? res.data.content : []; - const totalSize = res.data.totalSize ? res.data.totalSize : 0; + const res = await instanceInAgenda.get(url, { + params: { ...params, page, size }, + }); + const content = res.data.content || []; + const totalSize = res.data.totalSize || 0; if (useIdx) { - res.data.content = res.data.content.map((c: T, idx: number) => { - const temp = c as T & { idx: number }; - temp.idx = idx + 1 + size * (page - 1); - return temp; + content.forEach((c: T, idx: number) => { + (c as T & { idx: number }).idx = idx + 1 + size * (page - 1); }); } - status.current = res.status; // 상태 업데이트 + status.current = res.status; return { totalSize, content }; }, [url, params, useIdx] ); + const fetchData = async () => { + const data = await getData(currentPage.current, size); + totalPages.current = Math.ceil(data.totalSize / size); + setContent(data.content); + }; + const pageChangeHandler = async (pageNumber: number) => { if (pageNumber < 1 || pageNumber > totalPages.current) return; - const res = await getData(pageNumber, size); currentPage.current = pageNumber; - setContent(res.content); + await fetchData(); }; useEffect(() => { - const fetchData = async () => { - const data = await getData(currentPage.current, size); - totalPages.current = Math.ceil(data.totalSize / size); - setContent(data.content); - }; - if ( - isReady == true && + isReady === true && (!status.current || Math.floor(status.current / 100) !== 2) ) { fetchData(); } - }, [getData, size, params]); // getData와 size에 의존 + }, [getData, size, params, isReady]); + + useEffect(() => { + currentPage.current = 1; + + setContent(null); + + if (isReady) { + fetchData(); + } + }, [url, isReady]); const PagaNationElementProps = { curPage: currentPage.current, diff --git a/pages/agenda/profile/user.tsx b/pages/agenda/profile/user.tsx index 65e76e0da..00a1db14e 100644 --- a/pages/agenda/profile/user.tsx +++ b/pages/agenda/profile/user.tsx @@ -21,7 +21,6 @@ import styles from 'styles/agenda/Profile/AgendaProfile.module.scss'; const AgendaProfile = () => { const queryIntraId = useIntraId(); // 쿼리의 id const myIntraId = useUser()?.intraId; // 현재 나의 intraId - const [profileUrl, setProfileUrl] = useState('/profile'); const isMyProfile = useRef(false); // 내 프로필 페이지인지 아닌지 확인 const [isIntraId, setIsIntraId] = useState(false); // 인트라 아이디가 42에 있는지 확인 const [isAgendaId, setIsAgendaId] = useState(false); // 인트라 아이디가 agenda에 있는지 확인 @@ -35,9 +34,10 @@ const AgendaProfile = () => { // GET: agendaProfileData (GG 아젠다 유저 데이터 가져오기) const { data: agendaProfileData, getData: getAgendaProfileData } = useFetchGet({ - url: profileUrl, + url: `/profile/${queryIntraId}`, isReady: isIntraId, }); + // GET: host current const { content: hostCurrentListData, @@ -70,24 +70,21 @@ const AgendaProfile = () => { /** useEffect */ useEffect(() => { - // 1. queryIntraId와 myIntraId가 있을 때 프로필 URL 설정 - if (queryIntraId && myIntraId) { - if (queryIntraId === myIntraId) { - isMyProfile.current = true; - } else { - isMyProfile.current = false; - setProfileUrl(`/profile/${queryIntraId}`); // 다른 유저 프로필 URL 설정 - } - } - // 2. intraData가 있으면 인트라 아이디가 42에 있다는 뜻이므로 isIntraId = true - if (intraData) { - setIsIntraId(true); - } - // 3. agendaProfileData가 있으면 아젠다에 등록된 사용자이므로 isAgendaId = true - if (agendaProfileData) { - setIsAgendaId(true); - } - }, [queryIntraId, myIntraId, intraData, agendaProfileData]); + const updateProfileStatus = () => { + // 1. queryIntraId와 myIntraId가 있을 때 프로필 URL 설정 + isMyProfile.current = queryIntraId === myIntraId; + // 2. intraData가 있으면 인트라 아이디가 42에 있다는 뜻이므로 isIntraId = true + setIsIntraId(!!intraData); + // 3. agendaProfileData가 있으면 아젠다에 등록된 사용자이므로 isAgendaId = true + setIsAgendaId(!!agendaProfileData); + }; + updateProfileStatus(); + }, [queryIntraId, intraData, agendaProfileData]); + + useEffect(() => { + setIsIntraId(false); + setIsAgendaId(false); + }, [queryIntraId]); /** UI Rendering */ if (!queryIntraId || !myIntraId) { From 9001cc75a59818c512cd46c45a6031bdf21cd871 Mon Sep 17 00:00:00 2001 From: irenee-14 Date: Mon, 9 Sep 2024 12:56:41 +0900 Subject: [PATCH 11/13] =?UTF-8?q?Fix:=20agenda=20=EB=93=B1=EB=A1=9D=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=EC=9E=90=EA=B0=80=20=EC=95=84=EB=8B=90?= =?UTF-8?q?=EB=95=8C=20content=EB=B6=88=EB=9F=AC=EC=98=A4=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8A=94=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/agenda/profile/user.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pages/agenda/profile/user.tsx b/pages/agenda/profile/user.tsx index 00a1db14e..a23543aea 100644 --- a/pages/agenda/profile/user.tsx +++ b/pages/agenda/profile/user.tsx @@ -24,6 +24,8 @@ const AgendaProfile = () => { const isMyProfile = useRef(false); // 내 프로필 페이지인지 아닌지 확인 const [isIntraId, setIsIntraId] = useState(false); // 인트라 아이디가 42에 있는지 확인 const [isAgendaId, setIsAgendaId] = useState(false); // 인트라 아이디가 agenda에 있는지 확인 + const [agendaProfileData, setAgendaProfileData] = + useState(null); // agendaProfileData 상태 추가 /** API GET */ // GET: intraData (42 인트라 데이터 가져오기) @@ -32,7 +34,7 @@ const AgendaProfile = () => { isReady: Boolean(queryIntraId), }); // GET: agendaProfileData (GG 아젠다 유저 데이터 가져오기) - const { data: agendaProfileData, getData: getAgendaProfileData } = + const { data: fetchedAgendaProfileData, getData: getAgendaProfileData } = useFetchGet({ url: `/profile/${queryIntraId}`, isReady: isIntraId, @@ -76,10 +78,15 @@ const AgendaProfile = () => { // 2. intraData가 있으면 인트라 아이디가 42에 있다는 뜻이므로 isIntraId = true setIsIntraId(!!intraData); // 3. agendaProfileData가 있으면 아젠다에 등록된 사용자이므로 isAgendaId = true - setIsAgendaId(!!agendaProfileData); + setIsAgendaId(!!fetchedAgendaProfileData); + if (isAgendaId) { + setAgendaProfileData(fetchedAgendaProfileData); + } else { + setAgendaProfileData(null); // fetchedAgendaProfileData가 없을 때 초기화 + } }; updateProfileStatus(); - }, [queryIntraId, intraData, agendaProfileData]); + }, [queryIntraId, intraData, fetchedAgendaProfileData]); useEffect(() => { setIsIntraId(false); From e350319e3cf4a318fa3f0d078c812119df431e67 Mon Sep 17 00:00:00 2001 From: irenee-14 Date: Mon, 9 Sep 2024 13:29:33 +0900 Subject: [PATCH 12/13] =?UTF-8?q?=20Fix:=20401=20=EB=B0=9C=EC=83=9D=20?= =?UTF-8?q?=ED=9B=84=20home=EC=9C=BC=EB=A1=9C=20=EB=8F=8C=EC=95=84?= =?UTF-8?q?=EA=B0=80=EB=8A=94=20=EC=98=A4=EB=A5=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/error/AgendaError.tsx | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/components/error/AgendaError.tsx b/components/error/AgendaError.tsx index f9064711f..52c57551c 100644 --- a/components/error/AgendaError.tsx +++ b/components/error/AgendaError.tsx @@ -1,7 +1,6 @@ import { useEffect } from 'react'; -import { useRecoilState, useResetRecoilState, useSetRecoilState } from 'recoil'; +import { useRecoilState, useResetRecoilState } from 'recoil'; import { agendaErrorState } from 'utils/recoil/agendaError'; -import { loginState } from 'utils/recoil/login'; import { modalState } from 'utils/recoil/takgu/modal'; import { useRouter } from 'next/router'; import useErrorPage from 'hooks/error/useErrorPage'; @@ -12,20 +11,10 @@ export default function ErrorPage() { const { goHome } = useErrorPage(); const [error, setError] = useRecoilState(agendaErrorState); const { msg, status } = error; - const setLoggedIn = useSetRecoilState(loginState); const resetModal = useResetRecoilState(modalState); const router = useRouter(); - if (status === 401) { - localStorage.removeItem('42gg-token'); - setLoggedIn(false); - } - const resetHandler = () => { - if (status === 401) { - localStorage.removeItem('42gg-token'); - setLoggedIn(false); - } setError({ msg: '', status: 0 }); goHome(); }; From 8380ec02a57edffce43be456ea453759309bf186 Mon Sep 17 00:00:00 2001 From: irenee-14 Date: Mon, 9 Sep 2024 14:27:36 +0900 Subject: [PATCH 13/13] =?UTF-8?q?Style:=20tag,=20description=20width=20?= =?UTF-8?q?=EB=93=B1=20css=20=EC=A1=B0=EC=A0=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- styles/agenda/Home/AgendaInfo.module.scss | 2 +- styles/agenda/agendaDetail/tabs/AgendaDescription.module.scss | 2 +- styles/agenda/utils/AgendaTag.module.scss | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/styles/agenda/Home/AgendaInfo.module.scss b/styles/agenda/Home/AgendaInfo.module.scss index 92732a29b..0d8cfaaf0 100644 --- a/styles/agenda/Home/AgendaInfo.module.scss +++ b/styles/agenda/Home/AgendaInfo.module.scss @@ -28,7 +28,7 @@ display: flex; width: 100%; height: max-content; - align-items: center; + align-items: flex-start; gap: 1.5rem; justify-content: space-between; @include text(description); diff --git a/styles/agenda/agendaDetail/tabs/AgendaDescription.module.scss b/styles/agenda/agendaDetail/tabs/AgendaDescription.module.scss index 99ee8c820..5f3fd4da4 100644 --- a/styles/agenda/agendaDetail/tabs/AgendaDescription.module.scss +++ b/styles/agenda/agendaDetail/tabs/AgendaDescription.module.scss @@ -72,7 +72,7 @@ p { margin: 0; } - @media screen and (max-width: 481px) { + @media screen and (max-width: 520px) { flex-direction: column; } } diff --git a/styles/agenda/utils/AgendaTag.module.scss b/styles/agenda/utils/AgendaTag.module.scss index 619260259..cc6696ed6 100644 --- a/styles/agenda/utils/AgendaTag.module.scss +++ b/styles/agenda/utils/AgendaTag.module.scss @@ -3,7 +3,8 @@ .agendaItemTagBox { display: flex; gap: 0.3rem; - max-width: 16rem; + max-width: 18rem; + flex-wrap: wrap; } $tags: (