Skip to content

Commit

Permalink
feat: 모집구분 filter 추가 및 여러 버그 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
JJIIIINN committed Nov 21, 2023
1 parent 98a5cae commit df6e2f5
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 8 deletions.
17 changes: 14 additions & 3 deletions src/Apis/Recruitments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,21 @@ export const useGetRecruitmentForm = (
searchRecruitmentFormQueryString,
],
queryFn: async () => {
const { year, page, company_name, start, end, status } =
searchRecruitmentFormQueryString;
const {
year,
page,
company_name,
start,
end,
status,
winter_intern,
} = searchRecruitmentFormQueryString;
const winterIntern =
winter_intern !== null
? `&winter_intern=${winter_intern}`
: '';
const { data } = await instance.get<RecruitmentFormResponse>(
`${router}/teacher?year=${year}&page=${page}&company_name=${company_name}&start=${start}&end=${end}&status=${
`${router}/teacher?year=${year}&page=${page}${winterIntern}&company_name=${company_name}&start=${start}&end=${end}&status=${
status === '전체' || status === undefined ? '' : status
}`
);
Expand Down
1 change: 1 addition & 0 deletions src/Apis/Recruitments/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export interface RecruitmentFormQueryStringType {
start: string;
end: string;
status: string;
winter_intern: boolean | null;
page: number;
}

Expand Down
4 changes: 1 addition & 3 deletions src/Components/ApplicationView/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,7 @@ export function ApplicationViewTable({
RejectApplicationIsLoading ||
clickedData.length !== 1 ||
!!clickedData.filter(
(item) =>
item.status === 'APPROVED' ||
item.status === 'REJECTED'
(item) => item.status === 'REJECTED'
).length
}
>
Expand Down
16 changes: 15 additions & 1 deletion src/Components/RecruitmentForm/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as _ from './style';
import { RecruitmentFormQueryStringType } from '../../../Apis/Recruitments/request';
import { Dispatch, SetStateAction } from 'react';
import { useForm } from '../../../Hooks/useForm';
import { companyStatus } from '../../../Utils/Translation';
import { companyStatus, winterIntern } from '../../../Utils/Translation';
import { useDropDown } from '../../../Hooks/useDropDown';

interface PropsType {
Expand Down Expand Up @@ -36,6 +36,7 @@ export function RecruitmentFormSearch({
const { selectedItem, setSelectedItem, handleSelectedItem } = useDropDown({
year: searchRecruitmentFormQueryString.year,
status: '',
type: '전체',
});

/** 검색 input 데이터를 초기화하는 함수입니다. */
Expand All @@ -49,6 +50,7 @@ export function RecruitmentFormSearch({
setSelectedItem({
year: searchRecruitmentFormQueryString.year,
status: '',
type: '전체',
});
};

Expand All @@ -59,6 +61,7 @@ export function RecruitmentFormSearch({
...formData,
year: selectedItem.year,
status: companyStatus[selectedItem.status],
winter_intern: winterIntern[selectedItem.type],
});
setTimeout(refetchRecruitmentForm);
};
Expand Down Expand Up @@ -100,6 +103,17 @@ export function RecruitmentFormSearch({
min={formData.start}
/>
</_.ContentWrapper>
<_.TitleText>모집구분</_.TitleText>
<_.ContentWrapper width={12.3}>
<DropDown
width={86}
option={['전체', '체험형', '채용형']}
value={selectedItem.type || '전체'}
onChange={(type) =>
type !== '전체' && handleSelectedItem('type', type)
}
/>
</_.ContentWrapper>
</_.Wrapper>
<_.Wrapper>
<_.TitleText>기업명</_.TitleText>
Expand Down
5 changes: 4 additions & 1 deletion src/Hooks/useDropDown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { useState } from 'react';
export function useDropDown<T>(initialState: T) {
const [selectedItem, setSelectedItem] = useState<T>(initialState);

const handleSelectedItem = (name: string, value: string) => {
const handleSelectedItem = (
name: string,
value: string | number | boolean
) => {
setSelectedItem((prevSelectedItem) => ({
...prevSelectedItem,
[name]: value,
Expand Down
1 change: 1 addition & 0 deletions src/Pages/RecruitmentFormPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export function RecruitmentFormPage() {
start: ``,
end: ``,
status: '',
winter_intern: null,
page: 1,
});
const recruitmentFormQueries = useGetRecruitmentForm(
Expand Down
6 changes: 6 additions & 0 deletions src/Utils/Translation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ export const hiringProgress: { [key: string]: string } = {
AI: 'AI면접',
CODING_TEST: '코딩테스트',
};

export const winterIntern: { [key: string]: boolean | null } = {
전체: null,
체험형: true,
채용형: false,
};

0 comments on commit df6e2f5

Please sign in to comment.