Skip to content

Commit

Permalink
Merge pull request #41 from Project-Catcher/feat/my-schedule
Browse files Browse the repository at this point in the history
Feat: 내 일정 페이지 추가 구현
  • Loading branch information
pepperdad authored Dec 6, 2023
2 parents c865cc2 + 7949606 commit 825d9f1
Show file tree
Hide file tree
Showing 50 changed files with 2,977 additions and 318 deletions.
7 changes: 5 additions & 2 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import Confirm from "@shared/modal/Confirm";
import Modal from "@shared/modal/Modal";
import "@shared/styles/globals.css";

if (process.env.NODE_ENV === "development" && process.env.MOCK === "true") {
if (
process.env.NEXT_PUBLIC_NODE_ENV === "development" &&
process.env.NEXT_PUBLIC_MOCK === "true"
) {
import("mock");
}

Expand All @@ -15,9 +18,9 @@ function MyApp({ Component, pageProps }: AppProps) {
<RecoilRoot>
<Header />
<Component {...pageProps} />
<Modal />
<Alert />
<Confirm />
<Modal />
</RecoilRoot>
);
}
Expand Down
164 changes: 164 additions & 0 deletions pages/api/mySchedule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
import axios from "axios";

export const getAllSchedule = async (
tab?: string,
title?: string,
startDate?: Date,
endDate?: Date,
) => {
let tabParam;

if (tab === "진행 예정") {
tabParam = "proceed";
} else if (tab === "진행중/완료 일정") {
tabParam = "ongoing";
}

return await axios.get(`${process.env.NEXT_PUBLIC_BASE_URL}/getAllSchedule`, {
params: {
tab: tabParam,
title,
startDate,
endDate,
},
});
};

export const getRecruitSchedule = async (
tab?: string,
title?: string,
startDate?: Date,
endDate?: Date,
) => {
let tabParam;

if (tab === "모집 중/예정") {
tabParam = "proceed";
} else if (tab === "모집 완료") {
tabParam = "ongoing";
}

return await axios.get(
`${process.env.NEXT_PUBLIC_BASE_URL}/getRecruitSchedule`,
{
params: {
tab: tabParam,
title,
startDate,
endDate,
},
},
);
};

export const getParticipateSchedule = async (
tab?: string,
title?: string,
startDate?: Date,
endDate?: Date,
) => {
let tabParam = 0;

if (tab === "승인 대기 중") {
tabParam = 1;
} else if (tab === "승인 완료") {
tabParam = 2;
} else if (tab === "승인 거절") {
tabParam = 3;
}

return await axios.get(
`${process.env.NEXT_PUBLIC_BASE_URL}/getParticipateSchedule`,
{
params: {
tab: tabParam,
title,
startDate,
endDate,
},
},
);
};

export const getScrapSchedule = async (
title?: string,
startDate?: Date,
endDate?: Date,
) => {
return await axios.get(
`${process.env.NEXT_PUBLIC_BASE_URL}/getScrapSchedule`,
{
params: {
title,
startDate,
endDate,
},
},
);
};

export const getTemporarySchedule = async (
title?: string,
startDate?: Date,
endDate?: Date,
) => {
return await axios.get(
`${process.env.NEXT_PUBLIC_BASE_URL}/getTemporarySchedule`,
{
params: {
title,
startDate,
endDate,
},
},
);
};

export const getMainSchedule = async () => {
try {
const response = await axios.all([
getAllSchedule(),
getRecruitSchedule(),
getParticipateSchedule(),
getTemporarySchedule(),
]);

// axios.spread를 사용하여 각 요청의 결과를 개별적으로 처리
const [
allSchedule,
recruitSchedule,
participateSchedule,
temporarySchedule,
] = response;

// 각 요청의 데이터를 반환합니다.
return {
allSchedule: allSchedule.data,
recruitSchedule: recruitSchedule.data,
participateSchedule: participateSchedule.data,
temporarySchedule: temporarySchedule.data,
};
} catch (error) {
console.error("API 호출 중 오류 발생:", error);
throw error; // 오류를 호출자에게 전달
}
};

export const getApplicantsList = async (id: number) => {
return await axios.get(
`${process.env.NEXT_PUBLIC_BASE_URL}/getApplicantsList`,
{
params: {
id,
},
},
);
};

export const getItemList = async (title?: string) => {
return await axios.get(`${process.env.NEXT_PUBLIC_BASE_URL}/getItemList`, {
params: {
title,
},
});
};
7 changes: 6 additions & 1 deletion pages/schedule/all.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
//모든 일정 페이지
import All from "@schedule/components/All";
import ScheduleWrapper from "@schedule/components/ScheduleWrapper";

const create = () => {
return <All />;
return (
<ScheduleWrapper>
<All />;
</ScheduleWrapper>
);
};

export default create;
7 changes: 6 additions & 1 deletion pages/schedule/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
// 내 일정 페이지
import Main from "@schedule/components/Main";
import ScheduleWrapper from "@schedule/components/ScheduleWrapper";
import React from "react";

const index = () => {
return <Main />;
return (
<ScheduleWrapper>
<Main />;
</ScheduleWrapper>
);
};

export default index;
13 changes: 13 additions & 0 deletions pages/schedule/items.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Items from "@schedule/components/Items";
import ScheduleWrapper from "@schedule/components/ScheduleWrapper";
import React from "react";

const items = () => {
return (
<ScheduleWrapper>
<Items />;
</ScheduleWrapper>
);
};

export default items;
13 changes: 13 additions & 0 deletions pages/schedule/participate.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Participate from "@schedule/components/Participate";
import ScheduleWrapper from "@schedule/components/ScheduleWrapper";
import React from "react";

const participate = () => {
return (
<ScheduleWrapper>
<Participate />;
</ScheduleWrapper>
);
};

export default participate;
13 changes: 13 additions & 0 deletions pages/schedule/recruit.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Recruit from "@schedule/components/Recruit";
import ScheduleWrapper from "@schedule/components/ScheduleWrapper";
import React from "react";

const recruit = () => {
return (
<ScheduleWrapper>
<Recruit />;
</ScheduleWrapper>
);
};

export default recruit;
13 changes: 13 additions & 0 deletions pages/schedule/scrap.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import ScheduleWrapper from "@schedule/components/ScheduleWrapper";
import Scrap from "@schedule/components/Scrap";
import React from "react";

const participate = () => {
return (
<ScheduleWrapper>
<Scrap />;
</ScheduleWrapper>
);
};

export default participate;
13 changes: 13 additions & 0 deletions pages/schedule/temporary.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import ScheduleWrapper from "@schedule/components/ScheduleWrapper";
import Temporary from "@schedule/components/Temporary";
import React from "react";

const temporary = () => {
return (
<ScheduleWrapper>
<Temporary />;
</ScheduleWrapper>
);
};

export default temporary;
9 changes: 9 additions & 0 deletions public/assets/schedule/arrow-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions public/assets/schedule/arrow-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions public/assets/schedule/card_toggle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/assets/schedule/filter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions public/assets/schedule/partying_face.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/schedule/pencil.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 825d9f1

Please sign in to comment.