Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: 일정 만들기 추가 구현 #55

Open
wants to merge 31 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
bedefe7
[feat] 썸네일 선택 후 대표 이미지 표시
Choi-Jinwook Nov 26, 2023
d0158b3
[feat] 사이드바 클릭 상태 설정
Choi-Jinwook Nov 27, 2023
5ec4709
[feat] constant 분리
Choi-Jinwook Nov 27, 2023
4e85caf
[fix] 사이드바 버그 수정
Choi-Jinwook Nov 27, 2023
5f3fa95
[feat] 사이드바 메뉴 클릭 시 해당 위치 이동 로직 추가
Choi-Jinwook Nov 27, 2023
8069dbf
Merge remote-tracking branch 'Catcher-origin/develop' into feat/makeplan
Choi-Jinwook Nov 27, 2023
1b1d7f2
[feat] 템플릿, 작성중 일정 msw 적용
Choi-Jinwook Nov 30, 2023
6c4f3e7
[feat] 템플릿, 작성 중 일정 타입 통일
Choi-Jinwook Nov 30, 2023
031c192
[feat] 불러온 데이터 적용
Choi-Jinwook Nov 30, 2023
63f25f8
[feat] 작성 중 일정이 없는 경우 핸들링
Choi-Jinwook Nov 30, 2023
93541bf
Merge remote-tracking branch 'Catcher-origin/develop' into feat/makeplan
Choi-Jinwook Nov 30, 2023
fe1f6e2
[fix] 다른 프로세스 이동 시 제목 날아가는 현상 수정
Choi-Jinwook Dec 4, 2023
28f3491
[feat] 사용하지 않는 리코일 제거
Choi-Jinwook Dec 4, 2023
d679a93
[feat] 상단 현재페이지 표시문구 관리 로직 변경
Choi-Jinwook Dec 4, 2023
4464110
[feat] 작성 중 일정 없을 때 프로세스 관리 로직 상위 컴포넌트로 이동
Choi-Jinwook Dec 4, 2023
e5f2497
[feat] 가독성을 위한 리코일 이름 변경
Choi-Jinwook Dec 4, 2023
5cd97e5
[feat] 타입 추가
Choi-Jinwook Dec 7, 2023
350bf01
[feat] API 요청 경로 추가
Choi-Jinwook Dec 7, 2023
99f16e6
[feat] 변경된 타입 적용
Choi-Jinwook Dec 7, 2023
c66d173
[feat] msw 타입, 경로 수정
Choi-Jinwook Dec 7, 2023
f1860e5
Merge remote-tracking branch 'Catcher-origin/develop' into feat/makeplan
Choi-Jinwook Dec 7, 2023
8d73ce3
[feat] interface key 통일
Choi-Jinwook Dec 8, 2023
8fd804a
[feat] 기본정보 임시저장 msw 적용
Choi-Jinwook Dec 8, 2023
618b669
[feat] 임시저장 post method 추가
Choi-Jinwook Dec 8, 2023
1052446
[feat] 지역 정보 추가
Choi-Jinwook Dec 10, 2023
162b2c5
[feat] default export 추가
Choi-Jinwook Dec 10, 2023
c1f354d
[feat] 지역 타입 추가
Choi-Jinwook Dec 10, 2023
0878aa6
[feat] 지역 선택 모달 세팅
Choi-Jinwook Dec 10, 2023
44c7b3e
[feat] 지역 선택 로직 구성
Choi-Jinwook Dec 10, 2023
2edc490
[feat] 기본정보 버튼 비활성화 추가
Choi-Jinwook Dec 10, 2023
4a8ef06
[feat] 기본정보 post method try-catch 적용
Choi-Jinwook Dec 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion 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");
}

Choi-Jinwook marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
35 changes: 33 additions & 2 deletions pages/create-schedule/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,43 @@
import { PlanContent, PlanSideBar } from "@create-schedule/components";
import axios from "axios";
import { GetServerSideProps } from "next";
import { ScheduleCardSection } from "@shared/types";

const CreateSchedule = () => {
interface CreateScheduleProps {
remains: ScheduleCardSection[];
templates: ScheduleCardSection[];
}

const CreateSchedule = ({ remains, templates }: CreateScheduleProps) => {
return (
<div className="w-full h-without-header mt-[78px]">
<PlanSideBar />
<PlanContent />
<PlanContent remains={remains} templates={templates} />
</div>
);
};

export default CreateSchedule;

export const getServerSideProps: GetServerSideProps = async () => {
try {
const [remainResponse, templateResponse] = await axios.all([
axios.get(`${process.env.NEXT_PUBLIC_BASE_URL}/remains`),
axios.get(`${process.env.NEXT_PUBLIC_BASE_URL}/templates`),
]);

return {
props: {
remains: remainResponse.data as ScheduleCardSection[],
templates: templateResponse.data as ScheduleCardSection[],
},
};
} catch (error) {
return {
props: {
remains: [],
templates: [],
},
};
}
};
Choi-Jinwook marked this conversation as resolved.
Show resolved Hide resolved
36 changes: 28 additions & 8 deletions src/create-schedule/components/BasicInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,51 @@
import { useState } from "react";
import { BASIC_INFO_TAG } from "@create-schedule/constants";
import { useEffect, useState } from "react";
import MenuContent from "./MenuContent";
import MenuContentContainer from "./MenuContentContainer";
import SideBarMenuBox from "./SideBarMenuBox";

interface BasicInfoProps {}
interface BasicInfoProps {
currentProgress: number;
currentTab: string;
handleTab: (value: string) => void;
}

const BasicInfo = ({}: BasicInfoProps) => {
const boxTitle = "기본정보";
const BasicInfo = ({
currentProgress,
currentTab,
handleTab,
}: BasicInfoProps) => {
const [isOpen, setIsOpen] = useState(false);

const handleToggle = () => {
setIsOpen((prev) => !prev);
};

useEffect(() => {
if (currentProgress === 2) {
setIsOpen(true);
}
}, [currentProgress]);

return (
<>
<SideBarMenuBox
title={boxTitle}
title="기본정보"
isOpen={isOpen}
isAccordion
handleToggle={handleToggle}
/>
{isOpen && (
<MenuContentContainer>
<MenuContent title="카테고리 태그 입력" boxTitle={boxTitle} />
<MenuContent title="시작일 종료일 설정" boxTitle={boxTitle} />
<MenuContent title="위치 선택" boxTitle={boxTitle} />
{BASIC_INFO_TAG.map((title) => (
<MenuContent
key={title}
title={title}
targetProgress={2}
currentTab={currentTab}
handleTab={handleTab}
/>
))}
</MenuContentContainer>
)}
</>
Choi-Jinwook marked this conversation as resolved.
Show resolved Hide resolved
Choi-Jinwook marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
12 changes: 3 additions & 9 deletions src/create-schedule/components/Continue.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { useSetRecoilState } from "recoil";
import { currentPageName, currentProgress } from "@shared/recoil";
import { currentScheduleProgress } from "@shared/recoil";
import BlockShowing from "./BlockShowing";
import MakeScheduleButton from "./MakeScheduleButton";

const Continue = () => {
const setCurrentPage = useSetRecoilState(currentPageName);
const setCurrentProgress = useSetRecoilState(currentProgress);

const handleCurrentPageElements = () => {
setCurrentPage("기본정보");
setCurrentProgress(2);
};
const setCurrentProgress = useSetRecoilState(currentScheduleProgress);

return (
<div className="w-fit px-[100px] py-[15px]">
Expand All @@ -21,7 +15,7 @@ const Continue = () => {
<MakeScheduleButton
value="새로 만들기"
buttonStyle="text-[#666666] border-[#E0E0E0]"
onClick={handleCurrentPageElements}
onClick={() => setCurrentProgress(2)}
/>
<div className="w-fit py-[22px] mx-auto">
<BlockShowing />
Expand Down
29 changes: 24 additions & 5 deletions src/create-schedule/components/CurrentPage.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
import Image from "next/image";
import { useRecoilValue } from "recoil";
import { currentPageName } from "@shared/recoil";
import { useEffect, useState } from "react";
import { CurrentPageType } from "@shared/types";

const CurrentPage = () => {
const currentPage = useRecoilValue(currentPageName);
interface CurrentPageProps {
currentProgress: number;
}

const CurrentPage = ({ currentProgress }: CurrentPageProps) => {
const [pageName, setPageName] = useState<CurrentPageType>("작성 중인 일정");

useEffect(() => {
switch (currentProgress) {
case 1:
return setPageName("작성 중인 일정");
case 2:
return setPageName("기본정보");
case 3:
return setPageName("태그 및 일정 템플릿");
case 4:
return setPageName("일정 채우기");
case 5:
return setPageName("작성 마무리");
}
}, [currentProgress]);

return (
<div className="flex w-fit items-center gap-[6px] h-[24px] mb-[32px]">
Expand Down Expand Up @@ -31,7 +50,7 @@ const CurrentPage = () => {
height={12.5}
/>
<div className="text-[12px] text-[#757575] font-medium -tracking-[0.5px]">
{currentPage}
{pageName}
</div>
</div>
);
Expand Down
18 changes: 16 additions & 2 deletions src/create-schedule/components/FillPlan.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
import { useSetRecoilState } from "recoil";
import { currentScheduleProgress } from "@shared/recoil";
import SideBarMenuBox from "./SideBarMenuBox";

const FillPlan = () => {
interface FillPlanProps {
handleTab: (value: string) => void;
}

const FillPlan = ({ handleTab }: FillPlanProps) => {
const setCurrentProgress = useSetRecoilState(currentScheduleProgress);

return (
<div className="border-b-2 border-[#F1F1F1]">
<div
className="border-b-2 border-[#F1F1F1]"
onClick={() => {
handleTab("일정 채우기");
setCurrentProgress(4);
}}
>
<SideBarMenuBox title="일정 채우기" />
</div>
);
Choi-Jinwook marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
35 changes: 29 additions & 6 deletions src/create-schedule/components/FinishWriting.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,51 @@
import { useState } from "react";
import { FINISH_WRITING_TAG } from "@create-schedule/constants";
import { useEffect, useState } from "react";
import MenuContent from "./MenuContent";
import MenuContentContainer from "./MenuContentContainer";
import SideBarMenuBox from "./SideBarMenuBox";

const FinishWriting = () => {
const boxTitle = "작성 마무리";
interface FinishWritingProps {
currentProgress: number;
currentTab: string;
handleTab: (value: string) => void;
}

const FinishWriting = ({
currentProgress,
currentTab,
handleTab,
}: FinishWritingProps) => {
const [isOpen, setIsOpen] = useState(false);

const handleToggle = () => {
setIsOpen((prev) => !prev);
};

useEffect(() => {
if (currentProgress === 5) {
setIsOpen(true);
}
}, [currentProgress]);

return (
<>
<SideBarMenuBox
title={boxTitle}
title="작성 마무리"
isOpen={isOpen}
isAccordion
handleToggle={handleToggle}
/>
{isOpen && (
<MenuContentContainer>
<MenuContent title="공개범위 설정" boxTitle={boxTitle} />
<MenuContent title="일정 소개" boxTitle={boxTitle} />
{FINISH_WRITING_TAG.map((title) => (
<MenuContent
key={title}
title={title}
targetProgress={5}
currentTab={currentTab}
handleTab={handleTab}
/>
))}
</MenuContentContainer>
)}
</>
Choi-Jinwook marked this conversation as resolved.
Show resolved Hide resolved
Choi-Jinwook marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
26 changes: 17 additions & 9 deletions src/create-schedule/components/MenuContent.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
import { useSetRecoilState } from "recoil";
import { currentPageName } from "@shared/recoil";
import { CurrentPageType } from "@shared/types";
import { currentScheduleProgress } from "@shared/recoil";

interface MenuContentProps {
title: string;
boxTitle: CurrentPageType;
isClicked?: boolean;
targetProgress: number;
currentTab: string;
handleTab: (value: string) => void;
}

const MenuContent = ({ title, boxTitle, isClicked }: MenuContentProps) => {
const setCurrentPage = useSetRecoilState(currentPageName);
const MenuContent = ({
title,
targetProgress,
currentTab,
handleTab,
}: MenuContentProps) => {
const setCurrentProgress = useSetRecoilState(currentScheduleProgress);

return (
<div
className={`${
isClicked ? "text-[#F864A1]" : "text-[#333333]"
currentTab === title ? "text-[#F864A1]" : "text-[#333333]"
} h-1/2 leading-[23px] py-[6px] cursor-pointer`}
onClick={() => setCurrentPage(boxTitle)}
onClick={() => {
handleTab(title);
setCurrentProgress(targetProgress);
}}
>
{title}
<a href={`#${title}`}>{title}</a>
</div>
);
};
Choi-Jinwook marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
25 changes: 16 additions & 9 deletions src/create-schedule/components/PageContent.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
import { SUBTITLE, TITLE } from "@create-schedule/constants";
import { useRecoilValue } from "recoil";
import { currentProgress } from "@shared/recoil";
import { ScheduleCardSection } from "@shared/types";
import PlanDefaultInfo from "./PlanDefaultInfo";
import Remains from "./Remains";
import ScheduleTagTemplate from "./ScheduleTagTemplate";
import Title from "./Title";

const PageContent = () => {
const current = useRecoilValue(currentProgress);
interface PageContentProps {
currentProgress: number;
remains: ScheduleCardSection[];
templates: ScheduleCardSection[];
}

const PageContent = ({
currentProgress,
remains,
templates,
}: PageContentProps) => {
return (
<>
{current === 1 && (
{currentProgress === 1 && (
<>
<Title
title={TITLE.remains}
subTitle={SUBTITLE.fighting("명란마요")}
/>
<Remains />
<Remains remains={remains} />
</>
)}
{current === 2 && (
{currentProgress === 2 && (
<div className="w-[628px]">
<Title
title={TITLE.nthPlan("명란마요", 5)}
Expand All @@ -29,10 +36,10 @@ const PageContent = () => {
<PlanDefaultInfo />
</div>
)}
{current === 3 && (
{currentProgress === 3 && (
<div className="w-[628px]">
<Title title={TITLE.tag} subTitle={SUBTITLE.withyou} />
<ScheduleTagTemplate />
<ScheduleTagTemplate templates={templates} />
</div>
)}
</>
Choi-Jinwook marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading