Skip to content

Commit

Permalink
Merge pull request #106 from wafflestudio/main
Browse files Browse the repository at this point in the history
release: 결과 페이지
  • Loading branch information
designDefined authored Aug 18, 2023
2 parents 63290a1 + d98524c commit fc4aab6
Show file tree
Hide file tree
Showing 9 changed files with 404 additions and 11 deletions.
76 changes: 76 additions & 0 deletions public/image/result/fail.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions public/image/result/pass.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/apis/recruiting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ export const getAllRecruitings = () =>

export const getRecruitingById = (id: Recruiting["id"]) =>
getRequest<Recruiting>(`/recruitings/${id}`);

export const getRecruitingResult = (id: Recruiting["id"]) =>
getRequest<{ status: number }>(`/recruitings/${id}/result`);
45 changes: 35 additions & 10 deletions src/components/home/NotificationModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import styled from "styled-components";
import { Link } from "react-router-dom";
import MarkdownRenderer from "../../lib/MarkdownRenderer";
import { TAnnouncement } from "../../types/apiTypes";

type NotificationModalProps = {
Expand All @@ -22,7 +23,12 @@ export default function NotificationModal({
<img src="/icon/Notification.svg" alt="" />
</ImageContainer>
<Title>{announcement.title}</Title>
<MainText>{announcement.content}</MainText>
<MainText>
<MarkdownRenderer
markdownString={announcement.content}
StyledWrapper={MarkdownStyledWrapper}
/>
</MainText>
<Link to="/announcement/">자세히보기</Link>
</ContentsWapper>
<ButtonWrapper>
Expand Down Expand Up @@ -68,7 +74,7 @@ const ContentsWapper = styled.div`
`;
const ImageContainer = styled.div`
width: 56px;
height: "56px";
height: 56px;
margin-bottom: 11px;
`;
const Title = styled.h1`
Expand All @@ -80,15 +86,8 @@ const Title = styled.h1`
`;
const MainText = styled.p`
width: 100%;
max-height: 100%;
overflow-y: auto;
white-space: pre-wrap;
word-break: break-all;
margin-top: 18px;
font-size: 16px;
line-height: 170%;
letter-spacing: 0;
text-align: center;
color: #737373;
/* code start: scrollbar css design */
&::-webkit-scrollbar {
Expand Down Expand Up @@ -132,3 +131,29 @@ const DivideLine = styled.div`
height: 30px;
border-left: 1px solid #fff;
`;

const MarkdownStyledWrapper = styled.div`
font-size: 16px;
line-height: 170%;
letter-spacing: 0;
color: #737373;
p {
margin-top: 18px;
white-space: pre-wrap;
word-break: keep-all;
}
ul,
ol {
padding: 0;
}
li {
white-space: pre-wrap;
word-break: keep-all;
}
a {
text-decoration: underline;
&:hover {
color: #f0745f;
}
}
`;
8 changes: 8 additions & 0 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import Sso from "./pages/Sso";
import Announcement from "./pages/Announcement";
import { dashboardLoader } from "./pages/Loader/DashboardLoader";
import { resumeLoader } from "./pages/Loader/ResumeLoader";
import Result, { NoResult } from "./pages/Result";
import { resultLoader } from "./pages/Loader/ResultLoader";

const queryClient = new QueryClient();

Expand Down Expand Up @@ -42,6 +44,12 @@ const router = createBrowserRouter([
loader: dashboardLoader(queryClient),
errorElement: <div>리크루팅을 찾을 수 없습니다</div>,
},
{
path: "result",
element: <Result />,
loader: resultLoader(queryClient),
errorElement: <NoResult />,
},
],
},
{ path: "announcement", element: <Announcement /> },
Expand Down
8 changes: 8 additions & 0 deletions src/pages/Announcement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,13 @@ const MarkdownStyledWrapper = styled.div`
font-weight: normal;
line-height: 185%;
color: #373737;
white-space: pre-wrap;
work-break: keep-all;
}
a {
text-decoration: underline;
&:hover {
color: #f0745f;
}
}
`;
17 changes: 16 additions & 1 deletion src/pages/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function Dashboard() {
StyledWrapper={InformationMarkdownStyledWrapper}
/>
</Information>
<AnnouncementButton onClick={() => navigate("/announcement")}>
{/* <AnnouncementButton onClick={() => navigate("/announcement")}>
공지 및 변경사항 안내
<div>
<img
Expand All @@ -63,6 +63,21 @@ export default function Dashboard() {
width={20}
/>
</div>
</AnnouncementButton> */}
<AnnouncementButton onClick={() => navigate("./result")}>
지원 결과 확인하기
<div>
<img
src="/icon/rookie/AnnounceRightArrow.svg"
alt="&rarr;"
width={20}
/>
<img
src="/icon/rookie/AnnounceRightArrowWhite.svg"
alt="&rarr;"
width={20}
/>
</div>
</AnnouncementButton>
<BottomContainer>
<ProgressList
Expand Down
26 changes: 26 additions & 0 deletions src/pages/Loader/ResultLoader.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { QueryClient } from "@tanstack/react-query";
import { getRecruitingResult } from "../../apis/recruiting";
import { LoaderReturnType } from "../../types/commonTypes";

export const recruitingResultQuery = (id: number) => ({
queryKey: ["recruiting", "result", id],
queryFn: () => getRecruitingResult(id),
staleTime: Infinity,
});

export const resultLoader =
(queryClient: QueryClient) =>
async ({ params }: { params: Record<string, unknown> }) => {
const resultQuery = recruitingResultQuery(Number(params.recruit_id));
const cachedResult = queryClient.getQueryData<{ status: number }>(
resultQuery.queryKey,
);
return {
result:
cachedResult !== undefined
? cachedResult
: await queryClient.fetchQuery(resultQuery),
};
};

export type ResultLoaderReturnType = LoaderReturnType<typeof resultLoader>;
158 changes: 158 additions & 0 deletions src/pages/Result.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
import { useLoaderData, useNavigate } from "react-router-dom";
import styled from "styled-components";
import Header from "../components/home/Header/Header";
import { ResultLoaderReturnType } from "./Loader/ResultLoader";
import { useEffect } from "react";

export default function Result() {
const { result } = useLoaderData() as ResultLoaderReturnType;
if (result.status === 3) {
//불합격 시
return (
<>
<Header />
<Main>
<Container>
<LogoWrapper>
<img src="/image/result/fail.svg"></img>
</LogoWrapper>
<Title>합격자 명단에 없습니다.</Title>
<Description>
와플스튜디오 리크루팅에 참여해 주셔서 감사드립니다.
<br />
지원서를 검토한 결과, 아쉽게도 21.5기 루키 합격자 명단에 포함되지
않았음을 알려드립니다.
<br />
지원해 주신 노력에 진심으로 감사드리며, 미래에 더 나은 기회가
있기를 바라며 응원하겠습니다. 감사합니다.
</Description>
<Contact>
기타 문의사항은{" "}
<a href="mailto:[email protected] ">
mailto:[email protected]
</a>{" "}
이메일로 문의주세요.
</Contact>{" "}
</Container>
</Main>
</>
);
}

if (result.status === 2) {
//합격 시
return (
<>
<Header />
<Main>
<Container>
<LogoWrapper>
<img src="/image/result/pass.svg"></img>
</LogoWrapper>
<Title>
와플스튜디오 <Emphasis>합격</Emphasis>을 축하드립니다!
</Title>
<Description>
지원 시 적어주셨던 이메일로 슬랙 및 노션 초대 예정입니다. <br />
또한 8월 20일 (일요일) 오후 2시에 루키 오리엔테이션이 진행될
예정이니 참고 바랍니다. 오티 참석은 필수입니다.
</Description>
<Contact>
기타 문의사항은{" "}
<a href="mailto:[email protected] ">
mailto:[email protected]
</a>{" "}
이메일로 문의주세요.
</Contact>
</Container>
</Main>
</>
);
}

//결과가 없을 시
return (
<>
<Header />
<Main>
<Container>
<LogoWrapper>
<img src="/image/result/pass.svg"></img>
</LogoWrapper>
<Title>아직 합/불 결과가 나오지 않았습니다.</Title>
<Contact>
기타 문의사항은{" "}
<a href="mailto:[email protected] ">
mailto:[email protected]
</a>{" "}
이메일로 문의주세요.
</Contact>
</Container>
</Main>
</>
);
}

export function NoResult() {
const navigate = useNavigate();
useEffect(() => {
alert("지원하지 않은 리크루팅입니다.");
navigate("../");
}, []);
return <div></div>;
}
const Main = styled.main`
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
`;

const Container = styled.div`
display: flex;
flex-direction: column;
align-items: center;
width: 1100px;
padding: 60px 0;
`;

const LogoWrapper = styled.div`
margin-bottom: 48px;
`;

const Title = styled.div`
color: #222;
font-size: 52px;
font-weight: 700;
margin-bottom: 36px;
`;
const Emphasis = styled.span`
color: #f0745f;
font-size: 64px;
font-weight: 700;
`;
const Description = styled.div`
color: #484848;
text-align: center;
font-size: 24px;
font-weight: 500;
line-height: 150%;
margin-bottom: 36px;
word-break: keep-all;
`;
const Contact = styled.div`
color: #484848;
font-family: Pretendard;
font-size: 16px;
font-weight: 400;
text-align: center;
a {
color: #484848;
font-family: Pretendard;
font-size: 16px;
font-weight: 500;
text-decoration-line: underline;
cursor: pointer;
}
`;

0 comments on commit fc4aab6

Please sign in to comment.