Skip to content

Commit

Permalink
Merge pull request #163 from KUSITMS-29th-TEAM-B/feat/#101
Browse files Browse the repository at this point in the history
Feat/#101
  • Loading branch information
hyo-4 authored May 23, 2024
2 parents c675d0b + b958d24 commit 427d60f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 23 deletions.
21 changes: 17 additions & 4 deletions src/components/JD/Experience.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { QuestionType } from "../../types/experience";
import { bookmarkpatch } from "../../services/JD/bookmarkApi";
import { getCookie } from "../../services/cookie";
import { useParams } from "react-router-dom";
import { getAllExperienceList } from "../../services/JD/ExperienceApi";

interface ExpProps {
type?: "card" | "section";
Expand All @@ -26,7 +27,7 @@ interface ExpProps {
detail?: QuestionType[];
checkedKeywords?: string[];
onClick?: () => void;
handleApi?: (jdid: string, token: string) => void;
handleApi?: (jdId: string, token: string) => Promise<void>;
}

const Experience: React.FC<ExpProps> = ({
Expand All @@ -52,6 +53,19 @@ const Experience: React.FC<ExpProps> = ({
// 카드 타입, 섹션 타입 구분
const isSection = type === "section";

const getExperienceList = async (jdId: string, token: string) => {
try {
const response = await getAllExperienceList(jdId, token);
//console.log(response);
if (handleApi) {
handleApi(jdId, user.token);
}
} catch (error) {
console.error(error);
alert(JSON.stringify(error));
}
};

// 경험의 선택된 질문 답변
const answer = detail?.[(question || 1) - 1]?.answer;

Expand All @@ -69,13 +83,12 @@ const Experience: React.FC<ExpProps> = ({
) => {
try {
const response = await bookmarkpatch(token, jobId, expId);
console.log(response);
if (jdId && user.token) {
handleApi!(jdId, user.token);
}
} catch (error) {
console.error(error);
alert(JSON.stringify(error));
// console.error(error);
// alert(JSON.stringify(error));
}
};

Expand Down
12 changes: 12 additions & 0 deletions src/components/JD/ExperienceList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { useParams } from "react-router-dom";
import { formatDateRange } from "../../pages/JDListPage";
import { KeywordType } from "../../types/experience";
import { getKeywords } from "../../services/Experience/keywordApi";
import { select } from "d3";

type TabType = "basic" | "my";

Expand Down Expand Up @@ -259,6 +260,16 @@ const ExperienceList: React.FC<ExperienceListProps> = ({
}
}, [searchText]);

useEffect(() => {
setSearchText("");
setMainTag({ id: "", name: "" });
setSubTag({ id: "", name: "" });
setCheckedKeywords([]);
if (jdId) {
getExperienceList(jdId, user.token);
}
}, [selectedTab]);

// My 역량 키워드 조회
useEffect(() => {
if (user?.token) {
Expand Down Expand Up @@ -493,6 +504,7 @@ const ExperienceList: React.FC<ExperienceListProps> = ({
(item: KeywordType) => item.name
)}
onClick={() => setshowDetail(true)}
handleApi={getExperienceList}
/>
))}
</ScrollDiv>
Expand Down
27 changes: 9 additions & 18 deletions src/components/JD/JDEditModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { FC } from "react";
import styled from "styled-components";
import warning from "../../assets/icons/icon_warning.svg";
import warning from "../../assets/icons/icon_delete_warning.svg";
import { useNavigate } from "react-router-dom";

interface ModalProps {
Expand All @@ -21,12 +21,7 @@ const JDEditModal: FC<ModalProps> = ({ isOpen, onClose, jdId }) => {
<MainWrapper>
<img src={warning} alt="warning" />
<div className="maintext">이전 페이지로 돌아가시겠어요?</div>
<div className="subtext">
저장하지 않으면
<div>
입력한 내용은 <span>복원할 수 없어요!</span>
</div>
</div>
<div className="subtext">작성하던 공고가 저장되지 않아요!</div>
</MainWrapper>
<ButtonWrapper>
<CloseButton onClick={onClose}>
Expand Down Expand Up @@ -81,7 +76,7 @@ const MainWrapper = styled.div`
.maintext {
color: var(--neutral-700, #343A5D);
text-align: center;
font-size: 1.375rem;
font-size: 22px;
font-style: normal;
font-weight: 600;
line-height: 1.625rem;
Expand All @@ -91,17 +86,13 @@ const MainWrapper = styled.div`
.subtext {
color: var(--neutral-500, #A6AAC0);
text-align: center;
font-size: 1rem;
font-size: 16px;
font-style: normal;
font-weight: 500;
line-height: 1.25rem;
letter-spacing: -0.02rem;
margin-top: 1.25rem;
span{
color: var(--main-500, #7D82FF);
font-size: 1.2rem;
font-weight: 600;
}
font-weight: 400;
line-height: 22px;
margin-top: 10px;
letter-spacing: -0.64px;
margin-bottom: 40px;
}
`;

Expand Down
3 changes: 2 additions & 1 deletion src/pages/JDPlusPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ const JDPlusPage: React.FC = () => {
},
token
);
console.log(response.data.jobDescriptionId);
console.log(job.endedAt);
nav("/jd");
nav(`/jd/${response.data.jobDescriptionId}`);
} catch (error) {
console.error(error);
alert(JSON.stringify(error));
Expand Down

0 comments on commit 427d60f

Please sign in to comment.