Skip to content

Commit

Permalink
Merge pull request #93 from Duri-Salon/fix/revert-commit
Browse files Browse the repository at this point in the history
[fix] revert commit 된 부분 복구, 중복 이름 훅 수정
  • Loading branch information
seungboshim authored Dec 20, 2024
2 parents a66d824 + 1369ca3 commit 0f3efa5
Show file tree
Hide file tree
Showing 15 changed files with 114 additions and 77 deletions.
7 changes: 4 additions & 3 deletions apps/duri/src/components/home/ShopHorizontal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import { useState } from 'react';
import { BottomSheet } from 'react-spring-bottom-sheet';
import { useNavigate } from 'react-router-dom';

import ShopDefaultImage from '@assets/images/pngs/ShopDefaultImage.png';
import { RegularShopType } from '@duri/assets/types/shop';
import {
Button,
Flex,
HeightFitFlex,
Image,
NextArrow,
ProfileImage,
Send,
Star,
Text,
Expand Down Expand Up @@ -46,11 +47,11 @@ export const ShopHorizontal = ({
shopList.map((shop: RegularShopType) => (
<HeightFitFlex key={shop.shopId} justify="flex-start" gap={15}>
<ImageBox onClick={() => handleClickShop(shop.shopId)}>
<ProfileImage
<Image
width={100}
height={100}
borderRadius={8}
src={shop.imageURL}
src={shop.imageURL ?? ShopDefaultImage}
/>
</ImageBox>
<Flex
Expand Down
53 changes: 27 additions & 26 deletions apps/duri/src/components/home/ShopVertical.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useNavigate } from 'react-router-dom';

import ShopDefaultImage from '@assets/images/pngs/ShopDefaultImage.png';
import { RecommendedShopType } from '@duri/assets/types/shop';
import { Button, Flex, HeightFitFlex, Image, Text, theme } from '@duri-fe/ui';
import { getShortenedAddress } from '@duri-fe/utils';
Expand All @@ -23,42 +24,42 @@ export const ShopVertical = ({
justify="flex-start"
align="flex-start"
width={152}
height={200}
padding="3px"
onClick={() => handleClickShop(shop.shopId)}
>
{shop.imageURL ? (
<Image
width={146}
height={81}
borderRadius={8}
src={shop.imageURL}
/>
) : (
<Flex
backgroundColor={theme.palette.Gray_White}
width={146}
height={81}
borderRadius={8}
></Flex>
)}
<HeightFitFlex direction="column" align="flex-start">
<Text typo="Title3" margin="13px 0 11px 6px">
{shop.shopName}
</Text>
<Image
width={146}
height={81}
borderRadius={8}
src={shop.imageURL === '' ? ShopDefaultImage : shop.imageURL}
/>

<Flex
direction="column"
align="flex-start"
padding="0 0 8px 0"
margin="13px 0 8px 6px"
gap={8}
>
<Text typo="Title3">{shop.shopName}</Text>
<Text
typo="Caption4"
colorCode={theme.palette.Gray500}
margin="0 0 12px 6px"
>
{getShortenedAddress(shop.address)}
</Text>
<HeightFitFlex
<Flex
direction="column"
align="flex-start"
gap={3}
margin="0 0 0 6px"
>
<TagWrapper direction="column" align="flex-start" gap={3}>
<TagWrapper
direction="column"
justify="flex-start"
align="flex-start"
gap={3}
>
{shop.shopTag1 && (
<Tag
key="tag1"
Expand Down Expand Up @@ -86,8 +87,8 @@ export const ShopVertical = ({
</Tag>
)}
</TagWrapper>
</HeightFitFlex>
</HeightFitFlex>
</Flex>
</Flex>
</Wrapper>
))}
</FitFlex>
Expand All @@ -108,6 +109,6 @@ const FitFlex = styled(HeightFitFlex)`
width: fit-content;
`;

const TagWrapper = styled(HeightFitFlex)`
const TagWrapper = styled(Flex)`
min-height: 45px;
`;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useNavigate } from 'react-router-dom';

import { Button, ResponseQuotation, theme } from '@duri-fe/ui';
import { useGetDetailQuotation } from '@duri-fe/utils';
import { useGetDetailQuotationDuri } from '@duri-fe/utils';

export const DetailResponseQuotation = ({
requestId,
Expand All @@ -11,7 +11,7 @@ export const DetailResponseQuotation = ({
handleCloseButton: () => void;
}) => {
const navigate = useNavigate();
const { data: quotationData } = useGetDetailQuotation(requestId);
const { data: quotationData } = useGetDetailQuotationDuri(requestId);
const handleClickPayment = (quotationId: number) => {
navigate('/payment', {
state: {
Expand Down
7 changes: 4 additions & 3 deletions apps/duri/src/components/quotation/RequestItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ export const RequestItem = ({
//URL에서는 요청 자체 id가 뜨게 하고, 실제 세부조회에서는 요청서의 id를 전달해서 조회할 수 있도록
};


return (
<>
{isExpired ? (
{isExpired && shops && shops.length > 0 ? (
<Card
borderRadius={16}
shadow="small"
Expand All @@ -33,7 +34,7 @@ export const RequestItem = ({
createdAt={createdAt}
expiredAt={expiredAt}
shopName={
shops.length > 1
shops?.length > 1
? `${shops[0].shopName}${shops.length - 1}`
: `${shops[0].shopName}`
}
Expand All @@ -42,7 +43,7 @@ export const RequestItem = ({
<Seperator height="2px" colorCode={theme.palette.Gray50} />
<Flex justify="flex-start" padding="0 11px" margin="20px 0">
<Text typo="Caption3" colorCode={theme.palette.Gray300}>
{shops && shops.length > 1
{shops?.length > 1
? `${shops[0]?.shopName}${shops.length - 1}`
: `${shops[0]?.shopName}`}
</Text>
Expand Down
5 changes: 2 additions & 3 deletions apps/duri/src/pages/Auth/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useEffect } from 'react';
import { useNavigate, useSearchParams } from 'react-router-dom';

import {
DuriDog,
Flex,
MobileLayout,
NaverLogo,
Expand Down Expand Up @@ -36,7 +37,7 @@ const AuthPage = () => {
<MobileLayout>
<Container direction="column">
{/** 로고 */}
<Logo src="/images/logo.png" />
<DuriDog width={169} height={143} />
<Flex direction="column" margin="24px 0 0 0">
<Text typo="Heading">두리묭실로</Text>
<Text typo="Heading">쉽고 빠르게 예약해요!</Text>
Expand Down Expand Up @@ -76,8 +77,6 @@ const Container = styled(Flex)`
position: relative;
`;

const Logo = styled.img``;

const LoginButton = styled.button`
width: 60px;
height: 60px;
Expand Down
12 changes: 7 additions & 5 deletions apps/duri/src/pages/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const Home = () => {
const { data: petData } = useGetPetInfo();
const { data: regularListData, isPending: isPendingRegularData } =
useGetRegularShopList();

const { data: reservationData } = useGetUpcomingReservation();
const { data: recommendedListData, isPending: isPendingRecommendData } =
useGetRecommendedShopList(lat, lon);
Expand All @@ -45,17 +46,18 @@ const Home = () => {
navigate('/shop');
};

useEffect(() => {
window.scrollTo(0, 0);
}, []);

useEffect(() => {
if (coordinates) {
if (coordinates.lat && coordinates.lng) {
setLat(coordinates.lat);
setLon(coordinates.lng);
}
}, [coordinates]);

useEffect(() => {
window.scrollTo(0, 0);
}, []);

return (
<MobileLayout>
<Flex direction="column" margin="0 0 114px 0">
Expand Down Expand Up @@ -145,7 +147,7 @@ const Home = () => {
</Flex>

{/* AI 스타일링 배너 */}
<Flex margin='24px 0 0'>
<Flex margin="24px 0 0">
<a href="/ai">
<AiBanner height={100} />
</a>
Expand Down
4 changes: 3 additions & 1 deletion apps/duri/src/pages/My/MyHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ const MyHistoryPage = () => {

// 모달 토글 함수
const handleToggleModal = (requestId: number) => {
console.log(requestId)
setRequestId(requestId);
toggleModal();
};
console.log(historyData)

return (
<MobileLayout>
Expand Down Expand Up @@ -72,7 +74,7 @@ const MyHistoryPage = () => {
petName={history.petName}
visitDate={history.startDate}
dayOfWeek={history.day}
toggleModal={() => handleToggleModal(history.quotationId)}
toggleModal={() => handleToggleModal(history.requestId)}
/>
))}
</BorderLeftFlex>
Expand Down
15 changes: 5 additions & 10 deletions apps/duri/src/pages/My/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface PetInfoType {

const MyPage = () => {
// const { data: petData, isError: getPetInfoError } = useGetPetInfo();
const { data: userInfo } = useGetUserInfo();
const { data: userInfo, isSuccess: getUserInfo } = useGetUserInfo();
const { data: petListData } = useGetPetListInfo();
const [petInfo, setPetInfo] = useState<PetInfoType>();
const navigate = useNavigate();
Expand All @@ -46,11 +46,6 @@ const MyPage = () => {
navigate('/login');
};

useEffect(() => {
if (!userInfo) {
navigate('/login');
}
}, [userInfo]);

const handleClickRegisterButton = () => {
navigate('/my/pet/register');
Expand All @@ -69,7 +64,7 @@ const MyPage = () => {
<Header />
<Flex direction="column" padding="0 18px" margin="0 0 100px 0">
<>
{userInfo ? (
{getUserInfo && userInfo ? (
<>
<UserInfo
name={userInfo.name}
Expand Down Expand Up @@ -121,7 +116,7 @@ const MyPage = () => {
<Text typo="Label3" colorCode={theme.palette.Gray300}>
등록된 반려견이 없습니다.
</Text>
{userInfo && (
{getUserInfo && (
<Button
typo="Label4"
fontColor={theme.palette.White}
Expand Down Expand Up @@ -157,7 +152,7 @@ const MyPage = () => {
borderRadius={8}
gap={5}
onClick={() =>
userInfo ? handleNavigate('/my/history') : null
getUserInfo && handleNavigate('/my/history')
}
>
<Scissors width={24} height={24} />
Expand All @@ -169,7 +164,7 @@ const MyPage = () => {
backgroundColor={theme.palette.White}
borderRadius={8}
gap={10}
onClick={() => (userInfo ? handleNavigate('/my/review') : null)}
onClick={() => (getUserInfo && handleNavigate('/my/review'))}
>
<Write width={18} height={18} />
<Text typo="Label1">내가 쓴 후기</Text>
Expand Down
3 changes: 2 additions & 1 deletion apps/duri/src/pages/Quotation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const QuotationPage = () => {
useEffect(() => {
window.scrollTo(0, 0);
}, []);
console.log(requestList)

return (
<MobileLayout backgroundColor={theme.palette.Gray_White}>
Expand Down Expand Up @@ -52,7 +53,7 @@ const QuotationPage = () => {
)}
</Flex>
) : (
<Flex margin="92px 0 0">
<Flex margin="24px 0 0">
<Text typo="Body3" colorCode={theme.palette.Gray300}>
요청서 및 견적서가 없습니다.
</Text>
Expand Down
6 changes: 1 addition & 5 deletions apps/salon/src/pages/Auth/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ const AuthPage = () => {
<Flex direction="column" margin="24px 0 0 0">
<Text typo="Heading">두리묭실로</Text>
<Text typo="Heading">쉽고 빠르게 예약해요!</Text>
<Text
typo="Body3"
colorCode={theme.palette.Gray300}
margin="8px 0 0 0"
>
<Text typo="Body3" colorCode={theme.palette.Gray300}>
최저가 예약부터 근처 미용샵까지
</Text>
</Flex>
Expand Down
10 changes: 7 additions & 3 deletions packages/utils/src/apis/duri/hooks/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ export const useGetRecommendedShopList = (
lat: number | null,
lon: number | null,
) => {
console.log(lat, lon);
const isCoordinatesValid =
lat !== null && lon !== null && lat !== 0 && lon !== 0;

return useQuery({
queryKey: ['getRecommendedShopList', lat, lon],
queryFn: () => getRecommendedShopInfo(lat!, lon!), // null이 아닌 경우에만 호출
staleTime: 1000 * 60 * 30,
enabled: lat !== null && lon !== null, // lat과 lon이 null이 아닐 때만 활성화
queryFn: () => getRecommendedShopInfo(lat!, lon!),
staleTime: 1000 * 60 * 10,
enabled: isCoordinatesValid, // 유효한 경우에만 실행
});
};

Expand Down
3 changes: 1 addition & 2 deletions packages/utils/src/apis/duri/hooks/my.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,11 @@ export const usePutPetInfo = () => {
};

export const useGetUserInfo = () => {
const { data, isError } = useQuery({
return useQuery({
queryKey: ['getUserInfo'],
queryFn: () => getUserInfo(),
staleTime: 1000 * 60 * 30,
});
return { data, isError };
};

export const usePutUserInfo = (handleNavigate: () => void) => {
Expand Down
Loading

0 comments on commit 0f3efa5

Please sign in to comment.