Skip to content

Commit f2016d9

Browse files
authored
Merge pull request #165 from WishPool-dev/feat/#164-product-image
[Feat] 상품 이미지 추가
2 parents 65372c9 + 3546550 commit f2016d9

13 files changed

Lines changed: 36 additions & 15 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"packageManager": "pnpm@10.11.0",
66
"scripts": {
7-
"dev": "next dev",
7+
"dev": "next dev --webpack",
88
"build": "next build --webpack",
99
"start": "next start",
1010
"lint": "eslint .",

src/app/pick/list/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ const ListPage = () => {
2020
<span>{items.length}</span>
2121
</div>
2222
<section className="grid grid-cols-2 gap-[1.1rem]">
23-
{items.map(({ giftId, itemName, itemUrl }) => (
23+
{items.map(({ giftId, itemName, itemUrl, imageUrl }) => (
2424
<GiftCard
2525
key={giftId}
2626
giftId={giftId}
2727
itemName={itemName}
2828
itemUrl={itemUrl}
29+
imageUrl={imageUrl}
2930
/>
3031
))}
3132
</section>

src/app/pick/preview/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ const PreviewPage = () => {
4848
<h1 className="text-blue-primary caption1">최종 점검</h1>
4949
<h2 className="head1 text-text">최종 선택한 선물</h2>
5050
<section className="my-[2.8rem] space-y-[1.2rem]">
51-
{pickedItems.map(({ giftId, itemName, itemUrl }) => (
51+
{pickedItems.map(({ giftId, itemName, itemUrl, imageUrl }) => (
5252
<GiftCard
5353
key={giftId}
5454
size="big"
5555
giftId={giftId}
5656
itemName={itemName}
5757
itemUrl={itemUrl}
58+
imageUrl={imageUrl}
5859
/>
5960
))}
6061
</section>

src/app/pick/select/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const SelectPage = () => {
5252
className="no-scrollbar bg-blue-5 flex snap-x snap-mandatory gap-[2.4rem] overflow-x-auto overflow-y-hidden px-[2rem] pt-[7rem] pb-[5rem]"
5353
>
5454
<div aria-hidden className="w-[calc(50vw-9rem)] shrink-0 snap-none" />
55-
{items.map(({ giftId, itemName, itemUrl }, i) => (
55+
{items.map(({ giftId, itemName, itemUrl, imageUrl }, i) => (
5656
<CarouselCard
5757
key={giftId}
5858
giftId={giftId}
@@ -61,6 +61,7 @@ const SelectPage = () => {
6161
itemName={itemName}
6262
itemUrl={itemUrl}
6363
onRemove={handleRemove}
64+
imageUrl={imageUrl}
6465
/>
6566
))}
6667
<div aria-hidden className="w-[calc(50vw-9rem)] shrink-0 snap-none" />

src/app/wishpool/(viewer)/[id]/date/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ const DatePage = () => {
3636
pickDate: endDate,
3737
});
3838

39-
const chosenUrl = res.chosenUrl;
40-
sessionStorage.setItem('chosenUrl', chosenUrl);
41-
router.push(PATH.WISHPOOL_INVITE(wishpoolId));
39+
router.push(
40+
PATH.WISHPOOL_INVITE(wishpoolId) + `?chosenUrl=${res.chosenUrl}`,
41+
);
4242
} catch {
4343
alert('선물 고르기 마감일 설정에 실패했습니다.');
4444
}

src/app/wishpool/(viewer)/[id]/final/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const FinalPage = () => {
4949
giftId={giftId}
5050
itemName={giftName}
5151
itemUrl={giftImage}
52+
imageUrl={giftImage}
5253
/>
5354
),
5455
)}

src/app/wishpool/(viewer)/[id]/gifts/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const GiftPage = () => {
3030
guest={gift.guest || ''}
3131
itemName={gift.itemName}
3232
itemUrl={gift.itemUrl}
33+
imageUrl={gift.imageUrl}
3334
/>
3435
))}
3536
</div>

src/app/wishpool/(viewer)/[id]/invite/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import invite from '@/assets/images/invite.png';
77
import WishpoolShareSection from '@/components/common/WishpoolShareBox';
88
import { PATH } from '@/constants/common/path';
99
import { useGetWishpoolId } from '@/hooks/common/useGetWishpoolId';
10+
import { useGetChosenUrl } from '@/hooks/pick/useGetChosenUrl';
1011
import { ShareSectionType } from '@/types/common/ShareSectionType';
1112

1213
const getOrigin = () => {
@@ -17,7 +18,7 @@ const getOrigin = () => {
1718
const InvitePage = () => {
1819
const content = 'invite' as ShareSectionType;
1920

20-
const chosenUrl = sessionStorage.getItem('chosenUrl') || '';
21+
const chosenUrl = useGetChosenUrl();
2122
const origin = getOrigin();
2223
const inviteUrl = `${origin}${PATH.PICK_INVITE}?chosenUrl=${chosenUrl}`;
2324

src/components/pick/list/GiftCard.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Image from 'next/image';
22

3+
import { useGetWishpoolImage } from '@/api/domain/detail/hooks';
34
import GiftCardImage from '@/assets/images/gift-card.png';
45
import type { GiftCardType } from '@/types/common/giftCardType';
56

@@ -13,16 +14,19 @@ const GiftCard = ({
1314
size = 'small',
1415
giftId,
1516
itemName,
16-
//itemUrl,
17+
imageUrl,
1718
}: GiftCardProps) => {
1819
const isSmall = size === 'small';
1920

21+
const { data: imageData } = useGetWishpoolImage(imageUrl);
22+
const finalSrc = imageData && imageData.key ? imageData.key : GiftCardImage;
23+
2024
return (
2125
<div
2226
className={`bg-background-01 flex grow-1 flex-col items-center gap-[2.4rem] rounded-[16px] ${isSmall ? 'p-[2.2rem]' : 'p-[6.4rem]'}`}
2327
>
2428
<Image
25-
src={GiftCardImage}
29+
src={finalSrc}
2630
alt={`선물 카드 이미지 - ${giftId}`}
2731
width={isSmall ? 126 : 170}
2832
height={isSmall ? 126 : 170}

src/components/pick/select/CarouselCard.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { motion } from 'framer-motion';
44
import type { PanInfo } from 'framer-motion';
55
import Image from 'next/image';
66

7+
import { useGetWishpoolImage } from '@/api/domain/detail/hooks';
78
import GiftCardImage from '@/assets/images/gift-card.png';
89
import { useDeleteCard } from '@/hooks/pick/useDeleteCard';
910
import type { GiftCardType } from '@/types/common/giftCardType';
@@ -25,7 +26,7 @@ export default function CarouselCard({
2526
onRemove,
2627
giftId,
2728
itemName,
28-
// giftImage,
29+
imageUrl: imageKey,
2930
}: CarouselCardProps) {
3031
const isActive = index === activeIndex;
3132

@@ -39,6 +40,9 @@ export default function CarouselCard({
3940
handleDragEnd,
4041
} = useDeleteCard({ onRemove, id: giftId });
4142

43+
const { data: imageData } = useGetWishpoolImage(imageKey);
44+
const finalSrc = imageData && imageData.key ? imageData.key : GiftCardImage;
45+
4246
return (
4347
<>
4448
{renderSpacer && (
@@ -73,7 +77,7 @@ export default function CarouselCard({
7377
].join(' ')}
7478
>
7579
<Image
76-
src={GiftCardImage}
80+
src={finalSrc}
7781
alt="선물 카드 이미지"
7882
width={133}
7983
height={133}

0 commit comments

Comments
 (0)