From 6c0e446eb58e957299bf6001851673dddefd5bed Mon Sep 17 00:00:00 2001 From: ttiimmothy Date: Thu, 23 Nov 2023 20:46:51 -0500 Subject: [PATCH] feat: photo --- src/api/review/reviewApiIndex.ts | 5 +- src/components/input/FileInput.tsx | 30 ------- src/components/input/NumberInput.tsx | 37 --------- src/components/input/OpeningHoursInput.tsx | 29 ------- src/components/input/SearchInput.tsx | 30 ------- src/components/input/SelectInput.tsx | 40 ---------- src/components/input/TextInput.tsx | 30 ------- src/components/input/TextareaInput.tsx | 28 ------- src/components/utils/inputs/FileInput.tsx | 10 +-- src/components/utils/inputs/NumberInput.tsx | 10 +-- .../utils/inputs/OpeningHoursInput.tsx | 13 +++- src/components/utils/inputs/SearchInput.tsx | 21 +++-- src/components/utils/inputs/SelectInput.tsx | 69 ++++++++-------- src/components/utils/inputs/TextInput.tsx | 4 +- src/components/utils/inputs/TextareaInput.tsx | 6 +- .../utils/modals/CreateReviewModal.tsx | 78 ++++++++++++------- .../utils/modals/UploadImageModal.tsx | 35 +++++++-- src/pages/restaurant/CreateRestaurantPage.tsx | 2 +- src/pages/review/UserInputPage.tsx | 2 +- src/pages/signUp/SignUpPage.tsx | 9 ++- src/utils/fileTypeToExtension.ts | 5 ++ src/utils/uploadImageService.ts | 7 +- 22 files changed, 173 insertions(+), 327 deletions(-) delete mode 100644 src/components/input/FileInput.tsx delete mode 100644 src/components/input/NumberInput.tsx delete mode 100644 src/components/input/OpeningHoursInput.tsx delete mode 100644 src/components/input/SearchInput.tsx delete mode 100644 src/components/input/SelectInput.tsx delete mode 100644 src/components/input/TextInput.tsx delete mode 100644 src/components/input/TextareaInput.tsx create mode 100644 src/utils/fileTypeToExtension.ts diff --git a/src/api/review/reviewApiIndex.ts b/src/api/review/reviewApiIndex.ts index f31da33..8b6830d 100644 --- a/src/api/review/reviewApiIndex.ts +++ b/src/api/review/reviewApiIndex.ts @@ -19,11 +19,12 @@ export const createReview = async ( createReviewDto: CreateReviewDto, imagePrefix: string, restaurantID: string, - photoCategory: string + photoCategory: string, + fileExtension?: string ): Promise => { return apiClient.post( "", - { createReviewDto, imagePrefix, restaurantID }, + { createReviewDto, imagePrefix, restaurantID, fileExtension }, { params: { photoCategory } } ); }; diff --git a/src/components/input/FileInput.tsx b/src/components/input/FileInput.tsx deleted file mode 100644 index 4acbadc..0000000 --- a/src/components/input/FileInput.tsx +++ /dev/null @@ -1,30 +0,0 @@ -type FileInputProps = { - label: string; - placeholder: string; - value?: string | number; - onChange: (event: React.ChangeEvent) => void; - type: React.HTMLInputTypeAttribute; - className: string; -}; - -const FileInput = ({ - label, - placeholder, - onChange, - type, - className, -}: FileInputProps) => { - return ( -
- - -
- ); -}; - -export default FileInput; diff --git a/src/components/input/NumberInput.tsx b/src/components/input/NumberInput.tsx deleted file mode 100644 index fa42ec7..0000000 --- a/src/components/input/NumberInput.tsx +++ /dev/null @@ -1,37 +0,0 @@ -type NumberInputProps = { - label: string; - placeholder: string; - value: number; - onChange: (event: React.ChangeEvent) => void; - step: string; - min?: number; - max?: number; -}; - -const TextInput = ({ - label, - placeholder, - value, - onChange, - step, - min, - max, -}: NumberInputProps) => { - return ( -
- - -
- ); -}; - -export default TextInput; diff --git a/src/components/input/OpeningHoursInput.tsx b/src/components/input/OpeningHoursInput.tsx deleted file mode 100644 index 6f0ff6e..0000000 --- a/src/components/input/OpeningHoursInput.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import DatePicker from "react-datepicker"; -import "react-datepicker/dist/react-datepicker.css"; - -type DateInputProps = { - label: string; - placeholder: string; - value: Date; - onChange: (event: React.ChangeEvent) => void; -}; - -const DateInput = ({ label, placeholder, value, onChange }: DateInputProps) => { - return ( -
- - ) => onChange(e)} - selected={value} - showTimeSelect - showTimeSelectOnly - timeIntervals={15} - timeCaption="Time" - dateFormat="h:mm aa" - /> -
- ); -}; - -export default DateInput; diff --git a/src/components/input/SearchInput.tsx b/src/components/input/SearchInput.tsx deleted file mode 100644 index 45ff853..0000000 --- a/src/components/input/SearchInput.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { IoSearch } from "react-icons/io5"; - -type SearchInputProps = { - placeholder?: string; - value: string; - onChange: (event: React.ChangeEvent) => void; - type: React.HTMLInputTypeAttribute; -}; - -const SearchInput: React.FC = (props) => { - return ( -
- - -
- ); -}; - -export default SearchInput; diff --git a/src/components/input/SelectInput.tsx b/src/components/input/SelectInput.tsx deleted file mode 100644 index 7216c19..0000000 --- a/src/components/input/SelectInput.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import Select from 'react-select'; - -interface ICategory { - value: string; - label: string; -} - -type SelectInputProps = { - label: string; - placeholder: string; - value: string; - onChange: (...event: unknown[]) => void - optionList: ICategory[]; - }; - - const TextInput = ({ - label, - placeholder, - value, - onChange, - optionList, - }: SelectInputProps) => { - return ( -
- - -
- ); -}; - -export default TextInput; diff --git a/src/components/input/TextareaInput.tsx b/src/components/input/TextareaInput.tsx deleted file mode 100644 index ec95729..0000000 --- a/src/components/input/TextareaInput.tsx +++ /dev/null @@ -1,28 +0,0 @@ -interface TextareaInputProps { - label?: string; - placeholder: string; - value: string | number; - onChange: (event: React.ChangeEvent) => void; - type?: React.HTMLInputTypeAttribute; - className: string; -} - -export const TextareaInput = ({ - label, - placeholder, - value, - onChange, - className, -}: TextareaInputProps) => { - return ( -
- {label && } -