Skip to content

Commit

Permalink
chore: 코드 리뷰 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
bottlewook committed Jan 20, 2024
1 parent f4b2bdf commit f25a55a
Show file tree
Hide file tree
Showing 27 changed files with 105 additions and 102 deletions.
17 changes: 9 additions & 8 deletions src/app/car-details/hydrated-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
import { useState } from 'react';
import { useForm } from 'react-hook-form';

import CarColorPicker from '@details/car-details/CarColorPicker';
import CarDetails from '@details/car-details/CarDetails';
import DetailsLoading from '@details/details-loading/DetailsLoading';
import useCarColor from '@remote/queries/details/useCarColor';
import useCarDriving from '@remote/queries/details/useCarDriving';
import useCarParking from '@remote/queries/details/useCarParking';
import useCarSegment from '@remote/queries/details/useCarSegment';
import useCarType from '@remote/queries/details/useCarType';
import CarColorPicker from '@additional-info/car-details/CarColorPicker';
import CarDetails from '@additional-info/car-details/CarDetails';
import DetailsLoading from '@additional-info/details-loading/DetailsLoading';

import useCarColor from '@remote/queries/additional-info/car-details/useCarColor';
import useCarDriving from '@remote/queries/additional-info/car-details/useCarDriving';
import useCarParking from '@remote/queries/additional-info/car-details/useCarParking';
import useCarSegment from '@remote/queries/additional-info/car-details/useCarSegment';
import useCarType from '@remote/queries/additional-info/car-details/useCarType';
import Header from '@shared/header/Header';
import ProgressBar from '@shared/progress-bar/ProgressBar';
import Spacing from '@shared/spacing/Spacing';
Expand Down
2 changes: 1 addition & 1 deletion src/app/car-details/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { dehydrate, Hydrate } from '@tanstack/react-query';
import getQueryClient from '@lib/getQueryClient';
import {
getCarColor, getCarDriving, getCarParking, getCarSegment, getCarType,
} from '@remote/api/requests/details/details.get.api';
} from '@remote/api/requests/additional-info/additional-info.get.api';

import CarDetailsPage from './hydrated-page';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { FieldValues, UseFormRegister } from 'react-hook-form';

import ColorPicker from '@additional-info/car-details/color-picker/ColorPicker';
import Description from '@additional-info/description/Description';
import classNames from 'classnames/bind';

import ColorPicker from '@details/color-picker/ColorPicker';
import Description from '@details/description/Description';
import { IDetails } from '@remote/api/types/details';
import { IAdditionalInfo } from '@/remote/api/types/additional-info';
import FixedBottomButton from '@shared/fixedBottomButton/FixedBottomButton';
import Spacing from '@shared/spacing/Spacing';

Expand All @@ -16,7 +16,7 @@ interface CarColorPickerProps {
onClick: () => void
main: string
sub: string
options: IDetails[]
options: IAdditionalInfo[]
register: UseFormRegister<FieldValues>;
dirtyFields: Record<string, boolean>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { FieldValues, UseFormRegister } from 'react-hook-form';

import Description from '@details/description/Description';
import { IDetails } from '@remote/api/types/details';
import Description from '@additional-info/description/Description';

import { IAdditionalInfo } from '@/remote/api/types/additional-info';
import FixedBottomButton from '@shared/fixedBottomButton/FixedBottomButton';
import Flex from '@shared/flex/Flex';
import Radio from '@shared/radio/Radio';
Expand All @@ -11,7 +12,7 @@ interface CarDetailsProps {
onClick: () => void
main: string
sub: string
options: IDetails[]
options: IAdditionalInfo[]
register: UseFormRegister<FieldValues>
dirtyFields: Record<string, boolean>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Flex from '@components/shared/flex/Flex';
import Flex from '@shared/flex/Flex';
import Spacing from '@shared/spacing/Spacing';
import Text from '@shared/text/Text';

Expand Down
1 change: 1 addition & 0 deletions src/constants/delay.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const ADDITIONAL_INFO_DELAY_TIME = 2000;
32 changes: 32 additions & 0 deletions src/remote/api/requests/additional-info/additional-info.get.api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { IAdditionalInfo } from '../../types/additional-info';
import { getRequest } from '../requests.api';

export const getCarSegment = async () => {
const response = await getRequest<IAdditionalInfo[]>('/commoncode/segment');

return response;
};

export const getCarType = async () => {
const response = await getRequest<IAdditionalInfo[]>('/commoncode/cartype');

return response;
};

export const getCarColor = async () => {
const response = await getRequest<IAdditionalInfo[]>('/commoncode/color');

return response;
};

export const getCarDriving = async () => {
const response = await getRequest<IAdditionalInfo[]>('/commoncode/driving');

return response;
};

export const getCarParking = async () => {
const response = await getRequest<IAdditionalInfo[]>('/commoncode/parking');

return response;
};
32 changes: 0 additions & 32 deletions src/remote/api/requests/details/details.get.api.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface IDetails {
export interface IAdditionalInfo {
codeNo: number
codeName: string
upperNo: number
Expand Down
10 changes: 10 additions & 0 deletions src/remote/queries/additional-info/car-details/useCarColor.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { useQuery } from '@tanstack/react-query';

import { getCarColor } from '@remote/api/requests/additional-info/additional-info.get.api';
import { IAdditionalInfo } from '@remote/api/types/additional-info';

function useCarColor() {
return useQuery<IAdditionalInfo[]>({ queryKey: ['car-color'], queryFn: getCarColor });
}

export default useCarColor;
10 changes: 10 additions & 0 deletions src/remote/queries/additional-info/car-details/useCarDriving.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { useQuery } from '@tanstack/react-query';

import { getCarDriving } from '@remote/api/requests/additional-info/additional-info.get.api';
import { IAdditionalInfo } from '@remote/api/types/additional-info';

function useCarDriving() {
return useQuery<IAdditionalInfo[]>({ queryKey: ['car-driving'], queryFn: getCarDriving });
}

export default useCarDriving;
10 changes: 10 additions & 0 deletions src/remote/queries/additional-info/car-details/useCarParking.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { useQuery } from '@tanstack/react-query';

import { getCarParking } from '@remote/api/requests/additional-info/additional-info.get.api';
import { IAdditionalInfo } from '@remote/api/types/additional-info';

function useCarParking() {
return useQuery<IAdditionalInfo[]>({ queryKey: ['car-parking'], queryFn: getCarParking });
}

export default useCarParking;
10 changes: 10 additions & 0 deletions src/remote/queries/additional-info/car-details/useCarSegment.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { useQuery } from '@tanstack/react-query';

import { getCarSegment } from '@remote/api/requests/additional-info/additional-info.get.api';
import { IAdditionalInfo } from '@remote/api/types/additional-info';

function useCarSegment() {
return useQuery<IAdditionalInfo[]>({ queryKey: ['car-segment'], queryFn: getCarSegment });
}

export default useCarSegment;
10 changes: 10 additions & 0 deletions src/remote/queries/additional-info/car-details/useCarType.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { useQuery } from '@tanstack/react-query';

import { getCarType } from '@remote/api/requests/additional-info/additional-info.get.api';
import { IAdditionalInfo } from '@remote/api/types/additional-info';

function useCarType() {
return useQuery<IAdditionalInfo[]>({ queryKey: ['car-type'], queryFn: getCarType });
}

export default useCarType;
10 changes: 0 additions & 10 deletions src/remote/queries/details/useCarColor.tsx

This file was deleted.

10 changes: 0 additions & 10 deletions src/remote/queries/details/useCarDriving.tsx

This file was deleted.

10 changes: 0 additions & 10 deletions src/remote/queries/details/useCarParking.tsx

This file was deleted.

10 changes: 0 additions & 10 deletions src/remote/queries/details/useCarSegment.tsx

This file was deleted.

10 changes: 0 additions & 10 deletions src/remote/queries/details/useCarType.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"@shared/*": [
"src/components/shared/*"
],
"@details/*": [
"src/components/details/*"
"@additional-info/*": [
"src/components/additional-info/*"
],
"@styles/*": [
"src/styles/*"
Expand Down

0 comments on commit f25a55a

Please sign in to comment.