Skip to content

Commit e8f56fc

Browse files
committed
feat: add empty state for replies and questions
1 parent 4d5e95e commit e8f56fc

File tree

2 files changed

+60
-27
lines changed

2 files changed

+60
-27
lines changed

apps/client/src/components/qna/QuestionDetail.tsx

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,25 @@ function QuestionDetail() {
5454
{question.body}
5555
</Markdown>
5656
</div>
57-
{question.replies
58-
.sort((a, b) => {
59-
if (b.isHost !== a.isHost) {
60-
return b.isHost ? 1 : -1;
61-
}
62-
return a.replyId - b.replyId;
63-
})
64-
.map((r) => (
65-
<ReplyItem key={r.replyId} question={question} reply={r} />
66-
))}
57+
{question.replies.length === 0 ? (
58+
<div className='inline-flex h-full w-full select-none items-center justify-center'>
59+
<div className='font-header text-5xl opacity-30'>
60+
<span className='text-indigo-600'>A</span>
61+
<span className='text-black'>sk-It</span>
62+
</div>
63+
</div>
64+
) : (
65+
question.replies
66+
.sort((a, b) => {
67+
if (b.isHost !== a.isHost) {
68+
return b.isHost ? 1 : -1;
69+
}
70+
return a.replyId - b.replyId;
71+
})
72+
.map((r) => (
73+
<ReplyItem key={r.replyId} question={question} reply={r} />
74+
))
75+
)}
6776
</div>
6877
</div>
6978
{Modal}

apps/client/src/components/qna/QuestionList.tsx

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,13 @@ function QuestionList() {
103103

104104
const sessionButtons = [
105105
{
106-
icon: <IoShareSocialOutline />,
107-
label: '공유',
106+
key: '공유',
107+
button: (
108+
<div className='flex w-full cursor-pointer flex-row items-center gap-2'>
109+
<IoShareSocialOutline />
110+
<p>공유</p>
111+
</div>
112+
),
108113
onClick: async () => {
109114
const shareUrl = `${window.location.origin}/session/${sessionId}`;
110115

@@ -125,13 +130,23 @@ function QuestionList() {
125130
},
126131
},
127132
{
128-
icon: <GrValidate />,
129-
label: '호스트 설정',
133+
key: '호스트 설정',
134+
button: (
135+
<div className='flex w-full cursor-pointer flex-row items-center gap-2'>
136+
<GrValidate />
137+
<p>호스트 설정</p>
138+
</div>
139+
),
130140
onClick: () => openSessionParticipantsModal(),
131141
},
132142
{
133-
icon: <IoClose />,
134-
label: '세션 종료',
143+
key: '세션 종료',
144+
button: (
145+
<div className='flex w-full cursor-pointer flex-row items-center gap-2 text-red-600'>
146+
<IoClose />
147+
<p>세션 종료</p>
148+
</div>
149+
),
135150
onClick: () => openSessionTerminateModal(),
136151
},
137152
];
@@ -170,17 +185,26 @@ function QuestionList() {
170185
</div>
171186
)}
172187
</div>
173-
<motion.div className='inline-flex h-full w-full flex-col items-start justify-start gap-4 overflow-y-auto px-8 py-4'>
174-
{sections.map((section) => (
175-
<QuestionSection
176-
key={section.title}
177-
title={section.title}
178-
initialOpen={section.initialOpen}
179-
questions={section.questions}
180-
onQuestionSelect={setSelectedQuestionId}
181-
/>
182-
))}
183-
</motion.div>
188+
{questions.length === 0 ? (
189+
<div className='inline-flex h-full w-full select-none items-center justify-center'>
190+
<div className='font-header text-5xl opacity-30'>
191+
<span className='text-indigo-600'>A</span>
192+
<span className='text-black'>sk-It</span>
193+
</div>
194+
</div>
195+
) : (
196+
<motion.div className='inline-flex h-full w-full flex-col items-start justify-start gap-4 overflow-y-auto px-8 py-4'>
197+
{sections.map((section) => (
198+
<QuestionSection
199+
key={section.title}
200+
title={section.title}
201+
initialOpen={section.initialOpen}
202+
questions={section.questions}
203+
onQuestionSelect={setSelectedQuestionId}
204+
/>
205+
))}
206+
</motion.div>
207+
)}
184208
</div>
185209
{CreateQuestion}
186210
{SessionParticipants}

0 commit comments

Comments
 (0)