Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/usePostOrderPay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'

export enum OrderPayType {
TOSS = 'TOSS_PAY',
PAY200 = 'PAY200',
PAY200 = 'PAY_200',
}

export interface OrderPay {
Expand Down
2 changes: 1 addition & 1 deletion src/app/home/_components/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Home = () => {
endpoint: 'stores/list-cursor',
filter: { category: undefined },
size: 10,
...(location && { location: { lat: location.latitude, lng: location.longitude } }),
...(member ? {location: {lat: member.address.latitude, lng: member.address.longitude}} : location && { location: { lat: location.latitude, lng: location.longitude } }),
})

const handleRefresh = async (): Promise<void> => {
Expand Down
4 changes: 3 additions & 1 deletion src/app/home/list/_components/HomeList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ const HomeList = () => {
endpoint: 'stores/list-cursor',
filter: { category, order },
size: 10,
...(location && { location: { lat: location.latitude, lng: location.longitude } }),
...(member
? { location: { lat: member.address.latitude, lng: member.address.longitude } }
: location && { location: { lat: location.latitude, lng: location.longitude } }),
})

const scrollRef = useRef<HTMLDivElement>(null)
Expand Down
8 changes: 8 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ export const metadata: Metadata = {
icons: {
icon: '/favicon.png',
},
viewport: {
width: 'device-width',
initialScale: 1,
maximumScale: 1,
},
other: {
'format-detection': 'telephone=no, address=no, email=no',
},
}

export const viewport = {
Expand Down
3 changes: 3 additions & 0 deletions src/app/mypage/address/detail/_components/MapInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client'

import { AddressResponseData } from '@/api/useGetAddress'
import useGetMember from '@/api/useGetMember'
import usePostAddress, { Address, AddressType } from '@/api/usePostAddress'
import usePutAddress from '@/api/usePutAddress'
import Icon from '@/components/Icon'
Expand Down Expand Up @@ -32,6 +33,7 @@ const MapInfo = ({
const [isAddressValid, setIsAddressValid] = useState<boolean>(false)
const { mutate: registerAddress, isPending } = usePostAddress()
const { mutate: updateAddress, isPending: isUpdatePending } = usePutAddress()
const { refetch: refetchMember } = useGetMember()

const handleAddress = () => {
if (!addressData.roadAddr) {
Expand Down Expand Up @@ -80,6 +82,7 @@ const MapInfo = ({

const _options = {
onSuccess: () => {
refetchMember()
queryClient.invalidateQueries({ queryKey: ['address'] })
hideModal()
},
Expand Down
219 changes: 110 additions & 109 deletions src/app/pay/_components/OrderInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ const OrderInfo = () => {
detailAddress: member.address.detailAddress || '',
excludingSpoonAndFork: isExcludingSpoon,
orderType: 'DELIVERY',
// paymentType,
paymentType: OrderPayType.TOSS,
paymentType,
orderMenus: cartsState.orderMenus.map((item) => {
return {
id: item.menuId,
Expand Down Expand Up @@ -335,134 +334,136 @@ const OrderInfo = () => {
}

return (
<div id="payment-method" className="my-5 flex flex-col gap-5 pb-32">
<div className="flex flex-row justify-between">
<div className="flex flex-row gap-2">
<Icon name="Bike" size={24} />
<div className="place-content-center text-sm font-bold">가게배달</div>
<div className="place-content-center text-xs">49~64분 후 도착</div>
</div>
{/* <div>
<Icon name="ChevronRight" size={24} />
</div> */}
</div>
<Separator />
<div className="flex flex-col gap-2">
<div className="flex flex-row justify-between" onClick={handleSelectRiderRequest}>
<div id="payment-method" className="relative mt-5">
<div className="flex flex-col gap-5 px-mobile_safe pb-7">
<div className="flex flex-row justify-between">
<div className="flex flex-row gap-2">
<Icon name="MapPin" size={24} />
<div className="max-w-[calc(100dvw-24px-24px-54px-1rem-40px)] place-content-center truncate text-sm font-bold">
{`${member?.address.roadAddress} ${member?.address.detailAddress}`}
</div>
<div className="place-content-center text-xs">(으)로 배달</div>
<Icon name="Bike" size={24} />
<div className="place-content-center text-sm font-bold">가게배달</div>
<div className="place-content-center text-xs">49~64분 후 도착</div>
</div>
{/* <div>
<Icon name="ChevronRight" size={24} />
</div> */}
</div>
<div>
<div className="ml-7 text-xs text-gray-700">[지번] {member?.address.jibunAddress}</div>
</div>
</div>
<div className="rounded-xl border border-solid border-gray-400">
<div className="flex flex-row justify-between border-b border-solid border-gray-300 px-5 py-4">
<div
className="cursor-pointer text-base font-extrabold"
onClick={() => router.push(`${ROUTE_PATHS.STORE_DETAIL}/${storeDetail.id}`)}
>
{storeDetail.name}
<Separator />
<div className="flex flex-col gap-2">
<div className="flex flex-row justify-between" onClick={handleSelectRiderRequest}>
<div className="flex flex-row gap-2">
<Icon name="MapPin" size={24} />
<div className="max-w-[calc(100dvw-24px-24px-54px-1rem-40px)] place-content-center truncate text-sm font-bold">
{`${member?.address.roadAddress} ${member?.address.detailAddress}`}
</div>
<div className="place-content-center text-xs">(으)로 배달</div>
</div>
<Icon name="ChevronRight" size={24} />
</div>
<div
className="cursor-pointer place-content-center text-xs text-gray-700"
onClick={handleEmptyCart}
>
전체삭제
<div>
<div className="ml-7 text-xs text-gray-700">[지번] {member?.address.jibunAddress}</div>
</div>
</div>
<div className="rounded-xl border border-solid border-gray-400">
<div className="flex flex-row justify-between border-b border-solid border-gray-300 px-5 py-4">
<div
className="cursor-pointer text-base font-extrabold"
onClick={() => router.push(`${ROUTE_PATHS.STORE_DETAIL}/${storeDetail.id}`)}
>
{storeDetail.name}
</div>
<div
className="cursor-pointer place-content-center text-xs text-gray-700"
onClick={handleEmptyCart}
>
전체삭제
</div>
</div>

<div className="flex flex-col gap-1 px-5 py-4">
{cartsState.orderMenus.map((menu, index) => (
<MenuItem
key={`${menu.menuId}-${index}`}
menu={menu}
onIncrease={handleIncreaseQuantity}
onDecrease={handleDecreaseQuantity}
onRemove={handleRemoveItem}
/>
))}
</div>
<div className="flex flex-col gap-1 px-5 py-4">
{cartsState.orderMenus.map((menu, index) => (
<MenuItem
key={`${menu.menuId}-${index}`}
menu={menu}
onIncrease={handleIncreaseQuantity}
onDecrease={handleDecreaseQuantity}
onRemove={handleRemoveItem}
/>
))}
</div>

<div className="flex flex-row items-center justify-center gap-1 border-t border-solid border-gray-300 px-5 py-4">
<Icon name="Plus" size={20} />
<div
className="cursor-pointer font-bold"
onClick={() => router.push(`${ROUTE_PATHS.STORE_DETAIL}/${storeDetail.id}`)}
>
메뉴 추가하기
<div className="flex flex-row items-center justify-center gap-1 border-t border-solid border-gray-300 px-5 py-4">
<Icon name="Plus" size={20} />
<div
className="cursor-pointer font-bold"
onClick={() => router.push(`${ROUTE_PATHS.STORE_DETAIL}/${storeDetail.id}`)}
>
메뉴 추가하기
</div>
</div>
</div>
</div>
<div className="flex flex-col gap-4 rounded-xl border border-solid border-gray-400 px-5 py-4">
<div className="text-base font-extrabold">가게 요청사항</div>
{/* <Input placeholder="예) 견과류 빼주세요" /> */}
<div className="items-top flex items-center space-x-2">
<Checkbox
id="terms1"
className="size-5 border-solid border-gray-300 outline-none data-[state=checked]:border-primary data-[state=checked]:bg-white"
checked={isExcludingSpoon}
onCheckedChange={(checked: boolean) => setIsExcludingSpoon(checked)}
/>
<Label
htmlFor="terms1"
className="text-sm font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
>
일회용 수저, 포크는 빼주세요
</Label>
</div>
<Separator />
<div className="flex flex-row justify-between">
<div className="place-content-center text-base font-extrabold">라이더 요청사항</div>
<div className="flex flex-row gap-1" onClick={handleSelectRiderRequest}>
<div className="place-content-center text-sm">요청사항 없음</div>
<Icon name="ChevronRight" size={24} />
<div className="flex flex-col gap-4 rounded-xl border border-solid border-gray-400 px-5 py-4">
<div className="text-base font-extrabold">가게 요청사항</div>
{/* <Input placeholder="예) 견과류 빼주세요" /> */}
<div className="items-top flex items-center space-x-2">
<Checkbox
id="terms1"
className="size-5 border-solid border-gray-300 outline-none data-[state=checked]:border-primary data-[state=checked]:bg-white"
checked={isExcludingSpoon}
onCheckedChange={(checked: boolean) => setIsExcludingSpoon(checked)}
/>
<Label
htmlFor="terms1"
className="text-sm font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
>
일회용 수저, 포크는 빼주세요
</Label>
</div>
</div>
</div>
<div className="flex flex-col gap-4 rounded-xl border border-solid border-gray-400 px-5 py-4">
<div className="flex flex-row justify-between" onClick={handleSelectOrderPay}>
<div className="place-content-center text-base font-extrabold">결제수단</div>
<div className="flex flex-row items-center gap-1">
<div className="place-content-center text-sm font-semibold text-primary">
{!paymentType ? (
'결제수단을 선택해주세요'
) : (
<span className="text-base font-semibold">
{paymentType === OrderPayType.TOSS ? '토스페이' : 'PAY200'}
</span>
)}
<Separator />
<div className="flex flex-row justify-between">
<div className="place-content-center text-base font-extrabold">라이더 요청사항</div>
<div className="flex flex-row gap-1" onClick={handleSelectRiderRequest}>
<div className="place-content-center text-sm">요청사항 없음</div>
<Icon name="ChevronRight" size={24} />
</div>
<Icon name="ChevronRight" size={24} />
</div>
</div>
</div>
<div className="flex flex-col gap-2 px-1">
<div className="flex flex-row justify-between">
<div>상품금액</div>
<div>{totalMenuPrice.toLocaleString()}원</div>
<div className="flex flex-col gap-4 rounded-xl border border-solid border-gray-400 px-5 py-4">
<div className="flex flex-row justify-between" onClick={handleSelectOrderPay}>
<div className="place-content-center text-base font-extrabold">결제수단</div>
<div className="flex flex-row items-center gap-1">
<div className="place-content-center text-sm font-semibold text-primary">
{!paymentType ? (
'결제수단을 선택해주세요'
) : (
<span className="text-base font-semibold">
{paymentType === OrderPayType.TOSS ? '토스페이' : 'PAY200'}
</span>
)}
</div>
<Icon name="ChevronRight" size={24} />
</div>
</div>
</div>
<div className="flex flex-row justify-between">
<div>배달요금</div>
<div>{deliveryPrice.toLocaleString()}원</div>
<div className="flex flex-col gap-2 px-1">
<div className="flex flex-row justify-between">
<div>상품금액</div>
<div>{totalMenuPrice.toLocaleString()}원</div>
</div>
<div className="flex flex-row justify-between">
<div>배달요금</div>
<div>{deliveryPrice.toLocaleString()}원</div>
</div>
</div>
</div>
<Separator />
<div className="flex flex-row justify-between px-1">
<div className="text-lg font-bold">총 결제금액</div>
<div className="text-lg font-bold">
{(totalMenuPrice + deliveryPrice).toLocaleString()}원
<Separator />
<div className="flex flex-row justify-between px-1">
<div className="text-lg font-bold">총 결제금액</div>
<div className="text-lg font-bold">
{(totalMenuPrice + deliveryPrice).toLocaleString()}원
</div>
</div>
</div>

{/* 배달비 무료 조건 추가 */}
<div className="fixed bottom-0 left-0 h-28 w-full rounded-t-2xl bg-white px-mobile_safe shadow-[0_-4px_6px_-2px_rgba(0,0,0,0.1)]">
<div className="sticky bottom-0 left-0 h-28 w-full max-w-[480px] rounded-t-2xl bg-white px-mobile_safe shadow-[0_-4px_6px_-2px_rgba(0,0,0,0.1)]">
<p
className={cn(
'py-3 text-center text-sm font-semibold text-blue-600',
Expand Down
2 changes: 1 addition & 1 deletion src/app/pay/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const PayPage = () => {
return (
<>
{member ? (
<div className="px-mobile_safe">
<div className="">
<OrderInfo />
</div>
) : (
Expand Down
6 changes: 5 additions & 1 deletion src/app/search/result/_components/SearchResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Store } from '@/models/store'
import { useGeoLocationStore } from '@/store/geoLocation'
import { useFoodSearchFilterStore } from '@/store/homeSearchFilter'
import suggestionStore from '@/store/suggestion'
import memberStore from '@/store/user'
import { useRef } from 'react'
import SearchFoodList from './SearchFoodList'

Expand All @@ -17,6 +18,7 @@ const SearchResult = () => {
const { coordinates: location } = useGeoLocationStore()
const { keyword, order } = useFoodSearchFilterStore()
const { suggestion, suggestionWord, isFocus } = suggestionStore()
const { member } = memberStore()
const { data, isFetching, targetRef, refetch } = useInfiniteScroll<
Store,
{ keyword: string | undefined; order: OrderType }
Expand All @@ -25,7 +27,9 @@ const SearchResult = () => {
endpoint: 'stores/list-cursor',
filter: { keyword, order },
size: 10,
...(location && { location: { lat: location.latitude, lng: location.longitude } }),
...(member
? { location: { lat: member.address.latitude, lng: member.address.longitude } }
: location && { location: { lat: location.latitude, lng: location.longitude } }),
})
const { mutate: postSearch } = usePostSearch()

Expand Down