Skip to content

Commit 56a9cd7

Browse files
committed
Merge branch 'develop'
2 parents 817632e + 6f09408 commit 56a9cd7

File tree

6 files changed

+91
-16
lines changed

6 files changed

+91
-16
lines changed

src/apis/applications/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,19 +132,19 @@ export function useDeleteApplication(applicationId: number) {
132132
);
133133
}
134134

135-
export function useEmploymentStats() {
136-
return useQuery(["employmentStats"], async () => {
135+
export function useEmploymentStats(year?: number) {
136+
return useQuery(["employmentStats", year], async () => {
137137
const { data } = await instance.get<EmploymentStatsResponseType>(
138-
`${router}/employment`
138+
`${router}/employment/${year}`
139139
);
140140
return data;
141141
});
142142
}
143143

144-
export function useTotalEmplymentStats() {
145-
return useQuery(["totalEmploymentStats"], async () => {
144+
export function useTotalEmplymentStats(year?: number) {
145+
return useQuery(["totalEmploymentStats", year], async () => {
146146
const { data } = await instance.get<TotalEmPlymentStatsResponseType>(
147-
`${router}/employment/count`
147+
`${router}/employment/count/${year}`
148148
);
149149
return data;
150150
});

src/app/job-rate/page.tsx

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,34 @@
1+
"use client";
2+
3+
import DropDown from "@/components/common/DropDown";
14
import JobCurrentSituation from "@/components/jobRate/JobCurrentSituation";
25
import JobPieChart from "@/components/jobRate/JobPieChart";
6+
import { useState } from "react";
37

48
export default function JobRate() {
9+
const [year, setYear] = useState<number>(new Date().getFullYear());
10+
const startYear = 2024;
11+
const currentYear = new Date().getFullYear();
12+
const dropdownItems = Array.from(
13+
{ length: Math.max(currentYear, startYear) - startYear + 1 },
14+
(_, i) => {
15+
const y = startYear + i;
16+
return { code: String(y), label: String(y) };
17+
}
18+
).reverse();
19+
520
return (
6-
<div className="flex flex-col pt-16 gap-[63px]">
7-
<JobPieChart />
8-
<JobCurrentSituation />
21+
<div className="flex flex-col pt-16 gap-[12px]">
22+
<JobPieChart year={year} />
23+
<div className="flex justify-end">
24+
<DropDown
25+
title="연도 선택"
26+
items={dropdownItems}
27+
selected={year}
28+
onClickItem={(itemId: string) => setYear(Number(itemId))}
29+
/>
30+
</div>
31+
<JobCurrentSituation year={year} />
932
</div>
1033
);
1134
}

src/components/common/SearchDropDown.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,15 @@ function TechCodeDropDownComponent({
115115
<div className="flex justify-end h-8 mt-2">
116116
<GhostBtn
117117
onClick={() => {
118+
const currentJobCode = getQueryString("job_code");
119+
const currentWinterIntern = getQueryString("winter_intern");
120+
const currentName = getQueryString("name");
121+
118122
setQueryString({
123+
page: "1",
124+
job_code: currentJobCode,
125+
winter_intern: currentWinterIntern,
126+
name: currentName,
119127
tech_code: select.map((item) => item.code).toString(),
120128
});
121129
closeDropDown();

src/components/jobRate/JobCurrentSituation.tsx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,29 @@ import { useEmploymentStats } from "@/apis/applications";
44
const BASE_URL = process.env.NEXT_PUBLIC_IMAGE_URL;
55
import useGetClass from "@/util/getClassName";
66

7-
export default function JobCurrentSituation() {
8-
const { data } = useEmploymentStats();
7+
export default function JobCurrentSituation({ year }: { year: number }) {
8+
const { data, isLoading } = useEmploymentStats(year);
9+
if (isLoading || !data) {
10+
return (
11+
<div className="bg-white rounded-xl p-6 border border-[#E5E5E5] animate-pulse">
12+
<div className="flex justify-between items-center mb-4">
13+
<div className="w-40 h-6 bg-[#eee] rounded" />
14+
<div className="w-24 h-6 bg-[#eee] rounded" />
15+
</div>
916

17+
<div className="grid grid-cols-2 gap-4">
18+
<div className="p-4 bg-[#fafafa] rounded">
19+
<div className="w-32 h-4 bg-[#eee] rounded mb-2" />
20+
<div className="w-full h-6 bg-[#eee] rounded" />
21+
</div>
22+
<div className="p-4 bg-[#fafafa] rounded">
23+
<div className="w-32 h-4 bg-[#eee] rounded mb-2" />
24+
<div className="w-full h-6 bg-[#eee] rounded" />
25+
</div>
26+
</div>
27+
</div>
28+
);
29+
}
1030
return (
1131
<div className="w-full grid grid-cols-2 gap-10">
1232
{data?.classes.map((classItem) => {

src/components/jobRate/JobPieChart.tsx

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
"use client";
22

33
import { useTotalEmplymentStats } from "@/apis/applications";
4-
import { useEffect, useState } from "react";
4+
import { useEffect } from "react";
55
import { PieChart, Pie, Cell } from "recharts";
66

7-
export default function JobPieChart() {
8-
const { data: employmentData, isLoading } = useTotalEmplymentStats();
7+
export default function JobPieChart({ year }: { year: number }) {
8+
const { data: employmentData, isLoading } = useTotalEmplymentStats(year);
99

1010
const passedCount = employmentData?.passed_count || 0;
1111
const totalStudentCount = employmentData?.total_student_count || 1;
@@ -25,7 +25,32 @@ export default function JobPieChart() {
2525
},
2626
];
2727

28-
if (isLoading || !employmentData) return null;
28+
if (isLoading || !employmentData) {
29+
return (
30+
<div className="flex flex-col items-center bg-[#FFF] rounded-xl pt-[24px] pb-[27px] pr-9 gap-8 border border-[#E5E5E5] animate-pulse">
31+
<div className="w-full flex justify-end mb-2">
32+
<div className="w-24 h-6 bg-[#eee] rounded" />
33+
</div>
34+
<div className="flex flex-col gap-[10px] items-center relative">
35+
<div className="w-[160px] h-[160px] rounded-full bg-[#f5f5f5]" />
36+
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-center text-b2 font-b text-primaryBlue03">
37+
--
38+
</div>
39+
</div>
40+
<div className="flex justify-center items-center gap-[34px] w-full">
41+
<div className="flex flex-col gap-3 items-center">
42+
<div className="w-28 h-4 bg-[#eee] rounded" />
43+
<div className="w-20 h-6 bg-[#eee] rounded mt-1" />
44+
</div>
45+
<div className="w-[1px] h-[26px] bg-[#E5E5E5]" />
46+
<div className="flex flex-col gap-3 items-center">
47+
<div className="w-28 h-4 bg-[#eee] rounded" />
48+
<div className="w-24 h-6 bg-[#eee] rounded mt-1" />
49+
</div>
50+
</div>
51+
</div>
52+
);
53+
}
2954

3055
return (
3156
<div className="flex flex-col items-center bg-[#FFF] rounded-xl pt-[24px] pb-[27px] pr-9 gap-8 border border-[#E5E5E5]">

src/components/recruitments/filter.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ function Filter() {
2323
const [filter, setFilter] = useState({
2424
page: getQueryString("page"),
2525
job_code: getQueryString("job_code"),
26-
tech_code: getQueryString("tech_code"),
2726
winter_intern: getQueryString("winter_intern"),
2827
});
2928
const { state: searchState, onChange: onChangeSearch } = useForm<{

0 commit comments

Comments
 (0)