From 26916887d2bbd665955ef47bbaa7de472b928ee0 Mon Sep 17 00:00:00 2001 From: irenee-14 Date: Thu, 5 Sep 2024 12:11:28 +0900 Subject: [PATCH 01/28] =?UTF-8?q?Fix:=20css=20=EB=B0=8F=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/agenda/Home/AgendaInfo.tsx | 2 +- styles/agenda/agendaDetail/AgendaTab.module.scss | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/components/agenda/Home/AgendaInfo.tsx b/components/agenda/Home/AgendaInfo.tsx index 32246e7a1..c560fed75 100644 --- a/components/agenda/Home/AgendaInfo.tsx +++ b/components/agenda/Home/AgendaInfo.tsx @@ -45,7 +45,7 @@ const AgendaInfo = ({
count Date: Thu, 5 Sep 2024 13:43:32 +0900 Subject: [PATCH 02/28] =?UTF-8?q?feat:=20agenda=20errorstate=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/error/ErrorChecker.tsx | 31 +++++++++++++++++++------------ utils/recoil/agendaError.ts | 12 ++++++++++++ 2 files changed, 31 insertions(+), 12 deletions(-) create mode 100644 utils/recoil/agendaError.ts diff --git a/components/error/ErrorChecker.tsx b/components/error/ErrorChecker.tsx index a508dacf9..a73bd7fcf 100644 --- a/components/error/ErrorChecker.tsx +++ b/components/error/ErrorChecker.tsx @@ -1,4 +1,5 @@ import { useRecoilValue } from 'recoil'; +import { agendaErrorState } from 'utils/recoil/agendaError'; import { errorState } from 'utils/recoil/error'; import AgendaErrorPage from 'components/error/AgendaError'; import TakguErrorPage from 'components/error/Error'; @@ -12,17 +13,23 @@ interface ErrorCheckerProps { // 추후 takgu쪽과 디자인을 어느정도 맞춘 후 통합할 예정 export default function ErrorChecker({ children }: ErrorCheckerProps) { const error = useRecoilValue(errorState); - const app = usePathname(); + const agendaError = useRecoilValue(agendaErrorState); - return error === '' ? ( - <>{children} - ) : app === 'takgu' ? ( -
-
- -
-
- ) : ( - - ); + switch (true) { + case agendaError.msg !== '': { + return ; + } + case error !== '': { + return ( +
+
+ +
+
+ ); + } + default: { + return <>{children}; + } + } } diff --git a/utils/recoil/agendaError.ts b/utils/recoil/agendaError.ts new file mode 100644 index 000000000..df813002c --- /dev/null +++ b/utils/recoil/agendaError.ts @@ -0,0 +1,12 @@ +import { atom } from 'recoil'; +import { v1 } from 'uuid'; + +interface ErrorState { + msg: string; + status: number; +} + +export const agendaErrorState = atom({ + key: `errorState/${v1()}`, + default: { msg: '', status: 0 }, +}); From 52a51953cf1d8505575f8b526be9eb63d178f555 Mon Sep 17 00:00:00 2001 From: irenee-14 Date: Thu, 5 Sep 2024 15:36:22 +0900 Subject: [PATCH 03/28] =?UTF-8?q?Feat:=20UserSearchBar=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20style=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agenda/Profile/AgendaUserSearchBar.tsx | 63 +++++++++++++++++-- components/agenda/Profile/ProfileCard.tsx | 6 +- components/agenda/utils/CustomImage.tsx | 1 + hooks/useSearchBar.ts | 7 ++- pages/agenda/profile/user.tsx | 7 +++ .../agenda/Profile/AgendaProfile.module.scss | 2 +- .../Profile/AgendaUserSearchBar.module.scss | 57 +++++++++++++---- 7 files changed, 123 insertions(+), 20 deletions(-) diff --git a/components/agenda/Profile/AgendaUserSearchBar.tsx b/components/agenda/Profile/AgendaUserSearchBar.tsx index d2f7e187c..de79a1a92 100644 --- a/components/agenda/Profile/AgendaUserSearchBar.tsx +++ b/components/agenda/Profile/AgendaUserSearchBar.tsx @@ -1,12 +1,67 @@ +import router from 'next/router'; import { GoSearch } from 'react-icons/go'; +import { IoIosCloseCircle } from 'react-icons/io'; +import useSearchBar from 'hooks/useSearchBar'; import styles from 'styles/agenda/Profile/AgendaUserSearchBar.module.scss'; const AgendaUserSearchBar = () => { + const { + keyword, + setKeyword, + keywordHandler, + showDropDown, + setShowDropDown, + searchResult, + searchBarRef, + handleKeyDown, + } = useSearchBar(); + + const changeUser = (intraId: string) => { + setKeyword(''); + setShowDropDown(false); + router.push(`/agenda/profile/user?id=${intraId}`); + }; + return ( -
- - -
+ <> +
+
+ setShowDropDown(true)} + placeholder='유저 검색하기' + maxLength={12} + value={keyword} + /> +
+ {keyword ? ( + setKeyword('')}> + + + ) : ( + + + + )} +
+
+ {showDropDown && keyword && ( +
+ {searchResult.length ? ( + searchResult.map((intraId: string) => ( +
changeUser(intraId)} key={intraId}> + {intraId} +
+ )) + ) : ( +
검색 결과가 없습니다.
+ )} +
+ )} +
+ ); }; diff --git a/components/agenda/Profile/ProfileCard.tsx b/components/agenda/Profile/ProfileCard.tsx index 7f5b4656c..f25918e1f 100644 --- a/components/agenda/Profile/ProfileCard.tsx +++ b/components/agenda/Profile/ProfileCard.tsx @@ -7,7 +7,7 @@ import GithubIcon from 'public/image/agenda/github.svg'; import useFetchRequest from 'hooks/agenda/useFetchRequest'; import styles from 'styles/agenda/Profile/ProfileCard.module.scss'; -const ProfileImageCard = ({ +const ProfileCard = ({ userIntraId, userContent, userGithub, @@ -77,6 +77,7 @@ const ProfileImageCard = ({ setProfileData(initialProfileData); handleFlip(); }; + return (
) => { + const basePath = router.pathname.split('/')[1]; if (event.key === 'Enter') { searchResult.map((data) => { if (data === keyword) { setShowDropDown(false); event.currentTarget.blur(); - router.push(`/takgu/users/detail?intraId=${keyword}`); + if (basePath === 'takgu') { + router.push(`/takgu/users/detail?intraId=${keyword}`); + } else if (basePath === 'agenda') { + router.push(`/agenda/profile/user?id=${keyword}`); + } } }); } diff --git a/pages/agenda/profile/user.tsx b/pages/agenda/profile/user.tsx index 9ca5368ee..65ecd0852 100644 --- a/pages/agenda/profile/user.tsx +++ b/pages/agenda/profile/user.tsx @@ -1,4 +1,5 @@ import { useRouter } from 'next/router'; +import { useEffect } from 'react'; import { MyTeamDataProps } from 'types/agenda/agendaDetail/agendaTypes'; import { HistoryItemProps } from 'types/agenda/profile/historyListTypes'; import { ProfileDataProps } from 'types/agenda/profile/profileDataTypes'; @@ -25,6 +26,12 @@ const AgendaProfile = () => { isMyProfile ? '/profile' : `/profile/${intraId}` ); + useEffect(() => { + if (intraId) { + getProfileData(); + } + }, [intraId]); + // host current const { content: hostCurrentListData, diff --git a/styles/agenda/Profile/AgendaProfile.module.scss b/styles/agenda/Profile/AgendaProfile.module.scss index 33b917a68..690cb01df 100644 --- a/styles/agenda/Profile/AgendaProfile.module.scss +++ b/styles/agenda/Profile/AgendaProfile.module.scss @@ -11,6 +11,6 @@ .agendaUserSearchBarWrap { display: flex; - justify-content: flex-start; + justify-content: flex-end; width: 100%; } diff --git a/styles/agenda/Profile/AgendaUserSearchBar.module.scss b/styles/agenda/Profile/AgendaUserSearchBar.module.scss index 64a7d34c4..46f02290f 100644 --- a/styles/agenda/Profile/AgendaUserSearchBar.module.scss +++ b/styles/agenda/Profile/AgendaUserSearchBar.module.scss @@ -1,27 +1,60 @@ @import 'styles/agenda/common.scss'; +.warp { + position: relative; + width: 12rem; +} + .agendaUserSearchBar { + position: relative; + z-index: 4; display: flex; - width: 12rem; height: 2.5rem; - padding: 0.5rem 1rem; - background-color: var(--box-bg-3); + padding: 0.2rem 1rem; + font-size: $font-size-m; + color: var(black); + background-color: var(--box-bg-1); border-radius: $radius-big; justify-content: space-between; align-items: center; input { - width: 8rem; + all: unset; + position: relative; + z-index: 5; + box-sizing: border-box; + width: calc(100% - 4rem); color: var(--color-text-reverse); - background: none; - border: none; - outline: none; - @include text(label); + @include text(default); } - .imageBox { - width: 1.5rem; - height: 1.5rem; - color: var(--color-text-reverse); + .icons { + display: flex; + align-items: center; + margin-top: 0.2rem; + .reset { + cursor: pointer; + } + } +} + +.dropdown { + position: absolute; + top: 1.1rem; + left: 0; + z-index: 2; + + box-sizing: border-box; + display: block; + width: 100%; + padding: 1.4rem 0 0 1rem; + color: var(--box-bg-1-dark); + background: var(--box-bg-1); + border-radius: 0 0 $radius-small $radius-small; + @include text(default); + + div { + padding: 0.4rem 0; + cursor: pointer; } } From 47f6db06e3acef80c6f8be7d5f17689b14ceb717 Mon Sep 17 00:00:00 2001 From: Kimmy Haecho <118002501+siwolee@users.noreply.github.com> Date: Thu, 5 Sep 2024 15:56:50 +0900 Subject: [PATCH 04/28] =?UTF-8?q?fix:=20=ED=83=81=EA=B5=AC=20=EC=B6=9C?= =?UTF-8?q?=EC=84=9D=EB=B3=B4=EC=83=81=20=EC=8B=9C=20=EA=B2=BD=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hooks/takgu/Layout/useAnnouncementCheck.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/hooks/takgu/Layout/useAnnouncementCheck.ts b/hooks/takgu/Layout/useAnnouncementCheck.ts index b4cc56e11..d35bb54ba 100644 --- a/hooks/takgu/Layout/useAnnouncementCheck.ts +++ b/hooks/takgu/Layout/useAnnouncementCheck.ts @@ -41,16 +41,9 @@ const useAnnouncementCheck = (presentPath: string) => { } }; - // const attendedHandler = () => { - // if (user && user.isAttended === false && presentPath === '/') { - // setModal({ modalName: 'EVENT-WELCOME' }); - // } - // }; - useEffect(() => { if (!user) return; - // attendedHandler(); - if (user && user.isAttended === false && presentPath === '/') { + if (user && user.isAttended === false && presentPath === 'takgu') { setModal({ modalName: 'EVENT-WELCOME' }); } else announcementHandler(); }, [user, presentPath]); From a9234ef33a0d70fb94dcafc0d24bf339eb02fc6c Mon Sep 17 00:00:00 2001 From: Kimmy Haecho <118002501+siwolee@users.noreply.github.com> Date: Thu, 5 Sep 2024 15:57:36 +0900 Subject: [PATCH 05/28] =?UTF-8?q?feat:=20dev=20=EB=AA=A8=EB=93=9C=20?= =?UTF-8?q?=ED=99=95=EC=9D=B8=ED=95=B4=EC=84=9C=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=EC=83=81=ED=83=9C=20=EC=9C=A0=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/LoginChecker.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/LoginChecker.tsx b/components/LoginChecker.tsx index 5a5d17532..1b03cef6d 100644 --- a/components/LoginChecker.tsx +++ b/components/LoginChecker.tsx @@ -8,7 +8,11 @@ interface LoginCheckerProps { export default function LoginChecker({ children }: LoginCheckerProps) { const [isLoading, loggedIn] = useLoginCheck(); - // return <>{children}; + // dev 환경에서는 로그인 상태를 유지 + // 만약 로그인 상태를 확인하고 싶다면, 아래 주석처리 필요 + if (process.env.NODE_ENV === 'development') { + return <>{children}; + } return loggedIn ? ( <>{children} From 11075d90f7ef233fd6da73be40eb8b741225d292 Mon Sep 17 00:00:00 2001 From: Lee Jeong Ron <83465749+JeongRon@users.noreply.github.com> Date: Thu, 5 Sep 2024 16:00:21 +0900 Subject: [PATCH 06/28] =?UTF-8?q?Fix:=20useFetchGet=20/=20isReady=20props?= =?UTF-8?q?=EB=A1=9C=20=EA=B0=80=EC=A0=B8=EC=98=A4=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/LoginChecker.tsx | 2 +- .../agenda/announcements/AnnouncementTable.tsx | 2 +- components/admin/agenda/teamList/TeamTable.tsx | 2 +- components/agenda/Form/AdminTicketForm.tsx | 2 +- components/agenda/Form/TicketForm.tsx | 2 +- components/agenda/Form/userForm.tsx | 6 +++--- components/agenda/Home/MyAgendaBtn.tsx | 3 ++- components/agenda/Ticket/Ticket.tsx | 2 +- hooks/agenda/useFetchGet.ts | 13 +++++++++---- pages/admin/agenda/teamModify.tsx | 9 +++++++-- pages/agenda/detail/host/result.tsx | 6 +++++- pages/agenda/detail/index.tsx | 9 +++++---- pages/agenda/detail/team/create.tsx | 8 ++++++-- pages/agenda/detail/team/index.tsx | 16 +++++++++++----- pages/agenda/index.tsx | 6 ++++-- pages/agenda/profile/user.tsx | 12 ++++++------ 16 files changed, 64 insertions(+), 36 deletions(-) diff --git a/components/LoginChecker.tsx b/components/LoginChecker.tsx index 5a5d17532..a94b89fa7 100644 --- a/components/LoginChecker.tsx +++ b/components/LoginChecker.tsx @@ -8,7 +8,7 @@ interface LoginCheckerProps { export default function LoginChecker({ children }: LoginCheckerProps) { const [isLoading, loggedIn] = useLoginCheck(); - // return <>{children}; + return <>{children}; return loggedIn ? ( <>{children} diff --git a/components/admin/agenda/announcements/AnnouncementTable.tsx b/components/admin/agenda/announcements/AnnouncementTable.tsx index 025a8ba47..9db4ee1cf 100644 --- a/components/admin/agenda/announcements/AnnouncementTable.tsx +++ b/components/admin/agenda/announcements/AnnouncementTable.tsx @@ -59,7 +59,7 @@ export default function AnnouncementTable() { }); const [currentPage, setCurrentPage] = useState(1); const [selectedAgendaKey, setSelectedAgendaKey] = useState(''); - const agendaList = useFetchGet('admin/list').data || []; + const agendaList = useFetchGet({ url: 'admin/list' }).data || []; useEffect(() => { if (agendaKey) { diff --git a/components/admin/agenda/teamList/TeamTable.tsx b/components/admin/agenda/teamList/TeamTable.tsx index ad68ff152..57eab45af 100644 --- a/components/admin/agenda/teamList/TeamTable.tsx +++ b/components/admin/agenda/teamList/TeamTable.tsx @@ -68,7 +68,7 @@ export default function TeamTable() { const [currentPage, setCurrentPage] = useState(1); const [selectedAgendaKey, setSelectedAgendaKey] = useState(''); - const agendaList = useFetchGet(`admin/list`).data || []; + const agendaList = useFetchGet({ url: 'admin/list' }).data || []; const setSnackBar = useSetRecoilState(toastState); const buttonList: string[] = [styles.coin, styles.penalty]; diff --git a/components/agenda/Form/AdminTicketForm.tsx b/components/agenda/Form/AdminTicketForm.tsx index e269269b8..cdf67b14f 100644 --- a/components/agenda/Form/AdminTicketForm.tsx +++ b/components/agenda/Form/AdminTicketForm.tsx @@ -17,7 +17,7 @@ interface userFormProps { const AdminTicketForm = ({ stringKey, data, onProceed }: userFormProps) => { const { closeModal } = useModal(); const sendRequest = useFetchRequest().sendRequest; - const agendaList = useFetchGet('admin/list').data || []; + const agendaList = useFetchGet({ url: 'admin/list' }).data || []; const [issuedFromKey, setIssuedFromKey] = useState( data.issuedFromKey ? data.issuedFromKey : '' diff --git a/components/agenda/Form/TicketForm.tsx b/components/agenda/Form/TicketForm.tsx index 9fd820c41..3498e6fa5 100644 --- a/components/agenda/Form/TicketForm.tsx +++ b/components/agenda/Form/TicketForm.tsx @@ -12,7 +12,7 @@ interface userFormProps { const TicketForm = ({ stringKey }: userFormProps) => { const { closeModal } = useModal(); const sendRequest = useFetchRequest().sendRequest; - const agendaList = useFetchGet('admin/list').data || []; + const agendaList = useFetchGet({ url: 'admin/list' }).data || []; const [selectedAgendaKey, setSelectedAgendaKey] = useState(''); const handleSelectChange = (e: { target: { value: any } }) => { diff --git a/components/agenda/Form/userForm.tsx b/components/agenda/Form/userForm.tsx index f147bcc48..1623c8b0f 100644 --- a/components/agenda/Form/userForm.tsx +++ b/components/agenda/Form/userForm.tsx @@ -48,9 +48,9 @@ const UserForm = ({ stringKey }: userFormProps) => { const { closeModal } = useModal(); const sendRequest = useFetchRequest().sendRequest; - const { data }: { data: dataType | null } = useFetchGet( - `profile/${stringKey}` - ); + const { data }: { data: dataType | null } = useFetchGet({ + url: `profile/${stringKey}`, + }); if (!data) { return
loading...
; diff --git a/components/agenda/Home/MyAgendaBtn.tsx b/components/agenda/Home/MyAgendaBtn.tsx index 318aa94a4..6d06475da 100644 --- a/components/agenda/Home/MyAgendaBtn.tsx +++ b/components/agenda/Home/MyAgendaBtn.tsx @@ -30,7 +30,8 @@ const MyAgendaBtn = () => { } }; const myList = - useFetchGet('/profile/current/list')?.data || []; + useFetchGet({ url: '/profile/current/list' })?.data || + []; return (
{ - const { data } = useFetchGet('/ticket'); + const { data } = useFetchGet({ url: '/ticket' }); const { openModal } = useModal(); return ( diff --git a/hooks/agenda/useFetchGet.ts b/hooks/agenda/useFetchGet.ts index 83bebc71d..be934bec4 100644 --- a/hooks/agenda/useFetchGet.ts +++ b/hooks/agenda/useFetchGet.ts @@ -1,13 +1,19 @@ import { useEffect, useState, useCallback } from 'react'; import { instanceInAgenda } from 'utils/axios'; -const useFetchGet = (url: string, params?: Record) => { +interface FetchGetProps { + url: string; + isReady?: boolean; + params?: Record; +} + +const useFetchGet = ({ url, isReady = true, params }: FetchGetProps) => { const [data, setData] = useState(null); const [status, setStatus] = useState(0); const [error, setError] = useState(null); const getData = useCallback(async () => { - if (params && params.agenda_key === undefined) { + if (isReady === false) { return; } @@ -24,8 +30,7 @@ const useFetchGet = (url: string, params?: Record) => { }, [url, params]); useEffect(() => { - // URL이 있고 params가 없거나, agenda_key가 있는 경우에도 getData 호출 가능 - if (url && (!params || (params && params.agenda_key))) { + if (url) { getData(); // 조건에 맞을 때만 getData 호출 } }, [url, JSON.stringify(params)]); diff --git a/pages/admin/agenda/teamModify.tsx b/pages/admin/agenda/teamModify.tsx index 1c182e405..d56f39375 100644 --- a/pages/admin/agenda/teamModify.tsx +++ b/pages/admin/agenda/teamModify.tsx @@ -6,9 +6,14 @@ import styles from 'styles/agenda/pages/create-team.module.scss'; const TeamModify = () => { const { team_key, location } = router.query; + const readyState = Boolean(team_key); // + team_key router.query 써서 쿼리로 못가져왔을 시, 에러 가능성 있음 - const teamData = useFetchGet('admin/team', { - team_key: team_key as string, + const teamData = useFetchGet({ + url: 'admin/team', + isReady: readyState, + params: { + team_key: team_key as string, + }, }).data; return ( diff --git a/pages/agenda/detail/host/result.tsx b/pages/agenda/detail/host/result.tsx index 58f89341c..b7ca95f42 100644 --- a/pages/agenda/detail/host/result.tsx +++ b/pages/agenda/detail/host/result.tsx @@ -92,7 +92,11 @@ const SubmitAgendaResult = () => { const { data } = useFetchGet<{ totalSize: number; content: ParticipantProps[]; - }>(`team/confirm/list`, { agenda_key: agenda_key, size: 30, page: 1 }) || { + }>({ + url: `team/confirm/list`, + isReady: Boolean(agenda_key), + params: { agenda_key: agenda_key, size: 30, page: 1 }, + }) || { data: {}, status: 400, }; diff --git a/pages/agenda/detail/index.tsx b/pages/agenda/detail/index.tsx index cd520617b..d12224747 100644 --- a/pages/agenda/detail/index.tsx +++ b/pages/agenda/detail/index.tsx @@ -17,10 +17,11 @@ const AgendaDetail = () => { const agendaKey = useAgendaKey(); const agendaData = useAgendaInfo(agendaKey as string); - const { data: myTeam, status: myTeamStatus } = useFetchGet( - `team/my`, - { agenda_key: agendaKey } - ); + const { data: myTeam, status: myTeamStatus } = useFetchGet({ + url: `team/my`, + isReady: Boolean(agendaKey), + params: { agenda_key: agendaKey }, + }); const intraId = useUser()?.intraId || ''; const isHost = getIsHost(intraId, agendaData); diff --git a/pages/agenda/detail/team/create.tsx b/pages/agenda/detail/team/create.tsx index 4d1fcb600..0e583acba 100644 --- a/pages/agenda/detail/team/create.tsx +++ b/pages/agenda/detail/team/create.tsx @@ -10,8 +10,12 @@ const CreateTeam = () => { const router = useRouter(); const agendaKey = useAgendaKey(); - const agendaInfo = useFetchGet(`/`, { - agenda_key: agendaKey, + const agendaInfo = useFetchGet({ + url: `/`, + isReady: Boolean(agendaKey), + params: { + agenda_key: agendaKey, + }, }).data; const backPage = () => { diff --git a/pages/agenda/detail/team/index.tsx b/pages/agenda/detail/team/index.tsx index 74b3e314f..b3c00481c 100644 --- a/pages/agenda/detail/team/index.tsx +++ b/pages/agenda/detail/team/index.tsx @@ -27,14 +27,20 @@ export default function TeamDetail() { */ const intraId = useUser()?.intraId; - const agendaData = useFetchGet(`/`, { - agenda_key: agendaKey, + const agendaData = useFetchGet({ + url: '/', + isReady: Boolean(agendaKey), + params: { agenda_key: agendaKey }, }).data; const { data: teamDetailData, getData: getTeamDetail } = - useFetchGet('/team', { - teamKey: teamUID, - agenda_key: agendaKey, + useFetchGet({ + url: '/team', + isReady: Boolean(agendaKey && teamUID), + params: { + agenda_key: agendaKey, + teamKey: teamUID, + }, }); /** diff --git a/pages/agenda/index.tsx b/pages/agenda/index.tsx index 7dd6a8cff..b7e59c827 100644 --- a/pages/agenda/index.tsx +++ b/pages/agenda/index.tsx @@ -17,8 +17,10 @@ const Agenda: NextPage = () => { url: '/history', }); - const { data: currentData } = useFetchGet('/confirm'); - const { data: openData } = useFetchGet('/open'); + const { data: currentData } = useFetchGet({ + url: '/confirm', + }); + const { data: openData } = useFetchGet({ url: '/open' }); return (
diff --git a/pages/agenda/profile/user.tsx b/pages/agenda/profile/user.tsx index 9ca5368ee..f336d55fd 100644 --- a/pages/agenda/profile/user.tsx +++ b/pages/agenda/profile/user.tsx @@ -21,9 +21,9 @@ const AgendaProfile = () => { /** API GET */ const { data: profileData, getData: getProfileData } = - useFetchGet( - isMyProfile ? '/profile' : `/profile/${intraId}` - ); + useFetchGet({ + url: isMyProfile ? '/profile' : `/profile/${intraId}`, + }); // host current const { @@ -34,9 +34,9 @@ const AgendaProfile = () => { }); // current team - const currentListData = useFetchGet( - '/profile/current/list' - ).data; + const currentListData = useFetchGet({ + url: '/profile/current/list', + }).data; // host history const { From 514322600e557c1c2f1d5a59649d793f81134f88 Mon Sep 17 00:00:00 2001 From: Kimmy Haecho <118002501+siwolee@users.noreply.github.com> Date: Thu, 5 Sep 2024 16:00:37 +0900 Subject: [PATCH 07/28] =?UTF-8?q?feat:=20agendaAxiosHandler=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Layout/LayoutProvider.tsx | 4 +- components/error/AgendaError.tsx | 21 +++++--- hooks/useAxiosAgendaError.ts | 91 ++++++++++++++++++++++++++++++++ hooks/useAxiosResponse.ts | 12 ++--- pages/agenda/profile/index.tsx | 10 +++- 5 files changed, 120 insertions(+), 18 deletions(-) create mode 100644 hooks/useAxiosAgendaError.ts diff --git a/Layout/LayoutProvider.tsx b/Layout/LayoutProvider.tsx index 54a95fc69..d60953b20 100644 --- a/Layout/LayoutProvider.tsx +++ b/Layout/LayoutProvider.tsx @@ -4,6 +4,7 @@ import AdminAppLayout from 'Layout/AdminLayout'; import AgendaAppLayout from 'Layout/AgendaLayout'; import TakguAppLayout from 'Layout/TakguLayout'; import { usePathname } from 'hooks/agenda/Layout/usePathname'; +import useAxiosAgendaError from 'hooks/useAxiosAgendaError'; import useAxiosResponse from 'hooks/useAxiosResponse'; type LayoutProviderProps = { @@ -14,7 +15,8 @@ type LayoutProviderProps = { // 로그인 스테이트 등은 각 레이아웃에서 확인 const LayoutProvider = ({ children }: LayoutProviderProps) => { useRecoilValue(loginState); - useAxiosResponse(); + useAxiosResponse(); // takgu axios response interceptor + useAxiosAgendaError(); // agenda axios response interceptor const app = usePathname(); switch (app) { diff --git a/components/error/AgendaError.tsx b/components/error/AgendaError.tsx index e5c583563..07f4b8a83 100644 --- a/components/error/AgendaError.tsx +++ b/components/error/AgendaError.tsx @@ -1,14 +1,25 @@ import { useEffect } from 'react'; -import { useResetRecoilState } from 'recoil'; +import { useRecoilState, useResetRecoilState, useSetRecoilState } from 'recoil'; +import { agendaErrorState } from 'utils/recoil/agendaError'; +import { loginState } from 'utils/recoil/login'; import { modalState } from 'utils/recoil/takgu/modal'; import useErrorPage from 'hooks/error/useErrorPage'; import styles from 'styles/takgu/Error.module.scss'; import ErrorEmoji from '/public/image/takgu/error_face.svg'; export default function ErrorPage() { - const { error, goHome } = useErrorPage(); + const { goHome } = useErrorPage(); + const [error, setError] = useRecoilState(agendaErrorState); + const { msg, status } = error; + const setLoggedIn = useSetRecoilState(loginState); const resetModal = useResetRecoilState(modalState); + if (status === 401) { + localStorage.removeItem('42gg-token'); + setLoggedIn(false); + setError({ msg: '', status: 0 }); + } + useEffect(() => { resetModal(); }, []); @@ -18,10 +29,8 @@ export default function ErrorPage() {
42GG
- {error === 'DK404' - ? '잘못된 요청입니다!' - : '데이터 요청에 실패하였습니다.'} -
({error})
+ {msg} +
({status})
diff --git a/hooks/useAxiosAgendaError.ts b/hooks/useAxiosAgendaError.ts new file mode 100644 index 000000000..9c7b617cc --- /dev/null +++ b/hooks/useAxiosAgendaError.ts @@ -0,0 +1,91 @@ +import { AxiosError, AxiosResponse } from 'axios'; +import Cookies from 'js-cookie'; +import { useEffect, useState } from 'react'; +import { useSetRecoilState } from 'recoil'; +import { instanceInAgenda } from 'utils/axios'; +import { agendaErrorState } from 'utils/recoil/agendaError'; +import { loginState } from 'utils/recoil/login'; + +export default function useAxiosAgendaError() { + const setLogin = useSetRecoilState(loginState); + const [isRecalling, setIsRecalling] = useState(false); + const setError = useSetRecoilState(agendaErrorState); + const refreshToken = Cookies.get('refresh_token') || ''; + + const accessTokenHandler = async () => { + console.log('accessTokenHandler'); + try { + const res = await instanceInAgenda.post( + `/pingpong/users/accesstoken?refreshToken=${refreshToken}` + ); + localStorage.setItem('42gg-token', res.data.accessToken); + } catch (error) { + setError({ msg: '로그인이 만료되었습니다', status: 401 }); + } + }; + + const errorResponseHandler = async (error: AxiosError) => { + console.log('errorResponseHandler', error); + const defaultReturn = () => { + if (isRecalling === true) { + setLogin(false); + setIsRecalling(false); + } + return Promise.reject(error); + }; + if (error.response === undefined || error.response?.status === undefined) { + return defaultReturn(); + } + switch (error.response.status) { + case 401: { + if (!isRecalling) { + setIsRecalling(true); + try { + const res = await instanceInAgenda.post( + `/pingpong/users/accesstoken?refreshToken=${refreshToken}` + ); + localStorage.setItem('42gg-token', res.data.accessToken); + setIsRecalling(false); + return instanceInAgenda.request(error.config); + } catch (error) { + setIsRecalling(false); + setError({ msg: '로그인이 만료되었습니다', status: 401 }); + return Promise.reject(error); + } + } else return defaultReturn(); + } + case 404: + setError({ + msg: '문제가 발생했습니다.', + status: error.response.status, + }); + break; + case 500: + setError({ + msg: '서버 오류가 발생했습니다', + status: error.response.status, + }); + break; + } + return defaultReturn(); + }; + + const responseInterceptor = instanceInAgenda.interceptors.response.use( + (response: AxiosResponse) => response, + errorResponseHandler + ); + useEffect(() => { + if (localStorage.getItem('42gg-token')) { + setLogin(true); + } else { + accessTokenHandler(); + setLogin(true); + } + }, []); + + useEffect(() => { + return () => { + instanceInAgenda.interceptors.response.eject(responseInterceptor); + }; + }, [responseInterceptor]); +} diff --git a/hooks/useAxiosResponse.ts b/hooks/useAxiosResponse.ts index 822f83176..94e563da0 100644 --- a/hooks/useAxiosResponse.ts +++ b/hooks/useAxiosResponse.ts @@ -2,7 +2,7 @@ import { AxiosError, AxiosResponse } from 'axios'; import Cookies from 'js-cookie'; import { useEffect, useState } from 'react'; import { useSetRecoilState } from 'recoil'; -import { instance, instanceInAgenda } from 'utils/axios'; +import { instance } from 'utils/axios'; import { errorState } from 'utils/recoil/error'; import { loginState } from 'utils/recoil/login'; @@ -19,7 +19,7 @@ export default function useAxiosResponse() { ); localStorage.setItem('42gg-token', res.data.accessToken); } catch (error) { - setError('SW05'); + // setError('SW05'); } }; @@ -50,11 +50,6 @@ export default function useAxiosResponse() { (response: AxiosResponse) => response, errorResponseHandler ); - const responseInAgendaInterceptor = - instanceInAgenda.interceptors.response.use( - (response: AxiosResponse) => response, - errorResponseHandler - ); useEffect(() => { if (localStorage.getItem('42gg-token')) { @@ -68,7 +63,6 @@ export default function useAxiosResponse() { useEffect(() => { return () => { instance.interceptors.response.eject(responseInterceptor); - instance.interceptors.response.eject(responseInAgendaInterceptor); }; - }, [responseInterceptor, responseInAgendaInterceptor]); + }, [responseInterceptor]); } diff --git a/pages/agenda/profile/index.tsx b/pages/agenda/profile/index.tsx index 7df132207..f746dd50c 100644 --- a/pages/agenda/profile/index.tsx +++ b/pages/agenda/profile/index.tsx @@ -1,18 +1,24 @@ import { useRouter } from 'next/router'; import { useEffect } from 'react'; +import { useSetRecoilState } from 'recoil'; +import { agendaErrorState } from 'utils/recoil/agendaError'; import { useUser } from 'hooks/agenda/Layout/useUser'; const Index = () => { const router = useRouter(); const { intraId } = useUser() || {}; + const setError = useSetRecoilState(agendaErrorState); useEffect(() => { if (intraId) { router.push(`/agenda/profile/user?id=${intraId}`); } else { - router.push(`/`); + setError({ + msg: '로그인 정보가 만료되어 재로그인이 필요합니다.', + status: 401, + }); } - }, [intraId, router]); + }, [intraId, router, setError]); return null; }; From a0221ce7d8cd7dcd910b01f4325ee4e7a4fee584 Mon Sep 17 00:00:00 2001 From: Kimmy Haecho <118002501+siwolee@users.noreply.github.com> Date: Thu, 5 Sep 2024 16:02:55 +0900 Subject: [PATCH 08/28] =?UTF-8?q?fix:=20agenda=20useUser=20setError=20axio?= =?UTF-8?q?s=ED=95=B8=EB=93=A4=EB=9F=AC=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hooks/agenda/Layout/useUser.ts | 6 +----- utils/recoil/agendaError.ts | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/hooks/agenda/Layout/useUser.ts b/hooks/agenda/Layout/useUser.ts index f0f6e71ec..711121541 100644 --- a/hooks/agenda/Layout/useUser.ts +++ b/hooks/agenda/Layout/useUser.ts @@ -1,13 +1,10 @@ import { useQuery } from 'react-query'; -import { useSetRecoilState } from 'recoil'; import { User } from 'types/agenda/mainType'; import { instanceInAgenda } from 'utils/axios'; -import { errorState } from 'utils/recoil/error'; export const useUser = () => { - const setError = useSetRecoilState(errorState); const { data, isError } = useQuery( - 'user', + 'agendauser', () => instanceInAgenda.get('/profile/info').then((res) => { return res.data; @@ -18,7 +15,6 @@ export const useUser = () => { } ); if (isError) { - setError('JB02'); return undefined; } if (data) return data; diff --git a/utils/recoil/agendaError.ts b/utils/recoil/agendaError.ts index df813002c..801dfd9a5 100644 --- a/utils/recoil/agendaError.ts +++ b/utils/recoil/agendaError.ts @@ -1,12 +1,12 @@ import { atom } from 'recoil'; import { v1 } from 'uuid'; -interface ErrorState { +export interface ErrorStateType { msg: string; status: number; } -export const agendaErrorState = atom({ +export const agendaErrorState = atom({ key: `errorState/${v1()}`, default: { msg: '', status: 0 }, }); From e34fc68e6012b69cf0c013598ab066d8cd8039dd Mon Sep 17 00:00:00 2001 From: Kimmy Haecho <118002501+siwolee@users.noreply.github.com> Date: Thu, 5 Sep 2024 16:17:26 +0900 Subject: [PATCH 09/28] =?UTF-8?q?feat:=20GET=20400=20=EC=97=90=EB=9F=AC?= =?UTF-8?q?=EC=8B=9C=EC=97=90=EB=8F=84=20=EC=97=90=EB=9F=AC=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hooks/useAxiosAgendaError.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hooks/useAxiosAgendaError.ts b/hooks/useAxiosAgendaError.ts index 9c7b617cc..5c4a15135 100644 --- a/hooks/useAxiosAgendaError.ts +++ b/hooks/useAxiosAgendaError.ts @@ -54,6 +54,14 @@ export default function useAxiosAgendaError() { } } else return defaultReturn(); } + case 400: + if (error.config.method === 'get') { + setError({ + msg: '데이터를 가져올 수 없습니다.', + status: error.response.status, + }); + } + break; case 404: setError({ msg: '문제가 발생했습니다.', From af190af4391b0dfde6f9896f2f60749b38d96f5a Mon Sep 17 00:00:00 2001 From: Kimmy Haecho <118002501+siwolee@users.noreply.github.com> Date: Thu, 5 Sep 2024 16:18:34 +0900 Subject: [PATCH 10/28] =?UTF-8?q?fix:=20=EC=97=90=EB=9F=AC=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EC=9D=B4=EB=8F=99=20=ED=9B=84=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/error/AgendaError.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/components/error/AgendaError.tsx b/components/error/AgendaError.tsx index 07f4b8a83..be6e32eb0 100644 --- a/components/error/AgendaError.tsx +++ b/components/error/AgendaError.tsx @@ -17,9 +17,17 @@ export default function ErrorPage() { if (status === 401) { localStorage.removeItem('42gg-token'); setLoggedIn(false); - setError({ msg: '', status: 0 }); } + const resetHandler = () => { + if (status === 401) { + localStorage.removeItem('42gg-token'); + setLoggedIn(false); + } + setError({ msg: '', status: 0 }); + goHome(); + }; + useEffect(() => { resetModal(); }, []); @@ -40,7 +48,7 @@ export default function ErrorPage() {
-
+
From d4c7ac24fac9a7c3cf5e721e1990db41b3042885 Mon Sep 17 00:00:00 2001 From: irenee-14 Date: Thu, 5 Sep 2024 16:45:21 +0900 Subject: [PATCH 11/28] =?UTF-8?q?Style:=20=ED=81=B0=20=EA=B8=80=EC=94=A8?= =?UTF-8?q?=20=ED=81=AC=EA=B8=B0=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/MyAgendaBtn.module.scss | 2 +- styles/agenda/Home/MyTeamInfo.module.scss | 9 ++++----- styles/agenda/agendaDetail/AgendaInfo.module.scss | 2 +- styles/agenda/button/UploadBtn.module.scss | 2 +- styles/agenda/common.scss | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/styles/agenda/Home/MyAgendaBtn.module.scss b/styles/agenda/Home/MyAgendaBtn.module.scss index d45990402..7dfdf1bd6 100644 --- a/styles/agenda/Home/MyAgendaBtn.module.scss +++ b/styles/agenda/Home/MyAgendaBtn.module.scss @@ -78,7 +78,7 @@ flex-direction: column; overflow-y: scroll; align-items: flex-start; - gap: 1rem; + gap: 0.8rem; @media screen and (min-width: 961px) { display: flex; width: auto; diff --git a/styles/agenda/Home/MyTeamInfo.module.scss b/styles/agenda/Home/MyTeamInfo.module.scss index bd13c3eea..04f4e4f2e 100644 --- a/styles/agenda/Home/MyTeamInfo.module.scss +++ b/styles/agenda/Home/MyTeamInfo.module.scss @@ -2,7 +2,7 @@ .Container { display: flex; - max-width: 100%; + width: 16rem; padding: 0.5rem 1rem; background-color: var(--box-bg-1); border: var(--default-border); @@ -16,7 +16,7 @@ display: flex; width: 100%; flex-direction: column; - padding: 0.5rem; + padding: 0.4rem; justify-content: flex-start; } @@ -30,12 +30,11 @@ } .teamTitle { - @include text(sub-title); + @include text(tab); margin: 0; } .agendaTitle { - @include text(sub-title); + @include text(description-s); margin: 0; - font-family: $font-text-light; } diff --git a/styles/agenda/agendaDetail/AgendaInfo.module.scss b/styles/agenda/agendaDetail/AgendaInfo.module.scss index 89f492a00..de75e84d5 100644 --- a/styles/agenda/agendaDetail/AgendaInfo.module.scss +++ b/styles/agenda/agendaDetail/AgendaInfo.module.scss @@ -79,7 +79,7 @@ $info-gradient: linear-gradient( align-items: center; } .organizerWrap { - @include text('default'); // medium + @include text('description-s'); // medium display: flex; margin-right: auto; // UploadBtn과의 간격 확보 align-items: center; diff --git a/styles/agenda/button/UploadBtn.module.scss b/styles/agenda/button/UploadBtn.module.scss index 24966854e..a335ddc75 100644 --- a/styles/agenda/button/UploadBtn.module.scss +++ b/styles/agenda/button/UploadBtn.module.scss @@ -15,6 +15,6 @@ gap: 0.3rem; span { - @include text('tab'); + @include text(tab); } } diff --git a/styles/agenda/common.scss b/styles/agenda/common.scss index 8f323da11..0d987b143 100644 --- a/styles/agenda/common.scss +++ b/styles/agenda/common.scss @@ -157,7 +157,7 @@ $font-size-xs: 0.8rem; // $small-font } @else if ($type == 'date') { // 날짜 - 월,일 font-family: $font-text-bold; - font-size: $font-size-xl; + font-size: $font-size-l; } @else if ($type == 'sub-title') { // 아젠다 리스트 아이템 - 타이틀 font-family: $font-text-bold; From 6f0cb210ed5a10925f57918ac3b90361b96e574f Mon Sep 17 00:00:00 2001 From: irenee-14 Date: Thu, 5 Sep 2024 16:45:54 +0900 Subject: [PATCH 12/28] =?UTF-8?q?Style:=20global.css=20=EB=B0=98=EC=9D=91?= =?UTF-8?q?=ED=98=95=20font-size=20=EC=A1=B0=EC=A0=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- styles/globals.css | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/styles/globals.css b/styles/globals.css index db3167291..bf8fbc230 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -18,7 +18,7 @@ input { Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; font-weight: 500; } -/* +/* @media all and (max-width: 379px) { html { font-size: 14px; @@ -39,25 +39,25 @@ input { @media all and (min-width: 768px) { html { - font-size: 19px; + font-size: 17px; } } @media all and (min-width: 1024px) { html { - font-size: 20px; + font-size: 18px; } } @media all and (min-width: 1280px) { html { - font-size: 21px; + font-size: 19px; } } @media all and (min-width: 1440px) { html { - font-size: 22px; + font-size: 20px; } } From ecb01e119864cd656e71a1ee6272ca9c20fdde88 Mon Sep 17 00:00:00 2001 From: irenee-14 Date: Thu, 5 Sep 2024 16:46:16 +0900 Subject: [PATCH 13/28] =?UTF-8?q?Fix:=20=ED=99=80=EC=88=98=EC=9D=BC=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0=20participant=20width=20=EA=B3=A0=EC=A0=95?= =?UTF-8?q?=20=EC=95=88=EB=90=98=EB=8A=94=20=EB=B6=80=EB=B6=84=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 --- styles/agenda/agendaDetail/tabs/ParticipantsList.module.scss | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/styles/agenda/agendaDetail/tabs/ParticipantsList.module.scss b/styles/agenda/agendaDetail/tabs/ParticipantsList.module.scss index 1df198d0c..3ed14ef5c 100644 --- a/styles/agenda/agendaDetail/tabs/ParticipantsList.module.scss +++ b/styles/agenda/agendaDetail/tabs/ParticipantsList.module.scss @@ -13,9 +13,8 @@ } .participantsContainer { - display: flex; - justify-content: flex-start; - flex-wrap: wrap; + display: grid; + grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: 2rem; width: 100%; } From 3f87694bf456f2ef53bfd9210ccc2a104d0175e5 Mon Sep 17 00:00:00 2001 From: Lee Jeong Ron <83465749+JeongRon@users.noreply.github.com> Date: Thu, 5 Sep 2024 17:08:40 +0900 Subject: [PATCH 14/28] =?UTF-8?q?Fix:=20usePageNation=20/=20isReady=20prop?= =?UTF-8?q?s=EB=A1=9C=20=EA=B0=80=EC=A0=B8=EC=98=A4=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agendaDetail/tabs/AgendaAnnouncements.tsx | 1 + .../agendaDetail/tabs/ParticipantTeamList.tsx | 2 ++ .../agendaDetail/tabs/ParticipantsList.tsx | 1 + hooks/agenda/useIntraId.ts | 18 +++++++++++ hooks/agenda/usePageNation.ts | 26 ++++++++-------- pages/agenda/profile/user.tsx | 30 ++++++++++++++----- types/agenda/profile/profileCardTypes.ts | 2 +- 7 files changed, 58 insertions(+), 22 deletions(-) create mode 100644 hooks/agenda/useIntraId.ts diff --git a/components/agenda/agendaDetail/tabs/AgendaAnnouncements.tsx b/components/agenda/agendaDetail/tabs/AgendaAnnouncements.tsx index a8283b873..588c2555d 100644 --- a/components/agenda/agendaDetail/tabs/AgendaAnnouncements.tsx +++ b/components/agenda/agendaDetail/tabs/AgendaAnnouncements.tsx @@ -15,6 +15,7 @@ export default function AgendaAnnouncements() { url: `/announcement`, params: { agenda_key: agendaKey }, size: 5, + isReady: Boolean(agendaKey), }); if (!agendaKey || !content) { diff --git a/components/agenda/agendaDetail/tabs/ParticipantTeamList.tsx b/components/agenda/agendaDetail/tabs/ParticipantTeamList.tsx index 61676c904..d83aa1447 100644 --- a/components/agenda/agendaDetail/tabs/ParticipantTeamList.tsx +++ b/components/agenda/agendaDetail/tabs/ParticipantTeamList.tsx @@ -20,6 +20,7 @@ export default function ParticipantTeamList({ } = usePageNation({ url: `team/open/list`, params: { agenda_key: agendaKey }, + isReady: Boolean(agendaKey), }); const { @@ -28,6 +29,7 @@ export default function ParticipantTeamList({ } = usePageNation({ url: `team/confirm/list`, params: { agenda_key: agendaKey }, + isReady: Boolean(agendaKey), }); const noParticipants = ( diff --git a/components/agenda/agendaDetail/tabs/ParticipantsList.tsx b/components/agenda/agendaDetail/tabs/ParticipantsList.tsx index 8b1496673..d3e735ee5 100644 --- a/components/agenda/agendaDetail/tabs/ParticipantsList.tsx +++ b/components/agenda/agendaDetail/tabs/ParticipantsList.tsx @@ -16,6 +16,7 @@ export default function ParticipantsList({ max }: numberProps) { usePageNation({ url: `team/confirm/list`, params: { agenda_key: agendaKey }, + isReady: Boolean(agendaKey), }); const curPeople = participants ? participants.length : 0; diff --git a/hooks/agenda/useIntraId.ts b/hooks/agenda/useIntraId.ts new file mode 100644 index 000000000..84efb902b --- /dev/null +++ b/hooks/agenda/useIntraId.ts @@ -0,0 +1,18 @@ +import { useRouter } from 'next/router'; +import { useEffect, useState } from 'react'; + +const useIntraId = () => { + const router = useRouter(); + const [intraId, setIntraId] = useState(undefined); + + useEffect(() => { + if (router.isReady) { + const id = router.query.id as string; + setIntraId(id); + } + }, [router.isReady, router.query.id]); + + return intraId; +}; + +export default useIntraId; diff --git a/hooks/agenda/usePageNation.ts b/hooks/agenda/usePageNation.ts index d07607899..c22888734 100644 --- a/hooks/agenda/usePageNation.ts +++ b/hooks/agenda/usePageNation.ts @@ -1,34 +1,32 @@ import { useEffect, useRef, useState, useCallback } from 'react'; import { instanceInAgenda } from 'utils/axios'; -const usePageNation = ({ - url, - size = 20, - useIdx, - params, -}: { +interface PageNationProps { url: string; params?: Record; size?: number; // 페이지 사이즈 + isReady?: boolean; // API 호출 가능 상태 확인 useIdx?: boolean; // 인덱싱 추가 여부 -}) => { +} + +const usePageNation = ({ + url, + params, + size = 20, + isReady, + useIdx, +}: PageNationProps) => { const currentPage = useRef(1); const [content, setContent] = useState(null); const status = useRef(0); const totalPages = useRef(1); - // 기본 파라미터 설정 - if (!size) size = 20; params = params || {}; params.page = currentPage.current; params.size = size; const getData = useCallback( async (page: number, size: number) => { - if (params && params.agenda_key === undefined) { - return { content: null }; - } - const res = await instanceInAgenda.get(url, { params }); const content = res.data.content ? res.data.content : []; const totalSize = res.data.totalSize ? res.data.totalSize : 0; @@ -62,7 +60,7 @@ const usePageNation = ({ }; if ( - (!params || params.agenda_key) && + isReady == true && (!status.current || Math.floor(status.current / 100) !== 2) ) { fetchData(); diff --git a/pages/agenda/profile/user.tsx b/pages/agenda/profile/user.tsx index f336d55fd..51591df0a 100644 --- a/pages/agenda/profile/user.tsx +++ b/pages/agenda/profile/user.tsx @@ -1,4 +1,4 @@ -import { useRouter } from 'next/router'; +import { useState, useEffect } from 'react'; import { MyTeamDataProps } from 'types/agenda/agendaDetail/agendaTypes'; import { HistoryItemProps } from 'types/agenda/profile/historyListTypes'; import { ProfileDataProps } from 'types/agenda/profile/profileDataTypes'; @@ -11,18 +11,31 @@ import AgendaLoading from 'components/agenda/utils/AgendaLoading'; import PageNation from 'components/Pagination'; import { useUser } from 'hooks/agenda/Layout/useUser'; import useFetchGet from 'hooks/agenda/useFetchGet'; +import useIntraId from 'hooks/agenda/useIntraId'; import usePageNation from 'hooks/agenda/usePageNation'; import styles from 'styles/agenda/Profile/AgendaProfile.module.scss'; const AgendaProfile = () => { - const intraId = useRouter().query.id; + const intraId = useIntraId(); // 쿼리의 id const userIntraId = useUser()?.intraId; // 현재 나의 intraId - const isMyProfile = intraId === userIntraId ? true : false; + const [profileUrl, setProfileUrl] = useState('/profile'); + const [myProfileCheck, setMyProfileCheck] = useState(null); + + useEffect(() => { + if (intraId && userIntraId) { + if (intraId === userIntraId) { + setMyProfileCheck(true); + } else { + setProfileUrl(`/profile/${intraId}`); + setMyProfileCheck(false); + } + } + }, [intraId, userIntraId]); /** API GET */ const { data: profileData, getData: getProfileData } = useFetchGet({ - url: isMyProfile ? '/profile' : `/profile/${intraId}`, + url: profileUrl, }); // host current @@ -31,6 +44,7 @@ const AgendaProfile = () => { PagaNationElementProps: PagaNationHostCurrent, } = usePageNation({ url: `/host/current/list/${intraId}`, + isReady: Boolean(intraId), }); // current team @@ -44,6 +58,7 @@ const AgendaProfile = () => { PagaNationElementProps: PagaNationHostHistory, } = usePageNation({ url: `/host/history/list/${intraId}`, + isReady: Boolean(intraId), }); // history @@ -52,6 +67,7 @@ const AgendaProfile = () => { PagaNationElementProps: PagaNationHistory, } = usePageNation({ url: `/profile/history/list/${intraId}`, + isReady: Boolean(intraId), }); if (!intraId || !userIntraId) { @@ -73,11 +89,11 @@ const AgendaProfile = () => { imageUrl={profileData.imageUrl} achievements={profileData.achievements} getProfileData={getProfileData} - isMyProfile={isMyProfile} + isMyProfile={myProfileCheck} /> )} {/* Ticket */} - {isMyProfile ? : ''} + {myProfileCheck ? : ''} {/* Host Current List */} {hostCurrentListData && hostCurrentListData.length > 0 ? ( <> @@ -88,7 +104,7 @@ const AgendaProfile = () => { '' )} {/* Current List */} - {isMyProfile && currentListData ? ( + {myProfileCheck && currentListData ? ( ) : ( '' diff --git a/types/agenda/profile/profileCardTypes.ts b/types/agenda/profile/profileCardTypes.ts index 77d014215..7edf51c8d 100644 --- a/types/agenda/profile/profileCardTypes.ts +++ b/types/agenda/profile/profileCardTypes.ts @@ -7,5 +7,5 @@ export interface ProfileCardProps { imageUrl: string; achievements: AchievementProps[]; getProfileData: () => void; - isMyProfile: boolean; + isMyProfile: boolean | null; } From ebfd29a9cc8c74fa1661f2763dc50dfcbc7bb208 Mon Sep 17 00:00:00 2001 From: Kimmy Haecho <118002501+siwolee@users.noreply.github.com> Date: Thu, 5 Sep 2024 17:12:08 +0900 Subject: [PATCH 15/28] =?UTF-8?q?style:=20=EB=A9=94=EB=89=B4=EB=B0=94=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=95=84=EC=9B=83=20=EC=95=88=EB=B3=B4?= =?UTF-8?q?=EC=9E=84=20=EB=AC=B8=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- styles/agenda/Layout/MenuBar.module.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/styles/agenda/Layout/MenuBar.module.scss b/styles/agenda/Layout/MenuBar.module.scss index bd90d9b43..c869b7155 100644 --- a/styles/agenda/Layout/MenuBar.module.scss +++ b/styles/agenda/Layout/MenuBar.module.scss @@ -7,6 +7,7 @@ min-width: 200px; height: calc(100vh - 4rem); padding: 1rem; + overflow-y: auto; background: var(--menubar-bg); } .inactive { @@ -37,7 +38,7 @@ align-items: center; } .last { - margin-top: 4rem; + margin-top: 2rem; } .content { From 137a9f0645813824c20e427ce85bc9ea598aa2c5 Mon Sep 17 00:00:00 2001 From: Lee Jeong Ron <83465749+JeongRon@users.noreply.github.com> Date: Thu, 5 Sep 2024 17:19:54 +0900 Subject: [PATCH 16/28] =?UTF-8?q?Fix:=20=EB=9D=BC=EC=9A=B0=ED=8C=85=20url?= =?UTF-8?q?=20=EC=9E=98=EB=AA=BB=EB=90=9C=20=EB=B6=80=EB=B6=84=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20+=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20key=EA=B0=92=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 --- components/agenda/Profile/HistoryList.tsx | 130 +++++++++++----------- 1 file changed, 67 insertions(+), 63 deletions(-) diff --git a/components/agenda/Profile/HistoryList.tsx b/components/agenda/Profile/HistoryList.tsx index 4ecc6bd59..ab04b3300 100644 --- a/components/agenda/Profile/HistoryList.tsx +++ b/components/agenda/Profile/HistoryList.tsx @@ -41,80 +41,84 @@ const HistoryList = ({ historyListData, isHost }: HistoryListProps) => {
{historyTitle}
{historyListData.length > 0 ? ( - historyListData.map((historyData: HistoryItemProps) => { - const { - historyTeamMates, - totalPeople, - peopleCount, - startTime, - endTime, - timeString, - } = parsingHistoryData(historyData); + historyListData.map( + (historyData: HistoryItemProps, index: number) => { + const { + historyTeamMates, + totalPeople, + peopleCount, + startTime, + endTime, + timeString, + } = parsingHistoryData(historyData); - return ( - -
- {historyData.agendaTitle} -
- -
- {/* PROGRESS : tag mapping */} - {historyData.isOfficial ? ( - - ) : ( - - )} - -
+ return ( + +
+ {historyData.agendaTitle} +
-
-
- +
+ {/* PROGRESS : tag mapping */} + {historyData.isOfficial ? ( + + ) : ( + + )} +
-
{timeString}
-
+
+
+ +
- {/* Team 정보 UI / host 경우 ❌ */} - {historyTeamMates && historyTeamMates.length > 0 ? ( - <> -
+
{timeString}
+
-
- {historyData.teamName} -
+ {/* Team 정보 UI / host 경우 ❌ */} + {historyTeamMates && historyTeamMates.length > 0 ? ( + <> +
-
-
- +
+ {historyData.teamName}
- {/* intra id mapping */} -
- {historyTeamMates.map((mate) => ( -
- {mate.intraId} -
- ))} +
+
+ +
+ + {/* intra id mapping */} +
+ {historyTeamMates.map((mate, index) => ( +
+ {mate.intraId} +
+ ))} +
-
- {/* coalition color mapping */} -
- -
- - ) : null} - - ); - }) + {/* coalition color mapping */} +
+ +
+ + ) : null} + + ); + } + ) ) : (
아젠다 기록이 없습니다.
)} From d55bc54a9184948402d1addd2c248771973a9b08 Mon Sep 17 00:00:00 2001 From: Kimmy Haecho <118002501+siwolee@users.noreply.github.com> Date: Thu, 5 Sep 2024 18:50:08 +0900 Subject: [PATCH 17/28] =?UTF-8?q?style:=20web:=20=EB=8B=A8=EC=9D=BC=20?= =?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EC=A2=8C=EC=9A=B0=EC=97=AC=EB=B0=B1=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hooks/useAxiosResponse.ts | 2 +- styles/agenda/Home/Agenda.module.scss | 2 +- styles/agenda/agendaDetail/AgendaDetail.module.scss | 5 ++--- styles/agenda/pages/CreateAgenda.module.scss | 6 ++++-- styles/agenda/responsive.scss | 7 +++---- styles/agenda/utils/PageController.module.scss | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/hooks/useAxiosResponse.ts b/hooks/useAxiosResponse.ts index 94e563da0..7a43a5299 100644 --- a/hooks/useAxiosResponse.ts +++ b/hooks/useAxiosResponse.ts @@ -19,7 +19,7 @@ export default function useAxiosResponse() { ); localStorage.setItem('42gg-token', res.data.accessToken); } catch (error) { - // setError('SW05'); + setError('SW05'); } }; diff --git a/styles/agenda/Home/Agenda.module.scss b/styles/agenda/Home/Agenda.module.scss index 90c140e0e..508f0f6d5 100644 --- a/styles/agenda/Home/Agenda.module.scss +++ b/styles/agenda/Home/Agenda.module.scss @@ -14,7 +14,7 @@ @include layout; position: relative; top: -1rem; - display: flex; + display: flex !important; width: 100%; flex-direction: column; padding: 1rem 0; diff --git a/styles/agenda/agendaDetail/AgendaDetail.module.scss b/styles/agenda/agendaDetail/AgendaDetail.module.scss index 90ee627e1..9923e035f 100644 --- a/styles/agenda/agendaDetail/AgendaDetail.module.scss +++ b/styles/agenda/agendaDetail/AgendaDetail.module.scss @@ -1,17 +1,16 @@ @import 'styles/agenda/common.scss'; .layout { - @include layout; grid-template: 'top top top top' 450px 'content content match match' auto / 1fr 1fr 1fr 1fr; - max-width: 100%; - padding-top: 1px; } .agendaDetailWrap { @include pageContainer; + max-width: 100%; height: 100%; + padding: 0 5rem; } .headWrapper { // @include gridHidden(web); diff --git a/styles/agenda/pages/CreateAgenda.module.scss b/styles/agenda/pages/CreateAgenda.module.scss index 97c4639cd..e8f7d5efc 100644 --- a/styles/agenda/pages/CreateAgenda.module.scss +++ b/styles/agenda/pages/CreateAgenda.module.scss @@ -1,13 +1,15 @@ @import 'styles/agenda/Form/Form.module.scss'; .pageContainer { - @include pageContainer; + @include layout; + display: flex !important; } .container { @include container(1); + max-width: 50rem; padding: 0.5rem; - @include text('default'); text-align: left; + @include text('default'); } .cancelBtn { diff --git a/styles/agenda/responsive.scss b/styles/agenda/responsive.scss index 49816a426..dc5dfcd9d 100644 --- a/styles/agenda/responsive.scss +++ b/styles/agenda/responsive.scss @@ -31,23 +31,21 @@ @include action; width: 100%; height: max-content; + justify-content: center; @media screen and (max-width: 480px) { display: flex; flex-direction: column; - // border: 2px solid red; } @media screen and (min-width: 481px) and (max-width: 960px) { display: flex; flex-direction: column; - // padding: 0 5rem; - // border: 2px solid blue; } @media screen and (min-width: 961px) { display: grid; padding: 0 5rem; - // border: 2px solid yellow; } } + @mixin pageContainer { @include action; display: flex; @@ -61,6 +59,7 @@ } @media screen and (min-width: 961px) { height: 100%; + padding: 0 5rem; } } diff --git a/styles/agenda/utils/PageController.module.scss b/styles/agenda/utils/PageController.module.scss index 93ad536b2..fe83278c2 100644 --- a/styles/agenda/utils/PageController.module.scss +++ b/styles/agenda/utils/PageController.module.scss @@ -4,9 +4,9 @@ width: 100%; height: max-content; @include pageContainer; + padding: 0 1rem !important; @media screen and (max-width: 960px) { height: 90%; - padding: 0 1rem !important; } } From d6b9836b6f30e603c9a5ca9bbc46e73f11de517b Mon Sep 17 00:00:00 2001 From: Kimmy Haecho <118002501+siwolee@users.noreply.github.com> Date: Thu, 5 Sep 2024 18:52:45 +0900 Subject: [PATCH 18/28] =?UTF-8?q?style:=20=EC=BB=AC=EB=9F=AC=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 --- styles/agenda/Layout/Layout.module.scss | 6 ++++-- styles/agenda/button/TabButton.module.scss | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/styles/agenda/Layout/Layout.module.scss b/styles/agenda/Layout/Layout.module.scss index 33aea57d6..04c0b29bc 100644 --- a/styles/agenda/Layout/Layout.module.scss +++ b/styles/agenda/Layout/Layout.module.scss @@ -29,13 +29,15 @@ color: white; cursor: pointer; - background-color: var(--highlight-yellow); + background-color: var(--highlight-violet); border: none; border-radius: $radius-circle; box-shadow: var(--box-shadow-light); transition: background-color 0.3s; &:hover { - background-color: var(--highlight-violet); + width: 3rem; + height: 3rem; + animation: all 1s; } } diff --git a/styles/agenda/button/TabButton.module.scss b/styles/agenda/button/TabButton.module.scss index 67269f44a..58ad88f11 100644 --- a/styles/agenda/button/TabButton.module.scss +++ b/styles/agenda/button/TabButton.module.scss @@ -21,7 +21,7 @@ } &.isActive { - background: var(--highlight-yellow); + background: var(--highlight-violet); } } From 296e37d7448331b54be2dd1495c4272c5101b9b8 Mon Sep 17 00:00:00 2001 From: Kimmy Haecho <118002501+siwolee@users.noreply.github.com> Date: Thu, 5 Sep 2024 19:31:52 +0900 Subject: [PATCH 19/28] =?UTF-8?q?style:=20button=20=EC=95=A0=EB=8B=88?= =?UTF-8?q?=EB=A9=94=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- styles/agenda/Layout/Layout.module.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/styles/agenda/Layout/Layout.module.scss b/styles/agenda/Layout/Layout.module.scss index 04c0b29bc..64246b756 100644 --- a/styles/agenda/Layout/Layout.module.scss +++ b/styles/agenda/Layout/Layout.module.scss @@ -38,6 +38,7 @@ &:hover { width: 3rem; height: 3rem; + transform: translate(10%, 10%); animation: all 1s; } } From b1d1cdcf78cf33ad6513395a26ad57bcc9ea4929 Mon Sep 17 00:00:00 2001 From: Kimmy Haecho <118002501+siwolee@users.noreply.github.com> Date: Thu, 5 Sep 2024 20:18:43 +0900 Subject: [PATCH 20/28] =?UTF-8?q?feat:=20=EA=B0=9C=EB=B0=9C=EC=8B=9C=20?= =?UTF-8?q?=ED=86=A0=ED=81=B0=20=ED=8E=B8=ED=95=98=EA=B2=8C=20=EB=84=A3?= =?UTF-8?q?=EB=8A=94=20=EB=B6=80=EB=B6=84=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/error/AgendaError.tsx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/components/error/AgendaError.tsx b/components/error/AgendaError.tsx index be6e32eb0..0b8995dc2 100644 --- a/components/error/AgendaError.tsx +++ b/components/error/AgendaError.tsx @@ -3,6 +3,7 @@ import { useRecoilState, useResetRecoilState, useSetRecoilState } 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'; import styles from 'styles/takgu/Error.module.scss'; import ErrorEmoji from '/public/image/takgu/error_face.svg'; @@ -13,6 +14,7 @@ export default function ErrorPage() { const { msg, status } = error; const setLoggedIn = useSetRecoilState(loginState); const resetModal = useResetRecoilState(modalState); + const router = useRouter(); if (status === 401) { localStorage.removeItem('42gg-token'); @@ -53,6 +55,30 @@ export default function ErrorPage() {
+ {/* 개발용 토큰 넣기 버튼 */} + {process.env.NODE_ENV === 'development' && status === 401 ? ( + <> + + + + ) : null}
); From 37f26001ceaf3fdd51f1482fe6e7bb6b501792ca Mon Sep 17 00:00:00 2001 From: Kimmy Haecho <118002501+siwolee@users.noreply.github.com> Date: Thu, 5 Sep 2024 20:19:51 +0900 Subject: [PATCH 21/28] =?UTF-8?q?fix:=20=20=EB=A6=AC=ED=94=84=EB=A0=88?= =?UTF-8?q?=EC=8B=9C=20=ED=86=A0=ED=81=B0=20=EB=AC=B4=ED=95=9C=EB=B0=98?= =?UTF-8?q?=EB=B3=B5=20=EC=97=90=EB=9F=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hooks/useAxiosAgendaError.ts | 5 +++-- hooks/useAxiosResponse.ts | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hooks/useAxiosAgendaError.ts b/hooks/useAxiosAgendaError.ts index 5c4a15135..d1dd46e64 100644 --- a/hooks/useAxiosAgendaError.ts +++ b/hooks/useAxiosAgendaError.ts @@ -13,7 +13,9 @@ export default function useAxiosAgendaError() { const refreshToken = Cookies.get('refresh_token') || ''; const accessTokenHandler = async () => { - console.log('accessTokenHandler'); + if (!refreshToken) { + return; + } try { const res = await instanceInAgenda.post( `/pingpong/users/accesstoken?refreshToken=${refreshToken}` @@ -25,7 +27,6 @@ export default function useAxiosAgendaError() { }; const errorResponseHandler = async (error: AxiosError) => { - console.log('errorResponseHandler', error); const defaultReturn = () => { if (isRecalling === true) { setLogin(false); diff --git a/hooks/useAxiosResponse.ts b/hooks/useAxiosResponse.ts index 94e563da0..534be16c6 100644 --- a/hooks/useAxiosResponse.ts +++ b/hooks/useAxiosResponse.ts @@ -13,13 +13,16 @@ export default function useAxiosResponse() { const refreshToken = Cookies.get('refresh_token') || ''; const accessTokenHandler = async () => { + if (!refreshToken) { + return; + } try { const res = await instance.post( `/pingpong/users/accesstoken?refreshToken=${refreshToken}` ); localStorage.setItem('42gg-token', res.data.accessToken); } catch (error) { - // setError('SW05'); + setError('SW05'); } }; From d4a0f6b49bb38fa590951a2118a32b2404f168e6 Mon Sep 17 00:00:00 2001 From: Kimmy Haecho <118002501+siwolee@users.noreply.github.com> Date: Thu, 5 Sep 2024 20:23:06 +0900 Subject: [PATCH 22/28] =?UTF-8?q?style:=20tag=20=EC=97=AC=EB=B0=B1=20?= =?UTF-8?q?=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- styles/agenda/utils/AgendaTag.module.scss | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/styles/agenda/utils/AgendaTag.module.scss b/styles/agenda/utils/AgendaTag.module.scss index 5e4ccacb8..d3ebf8d22 100644 --- a/styles/agenda/utils/AgendaTag.module.scss +++ b/styles/agenda/utils/AgendaTag.module.scss @@ -22,8 +22,10 @@ $tags: ( .agendaTag { display: flex; - width: 3.3rem; + width: max-content; + min-width: 3.3rem; height: 1.2rem; + padding: 0.2rem 0.5rem; color: var(--color-text-reverse); border-radius: $radius-medium; justify-content: center; @@ -33,9 +35,10 @@ $tags: ( .defaultTag { display: flex; - width: 3.3rem; + width: max-content; + min-width: 3.3rem; height: 1.2rem; - padding: 0.2rem; + padding: 0.2rem 0.5rem; background-color: var(--box-bg-2-light); border-radius: $radius-medium; From 6b47dee22d31c9292c103aa1d68a14dc6bb0b2ab Mon Sep 17 00:00:00 2001 From: Kimmy Haecho <118002501+siwolee@users.noreply.github.com> Date: Thu, 5 Sep 2024 21:52:46 +0900 Subject: [PATCH 23/28] =?UTF-8?q?fix:=20400=20404=20=EC=97=90=EB=9F=AC?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=EC=9D=B4=EB=8F=99=20=EC=B7=A8?= =?UTF-8?q?=EC=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hooks/useAxiosAgendaError.ts | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/hooks/useAxiosAgendaError.ts b/hooks/useAxiosAgendaError.ts index d1dd46e64..db5216a79 100644 --- a/hooks/useAxiosAgendaError.ts +++ b/hooks/useAxiosAgendaError.ts @@ -55,20 +55,6 @@ export default function useAxiosAgendaError() { } } else return defaultReturn(); } - case 400: - if (error.config.method === 'get') { - setError({ - msg: '데이터를 가져올 수 없습니다.', - status: error.response.status, - }); - } - break; - case 404: - setError({ - msg: '문제가 발생했습니다.', - status: error.response.status, - }); - break; case 500: setError({ msg: '서버 오류가 발생했습니다', From 96dedb383b60538094ba27873d51171621520eda Mon Sep 17 00:00:00 2001 From: Kimmy Haecho <118002501+siwolee@users.noreply.github.com> Date: Thu, 5 Sep 2024 21:53:45 +0900 Subject: [PATCH 24/28] =?UTF-8?q?fix:=20=ED=83=81=EA=B5=AC=20useUser=20?= =?UTF-8?q?=EC=85=8B=EC=97=90=EB=9F=AC=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EC=9E=AC=EA=B0=80=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hooks/takgu/Layout/useUser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/takgu/Layout/useUser.ts b/hooks/takgu/Layout/useUser.ts index 2b4677062..4647109e9 100644 --- a/hooks/takgu/Layout/useUser.ts +++ b/hooks/takgu/Layout/useUser.ts @@ -15,7 +15,7 @@ export const useUser = () => { } ); if (isError) { - // setError('JB02'); + setError('JB02'); return undefined; } if (data) return data; From 88f0811fe463b1b41741638443c716239bc5247f Mon Sep 17 00:00:00 2001 From: Kimmy Haecho <118002501+siwolee@users.noreply.github.com> Date: Thu, 5 Sep 2024 21:57:32 +0900 Subject: [PATCH 25/28] =?UTF-8?q?feat:=20intra/agenda=20profile=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/agenda/Profile/ProfileCard.tsx | 42 +++++++++-------- pages/agenda/profile/user.tsx | 57 +++++++++++++++-------- types/agenda/profile/profileDataTypes.ts | 19 ++++---- 3 files changed, 70 insertions(+), 48 deletions(-) diff --git a/components/agenda/Profile/ProfileCard.tsx b/components/agenda/Profile/ProfileCard.tsx index f25918e1f..c968c8bc0 100644 --- a/components/agenda/Profile/ProfileCard.tsx +++ b/components/agenda/Profile/ProfileCard.tsx @@ -196,26 +196,28 @@ const ProfileCard = ({
Acheivements
- {achievements.map((data, index) => { - const imageUrl = data.image; - - if (imageUrl) { - const parsedUrl = imageUrl.replace( - '/uploads', - 'https://cdn.intra.42.fr' - ); - - return ( -
- -
- ); - } - return null; - })} + {achievements.length + ? achievements.map((data, index) => { + const imageUrl = data.image; + + if (imageUrl) { + const parsedUrl = imageUrl.replace( + '/uploads', + 'https://cdn.intra.42.fr' + ); + + return ( +
+ +
+ ); + } + return null; + }) + : ''}
diff --git a/pages/agenda/profile/user.tsx b/pages/agenda/profile/user.tsx index e0af8b3d9..13d903642 100644 --- a/pages/agenda/profile/user.tsx +++ b/pages/agenda/profile/user.tsx @@ -1,7 +1,10 @@ -import { useState, useEffect } from 'react'; +import { useState, useEffect, useRef } from 'react'; import { MyTeamDataProps } from 'types/agenda/agendaDetail/agendaTypes'; import { HistoryItemProps } from 'types/agenda/profile/historyListTypes'; -import { ProfileDataProps } from 'types/agenda/profile/profileDataTypes'; +import { + AgendaProfileDataProps, + IntraProfileDataProps, +} from 'types/agenda/profile/profileDataTypes'; import AgendaUserSearchBar from 'components/agenda/Profile/AgendaUserSearchBar'; import CurrentList from 'components/agenda/Profile/CurrentList'; import HistoryList from 'components/agenda/Profile/HistoryList'; @@ -20,6 +23,8 @@ const AgendaProfile = () => { const userIntraId = useUser()?.intraId; // 현재 나의 intraId const [profileUrl, setProfileUrl] = useState('/profile'); const [myProfileCheck, setMyProfileCheck] = useState(null); + const isIntraId = useRef(false); // 인트라 아이디가 42에 있는지 확인 + const isAgendaId = useRef(false); // 인트라 아이디가 agenda에 있는지 확인 useEffect(() => { if (intraId && userIntraId) { @@ -31,18 +36,27 @@ const AgendaProfile = () => { } } }, [intraId, userIntraId]); + const { data: intraData, getData: getIntraData } = + useFetchGet({ + url: `/profile/intra/${intraId}`, + isReady: Boolean(intraId), + }); - /** API GET */ - const { data: profileData, getData: getProfileData } = - useFetchGet({ + /** Agenda API GET */ + const { data: agendaProfileData, getData: getAgendaProfileData } = + useFetchGet({ url: profileUrl, + // 본인이거나 42에 아이디가 있는 경우에만 데이터 요청 + isReady: Boolean( + intraId === userIntraId || (intraId && isIntraId.current) + ), }); - useEffect(() => { - if (intraId) { - getProfileData(); - } - }, [intraId]); + // useEffect(() => { + // if (intraId) { + // getProfileData(); + // } + // }, [intraId]); // host current const { @@ -50,7 +64,7 @@ const AgendaProfile = () => { PagaNationElementProps: PagaNationHostCurrent, } = usePageNation({ url: `/host/current/list/${intraId}`, - isReady: Boolean(intraId), + isReady: Boolean(intraId && isAgendaId.current), }); // current team @@ -64,7 +78,7 @@ const AgendaProfile = () => { PagaNationElementProps: PagaNationHostHistory, } = usePageNation({ url: `/host/history/list/${intraId}`, - isReady: Boolean(intraId), + isReady: Boolean(intraId && isAgendaId.current), }); // history @@ -73,7 +87,7 @@ const AgendaProfile = () => { PagaNationElementProps: PagaNationHistory, } = usePageNation({ url: `/profile/history/list/${intraId}`, - isReady: Boolean(intraId), + isReady: Boolean(intraId && isAgendaId.current), }); if (!intraId || !userIntraId) { @@ -87,14 +101,17 @@ const AgendaProfile = () => {
{/* ProfileCard */} - {profileData && ( + {intraData && ( )} diff --git a/types/agenda/profile/profileDataTypes.ts b/types/agenda/profile/profileDataTypes.ts index 7f83cbf5b..71027ec30 100644 --- a/types/agenda/profile/profileDataTypes.ts +++ b/types/agenda/profile/profileDataTypes.ts @@ -1,14 +1,9 @@ import { AgendaLocation, Coalition } from 'constants/agenda/agenda'; -export interface ProfileDataProps { - achievements: AchievementProps[]; +export interface IntraProfileDataProps { + intraId: string; imageUrl: string; - ticketCount: number; - userCoalition: Coalition; - userContent: string; - userGithub: string; - userIntraId: string; - userLocation: AgendaLocation; + achievements: AchievementProps[]; } export interface LoginInfoDataProps { @@ -27,3 +22,11 @@ export interface AchievementProps { users_url: string; visible: boolean; } + +export interface AgendaProfileDataProps { + userIntraId: string; + userContent: string; //50자 이내 + userGithub: string; + userCoalition: string; // ENUM 상단확인 + userLocation: string; // 혹시나 서울/경산 이외 들어울 경우 예외처리 +} From 4feb7c31ecd875f14632843f2a9ae402a6f3c99f Mon Sep 17 00:00:00 2001 From: Kimmy Haecho <118002501+siwolee@users.noreply.github.com> Date: Thu, 5 Sep 2024 22:25:41 +0900 Subject: [PATCH 26/28] =?UTF-8?q?fix:=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20=EC=8B=9C=20=EC=BD=98=ED=85=90=EC=B8=A0=20?= =?UTF-8?q?=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8=20=EC=95=88=20=EB=90=98?= =?UTF-8?q?=EB=8A=94=20=EB=AC=B8=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/agenda/Profile/ProfileCard.tsx | 11 +++++++++-- pages/agenda/profile/user.tsx | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/components/agenda/Profile/ProfileCard.tsx b/components/agenda/Profile/ProfileCard.tsx index c968c8bc0..6c6ffa65b 100644 --- a/components/agenda/Profile/ProfileCard.tsx +++ b/components/agenda/Profile/ProfileCard.tsx @@ -96,6 +96,7 @@ const ProfileCard = ({ name='userContent' maxLength={50} wrap='soft' + key={userIntraId} value={profileData.userContent} placeholder='상태 메시지를 입력하세요.' className={styles.editDescription} @@ -180,6 +181,7 @@ const ProfileCard = ({ href={`https://profile.intra.42.fr/users/${userIntraId}`} target='_blank' rel='noopener noreferrer' + key={userIntraId} > @@ -188,14 +190,19 @@ const ProfileCard = ({
-
{userContent}
+
+ {userContent} +

Acheivements
-
+
{achievements.length ? achievements.map((data, index) => { const imageUrl = data.image; diff --git a/pages/agenda/profile/user.tsx b/pages/agenda/profile/user.tsx index 13d903642..48325ee8a 100644 --- a/pages/agenda/profile/user.tsx +++ b/pages/agenda/profile/user.tsx @@ -101,7 +101,7 @@ const AgendaProfile = () => {
{/* ProfileCard */} - {intraData && ( + {intraData && intraId && ( Date: Thu, 5 Sep 2024 22:26:18 +0900 Subject: [PATCH 27/28] =?UTF-8?q?Style:=20myAgenda=20=EB=B0=B0=EC=97=B4=20?= =?UTF-8?q?grid=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20profileCard=20?= =?UTF-8?q?achievements=20=EC=B2=B4=ED=81=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/agenda/Profile/ProfileCard.tsx | 41 +++++++++++----------- styles/agenda/Home/MyAgendaBtn.module.scss | 6 ++-- styles/agenda/Home/MyTeamInfo.module.scss | 2 +- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/components/agenda/Profile/ProfileCard.tsx b/components/agenda/Profile/ProfileCard.tsx index f25918e1f..3f86a5702 100644 --- a/components/agenda/Profile/ProfileCard.tsx +++ b/components/agenda/Profile/ProfileCard.tsx @@ -196,26 +196,27 @@ const ProfileCard = ({
Acheivements
- {achievements.map((data, index) => { - const imageUrl = data.image; - - if (imageUrl) { - const parsedUrl = imageUrl.replace( - '/uploads', - 'https://cdn.intra.42.fr' - ); - - return ( -
- -
- ); - } - return null; - })} + {achievements && + achievements.map((data, index) => { + const imageUrl = data.image; + + if (imageUrl) { + const parsedUrl = imageUrl.replace( + '/uploads', + 'https://cdn.intra.42.fr' + ); + + return ( +
+ +
+ ); + } + return null; + })}
diff --git a/styles/agenda/Home/MyAgendaBtn.module.scss b/styles/agenda/Home/MyAgendaBtn.module.scss index 7dfdf1bd6..51b8d7f4a 100644 --- a/styles/agenda/Home/MyAgendaBtn.module.scss +++ b/styles/agenda/Home/MyAgendaBtn.module.scss @@ -72,7 +72,9 @@ } .myAgendaListContainer { - display: flex; + display: grid; + grid-template-columns: repeat(auto-fill, minmax(16rem, 3fr)); + width: 100%; height: 23rem; flex-direction: column; @@ -80,7 +82,7 @@ align-items: flex-start; gap: 0.8rem; @media screen and (min-width: 961px) { - display: flex; + display: grid; width: auto; height: auto; flex-direction: row; diff --git a/styles/agenda/Home/MyTeamInfo.module.scss b/styles/agenda/Home/MyTeamInfo.module.scss index 04f4e4f2e..65a31b08c 100644 --- a/styles/agenda/Home/MyTeamInfo.module.scss +++ b/styles/agenda/Home/MyTeamInfo.module.scss @@ -2,7 +2,7 @@ .Container { display: flex; - width: 16rem; + width: 100%; padding: 0.5rem 1rem; background-color: var(--box-bg-1); border: var(--default-border); From 99f324c25488a79f66007ead2d3d6d7457323851 Mon Sep 17 00:00:00 2001 From: Junho Jeon Date: Thu, 5 Sep 2024 22:43:34 +0900 Subject: [PATCH 28/28] =?UTF-8?q?fix:=20=EC=BF=BC=EB=A6=AC=ED=81=B4?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EC=96=B8=ED=8A=B8=20=EC=BA=90=EC=8B=B1=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98:=20=EC=9E=AC=EC=83=9D=EC=84=B1=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=ED=81=B4=EB=9D=BC=EC=9D=B4=EC=96=B8=ED=8A=B8=20?= =?UTF-8?q?=EC=9C=A0=EC=A7=80=EA=B0=80=20=EB=90=98=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EC=95=98=EC=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/_app.tsx | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/pages/_app.tsx b/pages/_app.tsx index cc9cc1c37..3437c026f 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -2,7 +2,7 @@ import type { AppProps } from 'next/app'; import Head from 'next/head'; import { useRouter } from 'next/router'; import Script from 'next/script'; -import { useEffect } from 'react'; +import { useEffect, useState } from 'react'; import { QueryClient, QueryClientProvider } from 'react-query'; import { RecoilRoot } from 'recoil'; import ErrorChecker from 'components/error/ErrorChecker'; @@ -14,16 +14,18 @@ import 'styles/globals.css'; function MyApp({ Component, pageProps }: AppProps) { const router = useRouter(); - const queryClient = new QueryClient({ - defaultOptions: { - queries: { - staleTime: 60 * 1000 * 10, // 10분 동안은 캐시를 사용 - cacheTime: 60 * 1000 * 10, // 20분 동안 캐시를 유지 - retry: 1, // 에러가 났을 때 1번 재시도 - refetchOnMount: false, - }, - }, - }); + const [queryClient, _] = useState( + () => + new QueryClient({ + defaultOptions: { + queries: { + staleTime: 60 * 1000 * 10, // 10분 동안은 캐시를 사용 + retry: 1, // 에러가 났을 때 1번 재시도 + refetchOnMount: false, + }, + }, + }) + ); useEffect(() => { const handleRouteChange = (url: string) => {