diff --git a/src/pages/Pin/Pin.module.scss b/src/pages/Pin/Pin.module.scss index 2f088439..8948b298 100644 --- a/src/pages/Pin/Pin.module.scss +++ b/src/pages/Pin/Pin.module.scss @@ -38,6 +38,7 @@ border: none; background-color: transparent; color: #ffffff; + cursor: pointer; &:hover { transition: 0.3s; @@ -54,6 +55,7 @@ right: 0; background-color: transparent; color: #ffffff; + cursor: pointer; &:hover { transition: 0.3s; diff --git a/src/pages/Pin/hooks/usePinQueries.ts b/src/pages/Pin/hooks/usePinQueries.ts index adcb0ea9..a2cd19bd 100644 --- a/src/pages/Pin/hooks/usePinQueries.ts +++ b/src/pages/Pin/hooks/usePinQueries.ts @@ -26,7 +26,14 @@ const usePinQueries = ({ placeId, sortType }:QueryParam) => { / (queries[0].data?.ratingCount || 1)).toFixed(1)); } }, [queries]); - return { queries, rateValue }; + return { + pinInfo: queries[0], + latestMyReview: queries[1], + latestFollowerReview: queries[2], + myReviews: queries[3], + followersReviews: queries[4], + rateValue, + }; }; export default usePinQueries; diff --git a/src/pages/Pin/index.tsx b/src/pages/Pin/index.tsx index 798ff7a6..c12fb5a7 100644 --- a/src/pages/Pin/index.tsx +++ b/src/pages/Pin/index.tsx @@ -19,7 +19,10 @@ interface Props { export default function Pin({ placeId }:Props) { const [sortType, setSortType] = useState('createdAt'); const [mode, setMode] = useState(1); - const { queries, rateValue } = usePinQueries({ placeId, sortType }); + const { + pinInfo, latestMyReview, latestFollowerReview, + myReviews, followersReviews, rateValue, + } = usePinQueries({ placeId, sortType }); const handleSortButton = () => { if (sortType === 'createdAt') setSortType('rate'); @@ -29,13 +32,13 @@ export default function Pin({ placeId }:Props) { return (
- +
- {queries[0].data?.name} + {pinInfo.data?.name} - {queries[0].data?.category} + {pinInfo.data?.category}
@@ -45,10 +48,10 @@ export default function Pin({ placeId }:Props) {
마지막 리뷰 {' '} - {(queries[1].data?.lastDate?.replaceAll('-', '/') || '') - > (queries[2].data?.lastDate?.replaceAll('-', '/') || '') - ? queries[1].data?.lastDate?.replaceAll('-', '/') - : queries[2].data?.lastDate?.replaceAll('-', '/')} + {(latestMyReview.data?.lastDate?.replaceAll('-', '/') || '') + > (latestFollowerReview.data?.lastDate?.replaceAll('-', '/') || '') + ? latestMyReview.data?.lastDate?.replaceAll('-', '/') + : latestFollowerReview.data?.lastDate?.replaceAll('-', '/')}
@@ -81,8 +84,8 @@ export default function Pin({ placeId }:Props) { {sortType === 'createdAt' ? '최신순' : '별점순'} - {mode === 1 && (queries[3].data?.content.length !== 0 - ? queries[3].data?.content.map((item) => ( + {mode === 1 && (myReviews.data?.content.length !== 0 + ? myReviews.data?.content.map((item) => (
@@ -113,8 +116,8 @@ export default function Pin({ placeId }:Props) {
))} - {mode === 2 && (queries[4].data?.content.length !== 0 - ? queries[4].data?.content.map((item) => ( + {mode === 2 && (followersReviews.data?.content.length !== 0 + ? followersReviews.data?.content.map((item) => (
프로필