Skip to content

Commit 29c5b61

Browse files
authored
Merge pull request #115 from YAPP-Github/refactor/PRODUCT-219
refactor: 1차 스프린트 전 수정사항 적용 (#114)
2 parents 1c06369 + 543ace5 commit 29c5b61

File tree

15 files changed

+202
-26
lines changed

15 files changed

+202
-26
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"es-toolkit": "^1.39.7",
3232
"iron-session": "^8.0.4",
3333
"ky": "1.7.5",
34-
"motion": "^12.23.11",
3534
"lottie-react": "^2.4.1",
35+
"motion": "^12.23.11",
3636
"next": "15.3.2",
3737
"overlay-kit": "^1.8.4",
3838
"react": "^19.0.0",
@@ -41,6 +41,7 @@
4141
"react-simplikit": "^0.0.40",
4242
"react-slick": "^0.30.3",
4343
"slick-carousel": "^1.8.1",
44+
"sonner": "^2.0.6",
4445
"vaul": "^1.1.2",
4546
"zod": "^3.25.75"
4647
},

pnpm-lock.yaml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/(home)/_components/Header/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Button } from "@/components/ui/Button";
1111
import { GNB } from "@/components/ui/GNB";
1212

1313
export const Header = () => {
14-
const { data: member } = useQuery(memberQueryOptions);
14+
const { data: member } = useQuery({ ...memberQueryOptions, retry: false });
1515

1616
return (
1717
<GNB

src/app/(home)/_components/Story/Story.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { Suspense } from "@suspensive/react";
44
import { useRouter } from "next/navigation";
55
import { useRef } from "react";
6+
import { toast, Toaster } from "sonner";
67

78
import { useImageUploadContext } from "@/app/story/register/_contexts";
89
import { imageFileSchema } from "@/app/story/register/_schemas";
@@ -30,8 +31,8 @@ export const Story = () => {
3031

3132
if (!validationResult.success) {
3233
const errorMessage = validationResult.error.errors[0]?.message;
33-
// TODO: Toast 변경
34-
alert(errorMessage || "올바르지 않은 파일입니다.");
34+
35+
toast.warning(errorMessage || "올바르지 않은 파일입니다.");
3536

3637
if (fileInputRef.current) {
3738
fileInputRef.current.value = "";
@@ -64,6 +65,7 @@ export const Story = () => {
6465
<StoryList />
6566
</Suspense>
6667
</HStack>
68+
<Toaster position='bottom-center' richColors />
6769
</div>
6870
);
6971
};

src/app/(home)/_components/Story/StoryList/StoryList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import * as styles from "./StoryList.css";
1111

1212
export const StoryList = () => {
1313
const router = useRouter();
14-
const { data: stories } = useSuspenseQuery(storiesQueryOptions);
14+
const { data: stories } = useSuspenseQuery(storiesQueryOptions(20));
1515

1616
const handleStoryClick = (storyId: number) => {
1717
router.push(`/story/${storyId}`);
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,43 @@
11
import { style } from "@vanilla-extract/css";
22

3+
import { radius } from "@/styles";
4+
35
// StoreStories 컴포넌트 스타일
46
export const storeStoriesContainer = style({
57
paddingTop: "2.8rem",
68
paddingBottom: "4rem",
79
});
10+
11+
export const storyWrapper = style({
12+
position: "relative",
13+
width: "12.4rem",
14+
height: "22rem",
15+
});
16+
17+
export const overlay = style({
18+
position: "absolute",
19+
bottom: 0,
20+
left: 0,
21+
width: "100%",
22+
height: "100%",
23+
background:
24+
"linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.7) 100%)",
25+
borderRadius: radius[160],
26+
});
27+
28+
export const image = style({
29+
objectFit: "cover",
30+
borderRadius: radius[160],
31+
});
32+
33+
export const memberWrapper = style({
34+
position: "absolute",
35+
bottom: "0.8rem",
36+
left: "0.8rem",
37+
});
38+
39+
export const nickname = style({
40+
whiteSpace: "nowrap",
41+
overflow: "hidden",
42+
textOverflow: "ellipsis",
43+
});

src/app/(store)/stores/[storeId]/_components/StoreStories/StoreStories.tsx

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
"use client";
22

3+
import { useQuery } from "@tanstack/react-query";
4+
import Image from "next/image";
5+
import Link from "next/link";
6+
import { useRouter } from "next/navigation";
7+
8+
import { storeDetailQueryOptions } from "@/app/(store)/_api/shop";
9+
import { Avatar } from "@/app/member/_components/Avatar";
10+
import { storiesByKakaoIdQueryOptions } from "@/app/story/_api";
311
import CameraIcon from "@/assets/camera.svg";
412
import { Button } from "@/components/ui/Button";
513
import { Spacer } from "@/components/ui/Spacer";
@@ -10,35 +18,77 @@ import { colors } from "@/styles";
1018
import * as styles from "./StoreStories.css";
1119

1220
export const StoreStories = ({ storeId }: { storeId: number }) => {
13-
void storeId;
21+
const router = useRouter();
22+
const { data: store } = useQuery(storeDetailQueryOptions(Number(storeId)));
23+
24+
if (!store) {
25+
return (
26+
<VStack className={styles.storeStoriesContainer}>
27+
<Text>가게 정보를 불러오는 중...</Text>
28+
</VStack>
29+
);
30+
}
1431

15-
const isEmpty = true;
32+
const handleClick = () => {
33+
router.push("/");
34+
};
1635

1736
return (
1837
<VStack className={styles.storeStoriesContainer}>
19-
{isEmpty ? <EmptyStoreStories /> : <StoreStoriesContent />}
38+
<StoreStoriesContent kakaoId={store.kakaoId} />
2039

2140
<Spacer size={20} />
2241

2342
<Button variant='assistive' size='large' fullWidth>
24-
<HStack gap={6} align='center'>
25-
방문 스토리 남기기 <CameraIcon color={colors.neutral[10]} />
43+
<HStack gap={6} align='center' onClick={handleClick}>
44+
<Text typo='body1Sb'>방문 스토리 남기기</Text>
45+
<CameraIcon color={colors.neutral[10]} />
2646
</HStack>
2747
</Button>
2848
</VStack>
2949
);
3050
};
3151

32-
const StoreStoriesContent = () => {
52+
const StoreStoriesContent = ({ kakaoId }: { kakaoId: string }) => {
53+
const { data: stories } = useQuery(storiesByKakaoIdQueryOptions(kakaoId, 20));
54+
55+
if (!stories || stories.stories.length === 0) {
56+
return <EmptyStoreStories />;
57+
}
58+
3359
return (
3460
<VStack>
3561
<Text as='h3' typo='title2Sb' color='text.normal'>
3662
가게에 담긴 스토리
3763
</Text>
3864

3965
<Spacer size={16} />
40-
41-
<div>스토리들</div>
66+
<HStack gap={4}>
67+
{stories.stories.map(data => (
68+
<Link href={`/story/${data.storyId}`} key={data.storyId}>
69+
<div className={styles.storyWrapper}>
70+
<Image
71+
src={data.imageUrl}
72+
alt='스토리 이미지'
73+
className={styles.image}
74+
width={124}
75+
height={220}
76+
/>
77+
<div className={styles.overlay} />
78+
<HStack align='center' gap={4} className={styles.memberWrapper}>
79+
<Avatar memberId={data.memberId} />
80+
<Text
81+
typo='label1Sb'
82+
color='text.white'
83+
className={styles.nickname}
84+
>
85+
{data.memberNickname}
86+
</Text>
87+
</HStack>
88+
</div>
89+
</Link>
90+
))}
91+
</HStack>
4292
</VStack>
4393
);
4494
};

src/app/member/profile/_components/Banner/Banner.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
"use client";
23

34
import Image from "next/image";

src/app/member/profile/_components/MenuList/MenuList.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import * as AlertDialog from "@radix-ui/react-alert-dialog";
44
import Link from "next/link";
55
import { useRouter } from "next/navigation";
6+
import { toast, Toaster } from "sonner";
67

78
import { useDeleteSessionMutation } from "@/app/(auth)/_api/auth/auth.queries";
89
import { AlertModal } from "@/components/ui/AlertModal";
@@ -20,17 +21,20 @@ export const MenuList = () => {
2021
logout(undefined, {
2122
onSuccess: () => {
2223
// TODO: Toast 띄우기
24+
toast.success("로그아웃이 완료되었어요.");
2325
router.replace("/");
2426
},
2527
onError: error => {
2628
// TODO: Toast 띄우기
29+
toast.error("로그아웃에 실패했어요. 다시 시도해주세요.");
2730
console.error("로그아웃 실패", error);
2831
},
2932
});
3033
};
3134

3235
return (
3336
<>
37+
<Toaster position='bottom-center' richColors />
3438
<VStack as='ul' gap={8} className={styles.wrapper}>
3539
{MENU_LIST.map(menu => (
3640
<li key={menu.id} className={styles.list}>
@@ -54,6 +58,11 @@ export const MenuList = () => {
5458
size='large'
5559
className={styles.modalButton}
5660
style={{ borderRadius: "0 0 0 1.2rem" }}
61+
onClick={() =>
62+
toast.error(
63+
"로그아웃에 실패했어요. 다시 시도해주세요."
64+
)
65+
}
5766
>
5867
취소
5968
</Button>

src/app/story/[id]/_api/detail.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ export type StoryDetailResponse = {
88
imageUrl: string;
99
memberId: number;
1010
memberNickname: string;
11+
storeId: number | null;
1112
};

0 commit comments

Comments
 (0)