-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from openrice-canada/feat/restaurant
feat: restaurant
- Loading branch information
Showing
34 changed files
with
491 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export type RestaurantDish = { | ||
restaurant_id: string; | ||
dish_id: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { AxiosApiClientBuilder } from "../axiosIndex"; | ||
import { RestaurantDish } from "./RestaurantDishType"; | ||
|
||
const apiClient = new AxiosApiClientBuilder() | ||
.withResourceName("/restaurant-dish") | ||
.build(); | ||
|
||
export const createRestaurantDish = async ( | ||
restaurantDish: RestaurantDish | ||
): Promise<RestaurantDish> => { | ||
return apiClient.post("/restaurant-dish", restaurantDish); | ||
}; |
4 changes: 4 additions & 0 deletions
4
src/api/restaurantPaymentMethod/RestaurantPaymentMethodType.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export type RestaurantPaymentMethod = { | ||
restaurant_id: string; | ||
payment_method_id: string; | ||
}; |
12 changes: 12 additions & 0 deletions
12
src/api/restaurantPaymentMethod/restaurantPaymentMethodApiIndex.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { AxiosApiClientBuilder } from "../axiosIndex"; | ||
import { RestaurantPaymentMethod } from "./RestaurantPaymentMethodType"; | ||
|
||
const apiClient = new AxiosApiClientBuilder() | ||
.withResourceName("/restaurant-payment") | ||
.build(); | ||
|
||
export const createRestaurantPaymentMethod = async ( | ||
restaurantPaymentMethod: RestaurantPaymentMethod | ||
): Promise<RestaurantPaymentMethod> => { | ||
return apiClient.post("/restaurant-payment", restaurantPaymentMethod); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/components/card/RestaurantCard.tsx → ...components/utils/cards/RestaurantCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/components/card/ReviewCard.tsx → src/components/utils/cards/ReviewCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
type FileInputProps = { | ||
label: string; | ||
placeholder: string; | ||
value?: string | number; | ||
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void; | ||
type: React.HTMLInputTypeAttribute; | ||
className: string; | ||
}; | ||
|
||
const FileInput = ({ | ||
label, | ||
placeholder, | ||
onChange, | ||
type, | ||
className, | ||
}: FileInputProps) => { | ||
return ( | ||
<div className="flex flex-col gap-1"> | ||
<label className="text-sm font-semibold">{label}</label> | ||
<input | ||
className={`border border-gray-400 rounded-md p-2 ${className}`} | ||
type={type} | ||
placeholder={placeholder} | ||
onChange={onChange} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default FileInput; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
type NumberInputProps = { | ||
label: string; | ||
placeholder: string; | ||
value: number; | ||
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void; | ||
step: string; | ||
min?: number; | ||
max?: number; | ||
}; | ||
|
||
const TextInput = ({ | ||
label, | ||
placeholder, | ||
value, | ||
onChange, | ||
step, | ||
min, | ||
max, | ||
}: NumberInputProps) => { | ||
return ( | ||
<div className="flex flex-col"> | ||
<label>{label}</label> | ||
<input | ||
className="border border-gray-400 rounded-md p-2 mt-1" | ||
type="number" | ||
step={step} | ||
placeholder={placeholder} | ||
value={value} | ||
onChange={onChange} | ||
min={min} | ||
max={max} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default TextInput; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import DatePicker from "react-datepicker"; | ||
import "react-datepicker/dist/react-datepicker.css"; | ||
|
||
type DateInputProps = { | ||
label: string; | ||
placeholder: string; | ||
value: Date; | ||
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void; | ||
}; | ||
|
||
const DateInput = ({ label, placeholder, value, onChange }: DateInputProps) => { | ||
return ( | ||
<div className="flex flex-col"> | ||
<label>{label}</label> | ||
<DatePicker | ||
placeholderText={placeholder} | ||
onChange={(date, e: React.ChangeEvent<HTMLInputElement>) => onChange(e)} | ||
selected={value} | ||
showTimeSelect | ||
showTimeSelectOnly | ||
timeIntervals={15} | ||
timeCaption="Time" | ||
dateFormat="h:mm aa" | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default DateInput; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { IoSearch } from "react-icons/io5"; | ||
|
||
type SearchInputProps = { | ||
placeholder?: string; | ||
value: string; | ||
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void; | ||
type: React.HTMLInputTypeAttribute; | ||
}; | ||
|
||
const SearchInput: React.FC<SearchInputProps> = (props) => { | ||
return ( | ||
<div className="flex items-center h-12 w-full"> | ||
<input | ||
className="border border-gray-400 rounded-tl-md rounded-bl-md px-4 outline-none h-full w-full" | ||
type={props.type} | ||
placeholder={props.placeholder || ""} | ||
value={props.value} | ||
onChange={props.onChange} | ||
/> | ||
<button | ||
type="submit" | ||
className="bg-gray-700 h-full w-14 flex justify-center items-center rounded-tr-md rounded-br-md" | ||
> | ||
<IoSearch color="#FFFFFF" /> | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SearchInput; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
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 ( | ||
<div className="flex flex-col"> | ||
<label>{label}</label> | ||
<Select | ||
isClearable | ||
placeholder={placeholder} | ||
options={optionList} | ||
value={optionList.find(c => c.value === value)} | ||
onChange={e => { | ||
onChange(e?.value); | ||
}} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default TextInput; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
type TextInputProps = { | ||
label: string; | ||
placeholder: string; | ||
value: string | number; | ||
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void; | ||
type: React.HTMLInputTypeAttribute; | ||
}; | ||
|
||
const TextInput = ({ | ||
label, | ||
placeholder, | ||
value, | ||
onChange, | ||
type, | ||
}: TextInputProps) => { | ||
return ( | ||
<div className="flex flex-col gap-1"> | ||
<label className="text-sm font-semibold">{label}</label> | ||
<input | ||
className="border border-gray-400 rounded-md p-2" | ||
type={type} | ||
placeholder={placeholder} | ||
value={value} | ||
onChange={onChange} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default TextInput; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
interface TextareaInputProps { | ||
label?: string; | ||
placeholder: string; | ||
value: string | number; | ||
onChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void; | ||
type?: React.HTMLInputTypeAttribute; | ||
className: string; | ||
} | ||
|
||
export const TextareaInput = ({ | ||
label, | ||
placeholder, | ||
value, | ||
onChange, | ||
className, | ||
}: TextareaInputProps) => { | ||
return ( | ||
<div className="flex flex-col gap-1"> | ||
{label && <label className="text-sm font-semibold">{label}</label>} | ||
<textarea | ||
className={className} | ||
placeholder={placeholder} | ||
value={value} | ||
onChange={onChange} | ||
/> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.