Skip to content

Commit

Permalink
๐Ÿ”€ ๏ฟฝEdit Apply API
Browse files Browse the repository at this point in the history
#264 ์ง€์›ํ•˜๊ธฐ API ์˜ค๋ฅ˜ ํ•ด๊ฒฐ
  • Loading branch information
sxxcxng authored Sep 29, 2024
2 parents 68894e0 + c5f63c3 commit 5025e22
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 72 deletions.
8 changes: 4 additions & 4 deletions gongjakso/src/components/Header/Bubble.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ const Bubble = ({ closeBubble }) => {
<S.SubTitle
onClick={() => handleButtonClick('/recruitedTeam')}
>
<span>๋‚ด๊ฐ€ ๋ชจ์ง‘ ์ค‘์ธ ํŒ€</span>
<span>{data?.name}๋‹˜์˜ ๋ชจ์ง‘ ๊ธฐ๋ก</span>
<S.ArrowImage />
</S.SubTitle>
<S.GreyLine />
<S.SubTitle
onClick={() => handleButtonClick('/appliedTeam')}
>
<span>๋‚ด๊ฐ€ ์ง€์›ํ•œ ํŒ€</span>
<span>{data?.name}๋‹˜์˜ ์ง€์› ๊ธฐ๋ก</span>
<S.ArrowImage />
</S.SubTitle>
<S.GreyLine />
Expand All @@ -107,12 +107,12 @@ const Bubble = ({ closeBubble }) => {
handleButtonClick('/participatedTeam')
}
>
<span>๋‚ด๊ฐ€ ์ฐธ์—ฌํ•œ ๊ณต๋ชจ์ „</span>
<span>{data?.name}๋‹˜์˜ ์ฐธ์—ฌ ๊ธฐ๋ก</span>
<S.ArrowImage />
</S.SubTitle>
<S.GreyLine />
<S.SubTitle onClick={() => handleButtonClick('/scrap')}>
<span>๋‚˜์˜ ์Šคํฌ๋žฉ</span>
<span>{data?.name}๋‹˜์˜ ์Šคํฌ๋žฉ</span>
<S.ArrowImage />
</S.SubTitle>
<S.GreyLine />
Expand Down
40 changes: 24 additions & 16 deletions gongjakso/src/pages/ProfileApplied/AppliedTeam.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand All @@ -33,23 +41,23 @@ const TeamSupport = () => {
<TopButton />
<S.TopBox>
<S.Spacer />
<S.Title>๋‚ด๊ฐ€ ์ง€์›ํ•œ ํŒ€</S.Title>
<S.Title>{data?.name}๋‹˜์˜ ์ง€์› ๊ธฐ๋ก</S.Title>
</S.TopBox>
<S.BoxDetail>
{postContent2?.map((postContent2, index) => (
<TeamBox
key={index}
showMoreDetail={false}
showWaitingJoin={true}
showSubBox={true}
borderColor={
postContent2.postType === true
? 'rgba(231, 137, 255, 0.5)'
: 'rgba(0, 163, 255, 0.5)'
}
postContent={postContent2}
isMyParticipation={false}
/>
{postContent2?.map((postContent, index) => (
<React.Fragment key={postContent.id}>
<Link
to={`/contest/${postContent.contest_id}/team/${postContent.team_id}`}
>
<TeamBox
showMoreDetail={false}
showWaitingJoin={true}
showSubBox={true}
postContent={postContent}
isMyParticipation={false}
/>
</Link>
</React.Fragment>
))}
<Pagination
total={totalPage}
Expand Down
4 changes: 2 additions & 2 deletions gongjakso/src/pages/ProfilePage/ProfilePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ const ProfilePage = () => {
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);
Expand Down
11 changes: 9 additions & 2 deletions gongjakso/src/pages/ProfileParticipated/ParticipatedTeam.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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);
Expand All @@ -29,7 +36,7 @@ const TeamPart = () => {
<div>
<S.TopBox>
<S.Spacer />
<S.Title>๋‚ด๊ฐ€ ์ฐธ์—ฌํ•œ ๊ณต๋ชจ์ „/ํ”„๋กœ์ ํŠธ</S.Title>
<S.Title>{data?.name}๋‹˜์˜ ์ฐธ์—ฌ ๊ธฐ๋ก</S.Title>
</S.TopBox>
<S.BoxDetail>
{postContent3?.map(postContent3 => (
Expand Down
11 changes: 9 additions & 2 deletions gongjakso/src/pages/ProfileRecruited/RecruitedTeam.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -14,12 +15,18 @@ const RecruitedTeam = () => {
});
}, []);

useEffect(() => {
getMyInfo().then(response => {
setProfileData(response?.data); // 'response'๋ฅผ ๋ฐ”๋กœ ์ „๋‹ฌ
});
}, []);

return (
<div>
<TopButton />
<S.TopBox>
<S.Spacer />
<S.Title>๋‚ด๊ฐ€ ๋ชจ์ง‘ ์ค‘์ธ ํŒ€</S.Title>
<S.Title>{data?.name}๋‹˜์˜ ๋ชจ์ง‘ ๊ธฐ๋ก</S.Title>
</S.TopBox>
<S.BoxDetail>
{postContent1?.map(postContent1 => (
Expand Down
11 changes: 9 additions & 2 deletions gongjakso/src/pages/ScrapPage/Scrap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand All @@ -30,7 +37,7 @@ const Scrap = () => {
<TopButton />
<S.TopBox>
<S.Spacer />
<S.Title>๋‚˜์˜ ์Šคํฌ๋žฉ</S.Title>
<S.Title>{data?.name}๋‹˜์˜ ์Šคํฌ๋žฉ</S.Title>
</S.TopBox>
<S.BoxDetail>
{!postContent4 ? (
Expand Down
73 changes: 34 additions & 39 deletions gongjakso/src/pages/TeamBox/TeamBox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -137,12 +110,6 @@ const TeamBox = ({
case '๋””์ž์ธ':
displayCategory = '๋””์ž์ธ';
break;
case 'FE':
displayCategory = 'ํ”„๋ก ํŠธ์—”๋“œ';
break;
case 'BE':
displayCategory = '๋ฐฑ์—”๋“œ';
break;
case '๊ธฐํƒ€':
displayCategory = '๊ธฐํƒ€';
break;
Expand All @@ -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 (
<S.Container>
<S.Box
Expand All @@ -168,16 +155,16 @@ const TeamBox = ({
{isMyParticipation === true &&
`| ${postContent?.leader_name} | ${postContent?.started_at}~${postContent?.finished_at} |`}
{isMyParticipation === null &&
// `| ${postContent?.name} | ${postContent?.startedAt}~${postContent?.finishedAt} |`}
`| ${postContent?.leader_name} | ${postContent?.started_at} ~ ${postContent?.finished_at} |`}
</S.subTitle>
</S.MainBox>
{showSubBox ? (
<S.SubBox>
<S.DeadLine>
<S.FireImage />
{postContent?.d_day < 0
? '๋งˆ๊ฐ๋œ ๊ณต๊ณ '
{/*๋ชจ์ง‘ํŒ€์˜ ๊ฒฝ์šฐ -- ์ทจ์†Œ ๋งˆ๊ฐ ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€ ํ•„์š”*/}
{postContent?.d_day <= 0
? '๋งˆ๊ฐ'
: `๋งˆ๊ฐ D-${postContent?.d_day}`}
</S.DeadLine>
<S.ScrapNum>
Expand Down Expand Up @@ -217,7 +204,14 @@ const TeamBox = ({
);
},
)
) : postContent?.applicant_id ? (
<S.RoundForm>
{getDisplayApplyCategory(
postContent?.apply_part,
)}
</S.RoundForm>
) : (
// ๋‚ด๊ฐ€ ๋ชจ์ง‘ ์ค‘์ธ ํŒ€
postContent?.recruit_part?.map(
(categoryList, index) => {
return (
Expand All @@ -239,12 +233,13 @@ const TeamBox = ({
</>
)} */}
{showWaitingJoin && (
<S.WaitingJoin $applytype={postContent?.applyType}>
{postContent?.applyType === 'PASS'
<S.WaitingJoin $status={postContent?.status}>
{postContent?.status === 'ํ•ฉ๋ฅ˜ ์™„๋ฃŒ'
? 'ํ•ฉ๋ฅ˜ ์™„๋ฃŒ'
: postContent?.applyType === 'NOT_PASS'
: postContent?.status === '๋ฏธ์„ ๋ฐœ'
? '๋ฏธ์„ ๋ฐœ'
: 'ํ•ฉ๋ฅ˜ ๋Œ€๊ธฐ์ค‘'}
{/*์ˆ˜์ • ํ•„์š”. status X*/}
{postContent?.status === 'CLOSE' && (
<S.DeadlineOverlay $status={postContent.status}>
๋ชจ์ง‘์ด ๋งˆ๊ฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
Expand Down
6 changes: 3 additions & 3 deletions gongjakso/src/pages/TeamBox/TeamBoxStyled.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions gongjakso/src/service/profile_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('๋‚ด๊ฐ€ ์ง€์›ํ•œ ๊ฒŒ์‹œ๊ธ€์„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.');
Expand Down

0 comments on commit 5025e22

Please sign in to comment.