Skip to content

Commit 6609f5b

Browse files
authored
[#664] [독서 모임] 참여 중인 모임 UI 개선 (#670)
* style: 독서모임 목록 카드 컴포넌트 제목 fontsize 14로 수정 * feat: 모임 만들기 유도 배너 구현 * feat: 모임 목록 페이지에서 참여 모임이 없는 경우 배너 노출 - 모임 목록 상세 카드 safe nickname 함수 적용 * fix: 모임 목록 페이지 내 참여한 모임 카드에서 모임장인 경우 뱃지 노출되도록 UI 수정 * style: 모임 생성 유도 배너 heading font size 수정 * feat: 모임 생성 유도 배너 클릭 시 모임 생성 페이지로 이동하도록 link 태그 추가
1 parent f4cc4d8 commit 6609f5b

File tree

8 files changed

+82
-28
lines changed

8 files changed

+82
-28
lines changed
5.21 KB
Loading

src/app/group/page.tsx

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import SearchGroupInput from '@/components/bookGroup/SearchGroup';
2323
import SimpleBookGroupCard, {
2424
SimpleBookGroupCardSkeleton,
2525
} from '@/components/bookGroup/SimpleBookGroupCard';
26+
import CreateGroupBanner from '@/components/bookGroup/banner/CreateGroupBanner';
2627

2728
const GroupPage = () => {
2829
const router = useRouter();
@@ -53,7 +54,7 @@ const GroupPage = () => {
5354
<div className="flex w-full flex-col gap-[2rem]">
5455
<SearchGroupInput onClick={handleSearchInputClick} />
5556
<SSRSafeSuspense fallback={<PageSkeleton />}>
56-
{isAuthenticated && <MyBookGroupList />}
57+
{isAuthenticated && <MyBookGroupSection />}
5758
<EntireBookGroupList />
5859
</SSRSafeSuspense>
5960
</div>
@@ -67,24 +68,33 @@ const GroupPage = () => {
6768

6869
export default GroupPage;
6970

70-
const MyBookGroupList = () => {
71+
const MyBookGroupSection = () => {
7172
const isAuthenticated = checkAuthentication();
7273
const {
7374
data: { bookGroups },
7475
} = useMyGroupsQuery({ enabled: isAuthenticated });
7576
const { data: myId } = useMyProfileId({ enabled: isAuthenticated });
7677

78+
// 참여한 모임이 없는 경우, 모임 생성 유도 배너 노출
79+
if (bookGroups.length === 0) {
80+
return <CreateGroupBanner />;
81+
}
82+
7783
return (
78-
<section className="flex gap-[1rem] overflow-y-hidden overflow-x-scroll pb-[1.5rem]">
79-
{bookGroups.map(({ title, book, bookGroupId, owner }) => (
80-
<SimpleBookGroupCard
81-
key={bookGroupId}
82-
title={title}
83-
imageSource={book.imageUrl}
84-
isOwner={owner.id === myId}
85-
bookGroupId={bookGroupId}
86-
/>
87-
))}
84+
<section className="flex flex-col gap-[1rem]">
85+
<h2 className="font-body1-bold">내 모임</h2>
86+
<ul className="flex gap-[1rem] overflow-y-hidden overflow-x-scroll pb-[1.5rem]">
87+
{bookGroups.map(({ title, book, bookGroupId, owner }) => (
88+
<li key={bookGroupId}>
89+
<SimpleBookGroupCard
90+
title={title}
91+
imageSource={book.imageUrl}
92+
isOwner={owner.id === myId}
93+
bookGroupId={bookGroupId}
94+
/>
95+
</li>
96+
))}
97+
</ul>
8898
</section>
8999
);
90100
};
@@ -149,6 +159,7 @@ const EntireBookGroupList = () => {
149159
return (
150160
<>
151161
<section className="flex flex-col gap-[1rem]">
162+
<h2 className="font-body1-bold">전체 모임</h2>
152163
{isSuccess &&
153164
data.pages.map(({ bookGroups }) =>
154165
bookGroups.map(
@@ -171,6 +182,7 @@ const EntireBookGroupList = () => {
171182
bookImageSrc={book.imageUrl}
172183
date={{ start: startDate, end: endDate }}
173184
owner={{
185+
id: owner.id,
174186
name: owner.nickname,
175187
profileImageSrc: owner.profileUrl,
176188
}}

src/app/profile/me/group/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ const UserGroupContent = () => {
5454
bookImageSrc={book.imageUrl}
5555
date={{ start: startDate, end: endDate }}
5656
owner={{
57+
id: owner.id,
5758
name: owner.nickname,
5859
profileImageSrc: owner.profileUrl,
5960
}}

src/components/bookGroup/DetailBookGroupCard.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import Link from 'next/link';
22

33
import { IconCalendar, IconMembers, IconComments } from '@public/icons';
4+
import { getSafeNickname } from '@/utils/converter';
5+
46
import BookGroupStatus from '@/components/bookGroup/BookGroupStatus';
57
import Badge from '@/components/common/Badge';
68
import Avatar from '@/components/common/Avatar';
@@ -11,7 +13,7 @@ interface DetailBookGroupCardProps {
1113
description: string;
1214
bookImageSrc: string;
1315
date: { start: string; end: string };
14-
owner: { name: string; profileImageSrc: string };
16+
owner: { id: number; name: string; profileImageSrc: string };
1517
memberCount: number;
1618
commentCount: number;
1719
isPublic: boolean;
@@ -37,13 +39,13 @@ const DetailBookGroupCard = ({
3739
<Public isPublic={isPublic} />
3840
</div>
3941
<div className="flex justify-between gap-[1.5rem] pt-[1rem]">
40-
<div className="flex min-w-0 flex-grow flex-col justify-between ">
42+
<div className="flex min-w-0 flex-grow flex-col justify-center gap-[0.6rem]">
4143
<Title title={title} />
4244
<Description description={description} />
4345
<Duration start={date.start} end={date.end} />
4446
<div className="flex justify-between">
4547
<Owner
46-
name={owner.name}
48+
name={getSafeNickname(owner.id, owner.name)}
4749
profileImageSrc={owner.profileImageSrc}
4850
/>
4951
<div className="flex gap-[0.5rem]">
@@ -66,23 +68,16 @@ const Public = ({ isPublic }: { isPublic: boolean }) => (
6668
);
6769

6870
const Title = ({ title }: { title: string }) => {
69-
return <p className="min-w-0 truncate font-body1-bold">{title}</p>;
71+
return <p className="min-w-0 truncate font-body2-bold">{title}</p>;
7072
};
7173

7274
const Description = ({ description }: { description: string }) => {
7375
return <p className="min-w-0 truncate font-body2-regular">{description}</p>;
7476
};
7577

7678
const Duration = ({ start, end }: { start: string; end: string }) => {
77-
const formatDateTime = (dateString: string) =>
78-
new Intl.DateTimeFormat('ko-KR', {
79-
year: 'numeric',
80-
month: '2-digit',
81-
day: '2-digit',
82-
}).format(new Date(dateString));
83-
8479
return (
85-
<div className="flex items-center gap-[0.5rem]">
80+
<div className="my-[0.2rem] flex items-center gap-[0.5rem]">
8681
<IconCalendar className="w-[1.2rem] fill-placeholder" />
8782
<p className="text-placeholder font-caption1-regular">
8883
{formatDateTime(start)} - {formatDateTime(end)}
@@ -91,6 +86,13 @@ const Duration = ({ start, end }: { start: string; end: string }) => {
9186
);
9287
};
9388

89+
const formatDateTime = (dateString: string) =>
90+
new Intl.DateTimeFormat('ko-KR', {
91+
year: 'numeric',
92+
month: '2-digit',
93+
day: '2-digit',
94+
}).format(new Date(dateString));
95+
9496
const Owner = ({
9597
name,
9698
profileImageSrc,

src/components/bookGroup/SimpleBookGroupCard.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Link from 'next/link';
2-
import BookCover from '../book/BookCover';
2+
import BookCover from '@/components/book/BookCover';
33

44
interface SimpleBookGroupCardProps {
55
title: string;
@@ -17,11 +17,16 @@ const SimpleBookGroupCard = ({
1717
return (
1818
<Link href={`/group/${bookGroupId}`}>
1919
<article className="flex w-[10rem] flex-col gap-[1rem]">
20-
<div className="bg-main-300 px-[1.8rem] py-[1.6rem]">
20+
<div className="relative rounded-[0.5rem] bg-black-100 px-[1.8rem] py-[1.6rem]">
21+
{isOwner && (
22+
<span className="absolute left-[0.6rem] top-[0.6rem] z-10 rounded-[0.5rem] bg-main-300 px-[0.6rem] py-[0.4rem] text-main-900 font-caption2-bold">
23+
운영
24+
</span>
25+
)}
2126
<BookCover size="xsmall" src={imageSource} />
2227
</div>
2328
<p className="break-keep text-center !leading-tight font-caption1-regular">
24-
{isOwner ? `👑 ${title}` : title}
29+
{title}
2530
</p>
2631
</article>
2732
</Link>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import Link from 'next/link';
2+
3+
import Image from '@/components/common/Image';
4+
5+
const CreateGroupBanner = () => {
6+
return (
7+
<Link href="/group/create">
8+
<article className="flex w-full cursor-pointer select-none items-center justify-between rounded-[0.8rem] bg-main-300 p-[2rem]">
9+
<div className="flex flex-col gap-[0.6rem]">
10+
<h3 className="text-main-900 font-body2-bold">
11+
원하는 모임이 없다면?
12+
</h3>
13+
<p className="whitespace-pre-line text-black-600 font-body2-bold">
14+
{`읽고 싶은 책으로
15+
직접 모임을 만들어 보세요`}
16+
</p>
17+
</div>
18+
<div>
19+
<Image
20+
src="/images/book-illustration.png"
21+
alt="책"
22+
width={81}
23+
height={48}
24+
loading="eager"
25+
priority
26+
/>
27+
</div>
28+
</article>
29+
</Link>
30+
);
31+
};
32+
33+
export default CreateGroupBanner;

src/stories/bookGroup/DetailBookGroupCard.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const Default: Story = {
2424
},
2525
memberCount: 3,
2626
owner: {
27+
id: 3,
2728
name: '소피아',
2829
profileImageSrc: '',
2930
},

tailwind.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = {
3131
},
3232
colors: {
3333
main: {
34-
300: '#F5F4EE',
34+
300: '#FFF7E6',
3535
400: '#FAF0DD',
3636
500: '#FFDEB6',
3737
600: '#FFD480', // use with opacity 18%

0 commit comments

Comments
 (0)