From 7712a1161dee9e2476576f5c34131115224cdc55 Mon Sep 17 00:00:00 2001 From: Soyeon Choe Date: Fri, 26 Jul 2024 13:36:16 +0900 Subject: [PATCH] =?UTF-8?q?rename:=20steList=20=ED=83=80=EC=9E=85=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20useStepList=20=ED=8F=B4=EB=8D=94=EB=A1=9C?= =?UTF-8?q?=20=EC=9D=B4=EB=8F=99=20=ED=9B=84=20type.ts=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/apis/request/bill.ts | 2 -- client/src/apis/request/member.ts | 2 -- client/src/apis/request/report.ts | 2 -- client/src/apis/request/stepList.ts | 2 -- .../SetActionModalContent.tsx | 10 +--------- .../UpdateParticipants.tsx | 1 - client/src/hooks/useDynamicInputPairs.tsx | 2 -- .../useSearchMemberReportList.tsx | 1 - .../stepList.ts => hooks/useStepList/type.ts} | 17 ----------------- client/src/hooks/useStepList/useStepList.tsx | 3 ++- client/src/pages/Event/Admin/Admin.tsx | 2 -- client/src/type.d.ts | 18 ++++++++++++++++++ 12 files changed, 21 insertions(+), 41 deletions(-) rename client/src/{types/stepList.ts => hooks/useStepList/type.ts} (64%) create mode 100644 client/src/type.d.ts diff --git a/client/src/apis/request/bill.ts b/client/src/apis/request/bill.ts index 18f9fda3d..c07fd758a 100644 --- a/client/src/apis/request/bill.ts +++ b/client/src/apis/request/bill.ts @@ -1,5 +1,3 @@ -import {Bill} from 'types/stepList'; - import {BASE_URL} from '@apis/baseUrl'; import {TEMP_PREFIX} from '@apis/tempPrefix'; import {requestPost} from '@apis/fetcher'; diff --git a/client/src/apis/request/member.ts b/client/src/apis/request/member.ts index 43da5b4e9..d23563f34 100644 --- a/client/src/apis/request/member.ts +++ b/client/src/apis/request/member.ts @@ -1,5 +1,3 @@ -import {MemberType} from 'types/stepList'; - import {BASE_URL} from '@apis/baseUrl'; import {TEMP_PREFIX} from '@apis/tempPrefix'; import {requestPost} from '@apis/fetcher'; diff --git a/client/src/apis/request/report.ts b/client/src/apis/request/report.ts index 63702aeeb..faa6c9185 100644 --- a/client/src/apis/request/report.ts +++ b/client/src/apis/request/report.ts @@ -1,5 +1,3 @@ -import {MemberReport} from 'types/stepList'; - import {BASE_URL} from '@apis/baseUrl'; import {TEMP_PREFIX} from '@apis/tempPrefix'; import {requestGet} from '@apis/fetcher'; diff --git a/client/src/apis/request/stepList.ts b/client/src/apis/request/stepList.ts index 1f5523cb0..e09cb67fd 100644 --- a/client/src/apis/request/stepList.ts +++ b/client/src/apis/request/stepList.ts @@ -1,5 +1,3 @@ -import {StepList} from 'types/stepList'; - import {BASE_URL} from '@apis/baseUrl'; import {TEMP_PREFIX} from '@apis/tempPrefix'; import {requestGet} from '@apis/fetcher'; diff --git a/client/src/components/Modal/SetActionModalContent/SetActionModalContent.tsx b/client/src/components/Modal/SetActionModalContent/SetActionModalContent.tsx index 41bbd9749..b3ccd64c9 100644 --- a/client/src/components/Modal/SetActionModalContent/SetActionModalContent.tsx +++ b/client/src/components/Modal/SetActionModalContent/SetActionModalContent.tsx @@ -1,8 +1,6 @@ import {useState} from 'react'; import {BottomSheet, Switch} from 'haengdong-design'; -import {InOutType} from '@pages/Event/Admin/Admin'; - import SetPurchase from './SetPurchase'; import UpdateParticipants from './UpdateParticipants'; import {setActionModalContentStyle, setActionModalContentSwitchContainerStyle} from './SetActionModalContent.style'; @@ -11,17 +9,11 @@ export type ActionType = '지출' | '인원'; interface SetActionModalContentProps { openBottomSheet: boolean; - setOpenBottomSheet: React.Dispatch>; setOrder: React.Dispatch>; } -const SetActionModalContent = ({ - openBottomSheet, - - setOpenBottomSheet, - setOrder, -}: SetActionModalContentProps) => { +const SetActionModalContent = ({openBottomSheet, setOpenBottomSheet, setOrder}: SetActionModalContentProps) => { const [action, setAction] = useState('지출'); const [inOutAction, setInOutAction] = useState('탈주'); diff --git a/client/src/components/Modal/SetActionModalContent/UpdateParticipants.tsx b/client/src/components/Modal/SetActionModalContent/UpdateParticipants.tsx index 33c1d3a12..5adc3cd43 100644 --- a/client/src/components/Modal/SetActionModalContent/UpdateParticipants.tsx +++ b/client/src/components/Modal/SetActionModalContent/UpdateParticipants.tsx @@ -1,7 +1,6 @@ import {Input, FixedButton} from 'haengdong-design'; import {useStepList} from '@hooks/useStepList/useStepList'; -import {MemberType} from 'types/stepList'; import useDynamicInput from '@hooks/useDynamicAdditionalInput'; diff --git a/client/src/hooks/useDynamicInputPairs.tsx b/client/src/hooks/useDynamicInputPairs.tsx index 177d066c7..b6f86b000 100644 --- a/client/src/hooks/useDynamicInputPairs.tsx +++ b/client/src/hooks/useDynamicInputPairs.tsx @@ -1,7 +1,5 @@ import {useEffect, useRef, useState} from 'react'; -import {Bill} from 'types/stepList'; - const useDynamicInputPairs = () => { const [inputPairs, setInputPairs] = useState([{title: '', price: 0}]); const inputRefs = useRef<(HTMLInputElement | null)[]>([]); diff --git a/client/src/hooks/useSearchMemberReportList/useSearchMemberReportList.tsx b/client/src/hooks/useSearchMemberReportList/useSearchMemberReportList.tsx index a76deb82c..02c07b80a 100644 --- a/client/src/hooks/useSearchMemberReportList/useSearchMemberReportList.tsx +++ b/client/src/hooks/useSearchMemberReportList/useSearchMemberReportList.tsx @@ -1,6 +1,5 @@ import {useEffect, useState} from 'react'; -import {MemberReport} from 'types/stepList'; import {requestMemberReportList} from '@apis/request/report'; import useEventId from '@hooks/useEventId/useEventId'; diff --git a/client/src/types/stepList.ts b/client/src/hooks/useStepList/type.ts similarity index 64% rename from client/src/types/stepList.ts rename to client/src/hooks/useStepList/type.ts index e7ecd973d..6d9b78de1 100644 --- a/client/src/types/stepList.ts +++ b/client/src/hooks/useStepList/type.ts @@ -1,10 +1,3 @@ -export type MemberType = 'IN' | 'OUT'; - -// TODO: (@weadie) 준 데이터 형식에서 steps를 빼내 flat하게 사용중. 일관성있게 하는게 좋긴 하나 사용시 번거로움이 있을 거라고 판단. -export type StepList = { - steps: (MemberStep | BillStep)[]; -}; - export type Step = { type: MemberType | 'BILL'; stepName: string | null; @@ -43,13 +36,3 @@ export type Member = { name: string; status: MemberType; }; - -export type Bill = { - title: string; - price: number; -}; - -export type MemberReport = { - name: string; - price: number; -}; diff --git a/client/src/hooks/useStepList/useStepList.tsx b/client/src/hooks/useStepList/useStepList.tsx index b7996d6c1..52d2a78d6 100644 --- a/client/src/hooks/useStepList/useStepList.tsx +++ b/client/src/hooks/useStepList/useStepList.tsx @@ -1,11 +1,12 @@ import {PropsWithChildren, createContext, useContext, useEffect, useState} from 'react'; -import {Bill, BillAction, BillStep, MemberStep, MemberType, StepList} from 'types/stepList'; import useEventId from '@hooks/useEventId/useEventId'; import {requestAddBillList} from '@apis/request/bill'; import {requestUpdateMemberList} from '@apis/request/member'; import {requestStepList} from '@apis/request/stepList'; +import {BillAction, BillStep, MemberStep} from './type.ts'; + interface StepListContextProps { stepList: (BillStep | MemberStep)[]; getTotalPrice: () => number; diff --git a/client/src/pages/Event/Admin/Admin.tsx b/client/src/pages/Event/Admin/Admin.tsx index 033aaa704..bda03da55 100644 --- a/client/src/pages/Event/Admin/Admin.tsx +++ b/client/src/pages/Event/Admin/Admin.tsx @@ -15,8 +15,6 @@ export type PurchaseInformation = { price: number; }; -export type InOutType = '늦참' | '탈주'; - export type ParticipantType = { name: string; type: InOutType; diff --git a/client/src/type.d.ts b/client/src/type.d.ts new file mode 100644 index 000000000..a81318e4c --- /dev/null +++ b/client/src/type.d.ts @@ -0,0 +1,18 @@ +type MemberType = 'IN' | 'OUT'; + +type InOutType = '늦참' | '탈주'; + +type MemberReport = { + name: string; + price: number; +}; + +type Bill = { + title: string; + price: number; +}; + +// TODO: (@weadie) 준 데이터 형식에서 steps를 빼내 flat하게 사용중. 일관성있게 하는게 좋긴 하나 사용시 번거로움이 있을 거라고 판단. +type StepList = { + steps: (MemberStep | BillStep)[]; +};