From a7168110c412419be7ca8767f933e8e22a616800 Mon Sep 17 00:00:00 2001 From: hyeseon han Date: Thu, 29 Feb 2024 01:42:09 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20build=20error=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/atoms/GreenArrowButton.tsx | 13 +--- src/components/atoms/IngredientIcons.tsx | 12 +--- src/components/atoms/Input.tsx | 9 +-- src/components/atoms/MiniButton.tsx | 6 +- src/components/atoms/RadioButtonField.tsx | 5 +- src/components/atoms/SearchInput.tsx | 15 +---- src/components/atoms/SortButton.tsx | 12 +--- src/components/atoms/Toggle.tsx | 4 +- src/components/molecules/Counter.tsx | 7 +-- .../molecules/FridgeEnterButton.tsx | 8 +-- src/components/molecules/FridgeTab.tsx | 13 +--- .../molecules/FriendsFridgeItem.tsx | 22 ++----- .../FriendshipHeaderSettingButton.tsx | 4 +- .../molecules/IngredientAddItemContainer.tsx | 8 +-- src/components/molecules/NavWhiteBoxItem.tsx | 18 ++---- .../molecules/NearExpirationWarnBox.tsx | 12 +--- src/components/molecules/SvgAndTextBox.tsx | 10 +--- .../molecules/VerticalLabelValue.tsx | 5 +- src/components/organisms/BottomNavigation.tsx | 10 +--- src/components/organisms/BulletNoticeBox.tsx | 5 +- src/components/organisms/FriendListItem.tsx | 16 +---- .../organisms/FriendsFridgeList.tsx | 4 +- src/components/organisms/Header.tsx | 18 ++---- .../ShareDetailAuthorBottomWrapper.tsx | 47 +++------------ src/components/templates/ErrorFallback.tsx | 18 ++---- .../templates/FriendListTemplate.tsx | 59 ++++--------------- src/components/templates/withLogin.tsx | 5 +- .../queries/fridge/useDeleteFridgeById.ts | 7 +-- .../queries/fridge/useGetIngredientList.ts | 7 ++- .../queries/fridge/useGetMyIngredients.ts | 5 +- src/hooks/queries/fridge/usePutFridgeById.ts | 9 +-- .../queries/friendship/useAddFriendship.ts | 6 +- .../queries/friendship/useDeleteFriendship.ts | 6 +- .../queries/friendship/useGetMyInviteCode.ts | 5 +- src/hooks/queries/login/useGetKakaoToken.ts | 6 +- .../queries/mypage/useGetMyFriendsCount.ts | 6 +- .../queries/share/useGetShareApplicants.ts | 11 +--- src/hooks/queries/share/useGetShareDetail.ts | 5 +- src/hooks/queries/share/useGetShares.ts | 8 +-- src/hooks/queries/useBaseQuery.ts | 6 +- src/hooks/useToast.ts | 27 ++++----- src/pages/mypage/friendship/index.tsx | 6 +- src/pages/share/[id].tsx | 13 ---- src/stories/ToastMessage.stories.tsx | 10 ++-- src/utils/buildQuery.ts | 4 +- src/utils/debounceUtil.ts | 7 +-- 46 files changed, 112 insertions(+), 407 deletions(-) diff --git a/src/components/atoms/GreenArrowButton.tsx b/src/components/atoms/GreenArrowButton.tsx index 37e8baf..38b9983 100644 --- a/src/components/atoms/GreenArrowButton.tsx +++ b/src/components/atoms/GreenArrowButton.tsx @@ -7,23 +7,14 @@ interface GreenArrowButtonProps { className: string; } -const GreenArrowButton: React.FC = ({ - text, - className, - onClick, -}) => { +const GreenArrowButton: React.FC = ({ text, className, onClick }) => { return ( ); }; diff --git a/src/components/atoms/IngredientIcons.tsx b/src/components/atoms/IngredientIcons.tsx index d97b930..ddc0bf4 100644 --- a/src/components/atoms/IngredientIcons.tsx +++ b/src/components/atoms/IngredientIcons.tsx @@ -11,17 +11,9 @@ export const AppleIcon: React.FC> = (props) => ( xmlnsXlink="http://www.w3.org/1999/xlink" > - + - + , - HTMLInputElement - > -> = ({ ...props }) => { +const Input: React.FC, HTMLInputElement>> = ({ + ...props +}) => { return ( + ); diff --git a/src/components/atoms/RadioButtonField.tsx b/src/components/atoms/RadioButtonField.tsx index 0986960..242e0dc 100644 --- a/src/components/atoms/RadioButtonField.tsx +++ b/src/components/atoms/RadioButtonField.tsx @@ -7,10 +7,7 @@ const RadioButtonField: React.FC<{ checked: boolean; }> = ({ label, onClick, checked }) => { return ( - diff --git a/src/components/atoms/SearchInput.tsx b/src/components/atoms/SearchInput.tsx index 7464cef..f809082 100644 --- a/src/components/atoms/SearchInput.tsx +++ b/src/components/atoms/SearchInput.tsx @@ -9,23 +9,12 @@ interface SearchInputProps { placeholder?: string; } -const SearchInput: React.FC = ({ - searchKeyword, - onClick, - placeholder, - onChange, - className, -}) => { +const SearchInput: React.FC = ({ searchKeyword, onClick, placeholder, onChange, className }) => { return (
- +
); diff --git a/src/components/atoms/SortButton.tsx b/src/components/atoms/SortButton.tsx index 02c3056..dce8090 100644 --- a/src/components/atoms/SortButton.tsx +++ b/src/components/atoms/SortButton.tsx @@ -1,19 +1,11 @@ import { AngleIcon } from '@/assets/icons'; import React from 'react'; -const SortButton: React.FC<{ label: string; onClick: () => void }> = ({ - label, - onClick, -}) => { +const SortButton: React.FC<{ label: string; onClick: () => void }> = ({ label, onClick }) => { return ( ); }; diff --git a/src/components/atoms/Toggle.tsx b/src/components/atoms/Toggle.tsx index 875f1c6..153785f 100644 --- a/src/components/atoms/Toggle.tsx +++ b/src/components/atoms/Toggle.tsx @@ -5,9 +5,7 @@ const Toggle: React.FC<{ isToggleOn?: boolean; onClick?: () => void; }> = ({ isToggleOn, onClick }) => { - return ( - - ); + return ; }; export default Toggle; diff --git a/src/components/molecules/Counter.tsx b/src/components/molecules/Counter.tsx index b09fd97..a378b1d 100644 --- a/src/components/molecules/Counter.tsx +++ b/src/components/molecules/Counter.tsx @@ -1,11 +1,8 @@ import React, { useEffect } from 'react'; + import type { CountState } from '@/hooks/useCount'; -const Counter: React.FC = ({ - currentCount, - handleDecreaseCount, - handleIncreaseCount, -}) => { +const Counter: React.FC = ({ currentCount, handleDecreaseCount, handleIncreaseCount }) => { useEffect(() => {}, [currentCount]); return (
diff --git a/src/components/molecules/FridgeEnterButton.tsx b/src/components/molecules/FridgeEnterButton.tsx index 0ae0a97..19aec97 100644 --- a/src/components/molecules/FridgeEnterButton.tsx +++ b/src/components/molecules/FridgeEnterButton.tsx @@ -1,5 +1,5 @@ -import React from 'react'; import Link from 'next/link'; +import React from 'react'; interface FridgeEnterButtonProps { svgComponent: React.ReactNode; @@ -7,11 +7,7 @@ interface FridgeEnterButtonProps { linkTo: string; } -const FridgeEnterButton: React.FC = ({ - svgComponent, - text, - linkTo, -}) => { +const FridgeEnterButton: React.FC = ({ svgComponent, text, linkTo }) => { return ( {svgComponent} diff --git a/src/components/molecules/FridgeTab.tsx b/src/components/molecules/FridgeTab.tsx index afe9bc2..109f17f 100644 --- a/src/components/molecules/FridgeTab.tsx +++ b/src/components/molecules/FridgeTab.tsx @@ -1,21 +1,14 @@ -import React from 'react'; import { BorderTab } from '../atoms'; +import React from 'react'; interface FridgeTabProps { currentTabName: '냉장' | '냉동'; handleTabNameChange: (tabName: '냉장' | '냉동') => void; } -const FridgeTab: React.FC = ({ - currentTabName, - handleTabNameChange, -}) => { +const FridgeTab: React.FC = ({ currentTabName, handleTabNameChange }) => { return (
- + = ({ - name, - ingredientCount, - linkTo, -}) => { +const FriendsFridgeItem: React.FC = ({ name, ingredientCount, linkTo }) => { return ( - +
- {`누군가의 + {`누군가의
{name}
-
- 냉장고 저장 목록 {ingredientCount}개 -
+
냉장고 저장 목록 {ingredientCount}개
diff --git a/src/components/molecules/FriendshipHeaderSettingButton.tsx b/src/components/molecules/FriendshipHeaderSettingButton.tsx index 42c49a7..ea28168 100644 --- a/src/components/molecules/FriendshipHeaderSettingButton.tsx +++ b/src/components/molecules/FriendshipHeaderSettingButton.tsx @@ -1,9 +1,7 @@ import React from 'react'; import { SettingIcon } from '@/assets/icons'; -const FriendshipHeaderSettingButton: React.FC<{ onClick: () => void }> = ({ - onClick, -}) => { +const FriendshipHeaderSettingButton: React.FC<{ onClick: () => void }> = ({ onClick }) => { return ( )} {!headerLeft && (
-

- {typeof headerTitle === 'string' ? headerTitle : ''} -

+

{typeof headerTitle === 'string' ? headerTitle : ''}

)} {headerRight ??
} diff --git a/src/components/organisms/ShareDetailAuthorBottomWrapper.tsx b/src/components/organisms/ShareDetailAuthorBottomWrapper.tsx index 66365e6..0bc7959 100644 --- a/src/components/organisms/ShareDetailAuthorBottomWrapper.tsx +++ b/src/components/organisms/ShareDetailAuthorBottomWrapper.tsx @@ -1,10 +1,4 @@ -import { - Modal, - ModalBody, - ModalContent, - ModalOverlay, - useDisclosure, -} from '@chakra-ui/react'; +import { Modal, ModalBody, ModalContent, ModalOverlay, useDisclosure } from '@chakra-ui/react'; import { Button, RadioButtonField } from '@/components/atoms'; import React from 'react'; @@ -23,11 +17,7 @@ const ShareDetailAuthorBottomWrapper: React.FC<{ curStatus: SortLabel; onChangeStatus: React.Dispatch>; }> = ({ id, curStatus, onChangeStatus }) => { - const { - isOpen: isStatusModalOpen, - onOpen: onStatusModalOpen, - onClose: onStatusModalClose, - } = useDisclosure(); + const { isOpen: isStatusModalOpen, onOpen: onStatusModalOpen, onClose: onStatusModalClose } = useDisclosure(); const { isOpen: isParticipantsModalOpen, onOpen: onParticipantsModalOpen, @@ -39,11 +29,7 @@ const ShareDetailAuthorBottomWrapper: React.FC<{ return ( <>
-
- + ))}
-
@@ -105,20 +82,10 @@ const ShareDetailAuthorBottomWrapper: React.FC<{ >
- {applicants?.map((ele, idx) => ( - - ))} + {applicants?.map((ele, idx) => )}
-
diff --git a/src/components/templates/ErrorFallback.tsx b/src/components/templates/ErrorFallback.tsx index 9dfa73b..e847260 100644 --- a/src/components/templates/ErrorFallback.tsx +++ b/src/components/templates/ErrorFallback.tsx @@ -1,11 +1,7 @@ -import React from 'react'; import { Button } from '../atoms'; +import React from 'react'; -const ErrorFallback: React.FC = ({ - resetErrorBoundary, -}: { - resetErrorBoundary?: () => void; -}) => { +const ErrorFallback: React.FC = ({ resetErrorBoundary }: { resetErrorBoundary?: () => void }) => { const handleRefresh = () => { if (resetErrorBoundary) { resetErrorBoundary(); @@ -14,15 +10,9 @@ const ErrorFallback: React.FC = ({ return (
-
+
에러 발생!
-
diff --git a/src/components/templates/FriendListTemplate.tsx b/src/components/templates/FriendListTemplate.tsx index a2918ab..f0a4c3f 100644 --- a/src/components/templates/FriendListTemplate.tsx +++ b/src/components/templates/FriendListTemplate.tsx @@ -1,19 +1,10 @@ -import { - Modal, - ModalBody, - ModalContent, - ModalOverlay, - useDisclosure, -} from '@chakra-ui/react'; +import { Modal, ModalBody, ModalContent, ModalOverlay, useDisclosure } from '@chakra-ui/react'; import React, { useCallback, useEffect, useRef, useState } from 'react'; import { type SortLabel } from '@/types/common'; import { Button, RadioButtonField, SortButton } from '@/components/atoms'; import { FriendListItem } from '../organisms'; -import { - useDeleteFriendship, - useGetFriendships, -} from '@/hooks/queries/friendship'; +import { useDeleteFriendship, useGetFriendships } from '@/hooks/queries/friendship'; import type { FriendshipData, FriendshipSortType } from '@/types/friendship'; import { SuspenseFallback } from '.'; import { useObserver } from '@/hooks/useObserver'; @@ -23,16 +14,10 @@ const SORT_TYPES: SortLabel[] = [ { label: '등록순', value: 'createdAt' }, ]; -const FriendListTemplate: React.FC<{ possibleDelete: boolean }> = ({ - possibleDelete, -}) => { +const FriendListTemplate: React.FC<{ possibleDelete: boolean }> = ({ possibleDelete }) => { const bottom = useRef(null); const { isOpen, onOpen, onClose } = useDisclosure(); - const { - isOpen: deleteIsOpen, - onOpen: deleteOnOpen, - onClose: deleteOnClose, - } = useDisclosure(); + const { isOpen: deleteIsOpen, onOpen: deleteOnOpen, onClose: deleteOnClose } = useDisclosure(); const [curSortType, setCurSortType] = useState(SORT_TYPES[0]); const [selectedFriendIds, setSelectedFriendIds] = useState([]); const { @@ -95,9 +80,7 @@ const FriendListTemplate: React.FC<{ possibleDelete: boolean }> = ({
-

- 총 {friendsData?.pages[0].totalElements}명 -

+

총 {friendsData?.pages[0].totalElements}명

@@ -116,11 +99,7 @@ const FriendListTemplate: React.FC<{ possibleDelete: boolean }> = ({ /> )), )} - {isFetchingfriendsNextPage ? ( - - ) : ( -
- )} + {isFetchingfriendsNextPage ? :
}
{possibleDelete ? ( @@ -134,25 +113,12 @@ const FriendListTemplate: React.FC<{ possibleDelete: boolean }> = ({
) : null} - + - +

친구삭제

-

- 삭제하기 버튼을 누르면 친구 목록에서 삭제됩니다. -

+

삭제하기 버튼을 누르면 친구 목록에서 삭제됩니다.

- {curTab.value === 'list' ? ( - - ) : ( - - )} + {curTab.value === 'list' ? : }
); }; diff --git a/src/pages/share/[id].tsx b/src/pages/share/[id].tsx index f088f38..7648ac5 100644 --- a/src/pages/share/[id].tsx +++ b/src/pages/share/[id].tsx @@ -9,19 +9,6 @@ import Image from 'next/image'; import { useRouter } from 'next/router'; import React, { useEffect, useState } from 'react'; -// const MOCK_DATA = { -// shareerName: '김지수', -// image: '', -// title: '사과받아갈사람선착순12345명', -// ingredient: '사과', -// fixedNum: 15, -// useByDate: dayjs('2024-02-30'), -// meetingDate: dayjs('2024-02-20'), -// meetingTime: '14:00', -// meetingLocation: '디지털시티역 8번출구 뜌레주르앞', -// desc: '사과는역시청송사과맛있음은당연보장선착순1명사과는역시청송사과맛있음은당연보장선착순1명사과는역체시청송사과맛있음은당연보장선착순1명사과는역시청송사과맛있음은당연보장선착순1명은당연보장선착순1명사당연', -// }; - const MOCK_DATA_IS_AUTHOR: boolean = true; const MOCK_DATA_SHARE_STATUS = { label: '나눔 신청', value: 'enroll' }; diff --git a/src/stories/ToastMessage.stories.tsx b/src/stories/ToastMessage.stories.tsx index 9cef5b2..0bddbf5 100644 --- a/src/stories/ToastMessage.stories.tsx +++ b/src/stories/ToastMessage.stories.tsx @@ -1,8 +1,9 @@ +import { RecoilRoot, useRecoilState } from 'recoil'; + import React from 'react'; +import { ToastMessage } from '../components/atoms'; import type { ToastType } from '../stores/toastState'; import { toastState } from '../stores/toastState'; -import { ToastMessage } from '../components/atoms'; -import { RecoilRoot, useRecoilState } from 'recoil'; export default { title: 'ToastMessage', @@ -39,10 +40,7 @@ const Template: any = (args: ToastStoryArgs) => { return (
{toast.isOpen && } -
diff --git a/src/utils/buildQuery.ts b/src/utils/buildQuery.ts index f0971d4..6ccdaf6 100644 --- a/src/utils/buildQuery.ts +++ b/src/utils/buildQuery.ts @@ -1,8 +1,6 @@ export const buildQuery = (param: Record) => { const queryParam = Object.fromEntries( - Object.entries(param).filter( - ([, value]) => value !== '' && value !== null && value !== undefined, - ), + Object.entries(param).filter(([, value]) => value !== '' && value !== null && value !== undefined), ); return new URLSearchParams(queryParam).toString(); }; diff --git a/src/utils/debounceUtil.ts b/src/utils/debounceUtil.ts index 813d843..259f70e 100644 --- a/src/utils/debounceUtil.ts +++ b/src/utils/debounceUtil.ts @@ -1,9 +1,6 @@ -import debounce from 'lodash/debounce'; import type { DebouncedFunc } from 'lodash'; +import debounce from 'lodash/debounce'; -export const debounceFunction = void>( - func: T, - delay: number, -): DebouncedFunc => { +export const debounceFunction = void>(func: T, delay: number): DebouncedFunc => { return debounce(func, delay); };