diff --git a/gongjakso/src/components/Header/Bubble.jsx b/gongjakso/src/components/Header/Bubble.jsx index 976ff11c..f8f15d0c 100644 --- a/gongjakso/src/components/Header/Bubble.jsx +++ b/gongjakso/src/components/Header/Bubble.jsx @@ -91,14 +91,14 @@ const Bubble = ({ closeBubble }) => { handleButtonClick('/recruitedTeam')} > - 내가 모집 중인 팀 + {data?.name}님의 모집 기록 handleButtonClick('/appliedTeam')} > - 내가 지원한 팀 + {data?.name}님의 지원 기록 @@ -107,12 +107,12 @@ const Bubble = ({ closeBubble }) => { handleButtonClick('/participatedTeam') } > - 내가 참여한 공모전 + {data?.name}님의 참여 기록 handleButtonClick('/scrap')}> - 나의 스크랩 + {data?.name}님의 스크랩 diff --git a/gongjakso/src/pages/ProfileApplied/AppliedTeam.jsx b/gongjakso/src/pages/ProfileApplied/AppliedTeam.jsx index dcf3f04d..7b38940b 100644 --- a/gongjakso/src/pages/ProfileApplied/AppliedTeam.jsx +++ b/gongjakso/src/pages/ProfileApplied/AppliedTeam.jsx @@ -3,9 +3,11 @@ import * as S from './AppliedTeamStyled'; import TeamBox from '../TeamBox/TeamBox'; import TopButton from '../../pages/HomePage/TopButton'; import Pagination from '../../components/Pagination/Pagination'; -import { getMyApplied } from '../../service/profile_service'; +import { getMyInfo, getMyApplied } from '../../service/profile_service'; +import { Link } from 'react-router-dom'; const TeamSupport = () => { + const [data, setProfileData] = useState(); const [page, setPage] = useState(1); const [postContent2, setPostContent2] = useState([]); const [totalPage, setTotalPage] = useState(); @@ -21,6 +23,12 @@ const TeamSupport = () => { }); }, [page]); + useEffect(() => { + getMyInfo().then(response => { + setProfileData(response?.data); + }); + }, []); + const loadParticipatedPosts = page => { getMyApplied(page, 6).then(response => { setPostContent2(response?.data.content); @@ -33,23 +41,23 @@ const TeamSupport = () => { - 내가 지원한 팀 + {data?.name}님의 지원 기록 - {postContent2?.map((postContent2, index) => ( - + {postContent2?.map((postContent, index) => ( + + + + + ))} { getMyRecruiting().then(response => { setPostContent1(response?.data?.content.slice(0, 2)); }); - getMyApplied(1, 2).then(response => { - setPostContent2(response?.data?.content); + getMyApplied(1).then(response => { + setPostContent2(response?.data?.content.slice(0, 2)); }); getMyParticipated(1, 2).then(response => { setPostContent3(response?.data?.content); diff --git a/gongjakso/src/pages/ProfileParticipated/ParticipatedTeam.jsx b/gongjakso/src/pages/ProfileParticipated/ParticipatedTeam.jsx index 9ec386af..3dd8524c 100644 --- a/gongjakso/src/pages/ProfileParticipated/ParticipatedTeam.jsx +++ b/gongjakso/src/pages/ProfileParticipated/ParticipatedTeam.jsx @@ -2,10 +2,11 @@ import React, { useEffect, useState } from 'react'; import * as S from './ParticipatedTeamStyled'; import TeamBox from '../TeamBox/TeamBox'; import Pagination from '../../components/Pagination/Pagination'; -import { getMyParticipated } from '../../service/profile_service'; +import { getMyInfo, getMyParticipated } from '../../service/profile_service'; const TeamPart = () => { const [page, setPage] = useState(1); + const [data, setProfileData] = useState(); const [postContent3, setPostContent3] = useState(); const [totalPage, setTotalPage] = useState(); @@ -16,6 +17,12 @@ const TeamPart = () => { }); }, [page]); + useEffect(() => { + getMyInfo().then(response => { + setProfileData(response?.data); // 'response'를 바로 전달 + }); + }, []); + const loadParticipatedPosts = page => { getMyParticipated(page, 6).then(response => { setPostContent3(response?.data.content); @@ -29,7 +36,7 @@ const TeamPart = () => {
- 내가 참여한 공모전/프로젝트 + {data?.name}님의 참여 기록 {postContent3?.map(postContent3 => ( diff --git a/gongjakso/src/pages/ProfileRecruited/RecruitedTeam.jsx b/gongjakso/src/pages/ProfileRecruited/RecruitedTeam.jsx index b9b225d6..15df068a 100644 --- a/gongjakso/src/pages/ProfileRecruited/RecruitedTeam.jsx +++ b/gongjakso/src/pages/ProfileRecruited/RecruitedTeam.jsx @@ -3,9 +3,10 @@ import * as S from './RecruitedTeam.Styled'; import TeamBox from '../TeamBox/TeamBox'; import TopButton from '../../pages/HomePage/TopButton'; import Pagination from '../../components/Pagination/Pagination'; -import { getMyRecruiting } from '../../service/profile_service'; +import { getMyInfo, getMyRecruiting } from '../../service/profile_service'; const RecruitedTeam = () => { + const [data, setProfileData] = useState(); const [postContent1, setPostContent1] = useState([]); useEffect(() => { @@ -14,12 +15,18 @@ const RecruitedTeam = () => { }); }, []); + useEffect(() => { + getMyInfo().then(response => { + setProfileData(response?.data); // 'response'를 바로 전달 + }); + }, []); + return (
- 내가 모집 중인 팀 + {data?.name}님의 모집 기록 {postContent1?.map(postContent1 => ( diff --git a/gongjakso/src/pages/ScrapPage/Scrap.jsx b/gongjakso/src/pages/ScrapPage/Scrap.jsx index 2eb960e1..06c1e303 100644 --- a/gongjakso/src/pages/ScrapPage/Scrap.jsx +++ b/gongjakso/src/pages/ScrapPage/Scrap.jsx @@ -3,11 +3,12 @@ import * as S from './Scrap.Styled'; import TeamBox from '../TeamBox/TeamBox'; import TopButton from '../HomePage/TopButton'; import Pagination from '../../components/Pagination/Pagination'; -import { getMyTeamScrap } from '../../service/profile_service'; +import { getMyInfo, getMyTeamScrap } from '../../service/profile_service'; import NoContents from '../../features/NoContents/NoContents'; const Scrap = () => { const [page, setPage] = useState(1); + const [data, setProfileData] = useState(); const [postContent4, setPostContent4] = useState(); //스크랩 공모전 const [totalPage, setTotalPage] = useState(0); @@ -18,6 +19,12 @@ const Scrap = () => { }); }, [page]); + useEffect(() => { + getMyInfo().then(response => { + setProfileData(response?.data); // 'response'를 바로 전달 + }); + }, []); + const loadScrapedPosts = page => { getMyTeamScrap(page, 6).then(response => { setTotalPage(response?.data.totalPages); @@ -30,7 +37,7 @@ const Scrap = () => { - 나의 스크랩 + {data?.name}님의 스크랩 {!postContent4 ? ( diff --git a/gongjakso/src/pages/TeamBox/TeamBox.jsx b/gongjakso/src/pages/TeamBox/TeamBox.jsx index 6013aee8..fcb71668 100644 --- a/gongjakso/src/pages/TeamBox/TeamBox.jsx +++ b/gongjakso/src/pages/TeamBox/TeamBox.jsx @@ -100,33 +100,6 @@ const TeamBox = ({ dispatch(closeConfirmModal()); }; - const startDate = new Date(postContent?.startDate) - .toLocaleDateString('ko-KR', { - year: 'numeric', - month: '2-digit', - day: '2-digit', - }) - .split('. ') - .join('.'); - - const finishDate = new Date(postContent?.finishDate) - .toLocaleDateString('ko-KR', { - year: 'numeric', - month: '2-digit', - day: '2-digit', - }) - .split('. ') - .join('.'); - - const endDate = new Date(postContent?.endDate) - .toLocaleDateString('ko-KR', { - year: 'numeric', - month: '2-digit', - day: '2-digit', - }) - .split('. ') - .join('.'); - function getDisplayCategory(recruit_part) { let displayCategory; @@ -137,12 +110,6 @@ const TeamBox = ({ case '디자인': displayCategory = '디자인'; break; - case 'FE': - displayCategory = '프론트엔드'; - break; - case 'BE': - displayCategory = '백엔드'; - break; case '기타': displayCategory = '기타'; break; @@ -153,6 +120,26 @@ const TeamBox = ({ return displayCategory; } + function getDisplayApplyCategory(apply_part) { + let displayApplyCategory; + + switch (apply_part) { + case '기획': + displayApplyCategory = '기획'; + break; + case '디자인': + displayApplyCategory = '디자인'; + break; + case '기타': + displayApplyCategory = '기타'; + break; + default: + displayApplyCategory = apply_part; + } + + return displayApplyCategory; + } + return ( @@ -176,8 +162,9 @@ const TeamBox = ({ - {postContent?.d_day < 0 - ? '마감된 공고' + {/*모집팀의 경우 -- 취소 마감 데이터 추가 필요*/} + {postContent?.d_day <= 0 + ? '마감' : `마감 D-${postContent?.d_day}`} @@ -217,7 +204,14 @@ const TeamBox = ({ ); }, ) + ) : postContent?.applicant_id ? ( + + {getDisplayApplyCategory( + postContent?.apply_part, + )} + ) : ( + // 내가 모집 중인 팀 postContent?.recruit_part?.map( (categoryList, index) => { return ( @@ -239,12 +233,13 @@ const TeamBox = ({ )} */} {showWaitingJoin && ( - - {postContent?.applyType === 'PASS' + + {postContent?.status === '합류 완료' ? '합류 완료' - : postContent?.applyType === 'NOT_PASS' + : postContent?.status === '미선발' ? '미선발' : '합류 대기중'} + {/*수정 필요. status X*/} {postContent?.status === 'CLOSE' && ( 모집이 마감되었습니다. diff --git a/gongjakso/src/pages/TeamBox/TeamBoxStyled.jsx b/gongjakso/src/pages/TeamBox/TeamBoxStyled.jsx index 7bdb9af6..cdaae3ac 100644 --- a/gongjakso/src/pages/TeamBox/TeamBoxStyled.jsx +++ b/gongjakso/src/pages/TeamBox/TeamBoxStyled.jsx @@ -146,10 +146,10 @@ export const WaitingJoin = styled.div` display: flex; align-items: center; justify-content: center; - background: ${({ theme, $applytype }) => - $applytype === 'PASS' + background: ${({ theme, $status }) => + $status === '합류 완료' ? theme.box1 - : $applytype === 'NOT_PASS' + : $status === '미선발' ? theme.LightGrey : theme.Light1}; border-radius: 50px; diff --git a/gongjakso/src/service/profile_service.js b/gongjakso/src/service/profile_service.js index af22d7fb..26379bb8 100644 --- a/gongjakso/src/service/profile_service.js +++ b/gongjakso/src/service/profile_service.js @@ -42,11 +42,12 @@ export const getMyRecruiting = async (page, size) => { }; //팀박스->내가 지원 -export const getMyApplied = async (page, size) => { - const reqURL = `team/my-apply?page=${page - 1}&size=${size}`; +export const getMyApplied = async page => { + const reqURL = `apply/my?page=${page - 1}`; try { const response = await axiosInstanceV2.get(reqURL); + console.log(response?.data); return response.data; } catch (error) { console.log('내가 지원한 게시글을 가져올 수 없습니다.');