Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/pages/qna/QnADetailPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ function QnADetailPage() {
placeholder="댓글을 입력해주세요..."
value={commentText}
onChange={e => setCommentText(e.target.value)}
onKeyDown={e => { if (e.key === 'Enter') handleCommentSubmit(); }}
onKeyDown={e => { if (e.key === 'Enter' && !e.nativeEvent.isComposing) handleCommentSubmit(); }}
onPaste={handlePaste}
disabled={isSubmitting}
/>
Expand Down
31 changes: 7 additions & 24 deletions frontend/src/pages/qna/QnAListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,27 +528,9 @@ function QnAListPage() {
if (!res.ok) throw new Error();
const json = await res.json();
if (json.isSuccess) {
if (isStaff) {
await authFetch(`/api/questions/${questionId}/status`, { method: 'PATCH' });
}
const newComment = {
commentId: json.result.commentId,
displayName: json.result.displayName,
content: json.result.content,
};
const update = (list) => list.map(q =>
q.questionId === questionId
? {
...q,
isResolved: isStaff ? true : q.isResolved,
previewComments: [...(q.previewComments ?? []), newComment],
commentCount: (q.commentCount ?? 0) + 1
}
: q
);
setPopularQuestions(update);
setUnresolvedQuestions(update);
setResolvedQuestions(update);
// NOTE: 댓글 작성으로 인한 '해결됨' 자동 전환 없음 (해결 처리는 운영진 수동 조작만 허용).
// previewComments / commentCount UI 갱신도 SSE comment-created 이벤트에서 단일 처리.
// 여기서 직접 상태를 업데이트하면 SSE 이벤트와 중복되어 댓글이 2개 표시되므로 제거.
setCommentInputs(prev => ({ ...prev, [questionId]: '' }));
setCommentImages(prev => ({ ...prev, [questionId]: [] }));
setCommentImagePreviews(prev => ({ ...prev, [questionId]: [] }));
Expand Down Expand Up @@ -790,7 +772,8 @@ function QnAListPage() {
{/* ── 질문 목록 ── */}
<div className={styles.questionList}>
{displayedQuestions.map(question => (
<div key={question.questionId} className={styles.questionCard}
<div key={question.questionId}
className={`${styles.questionCard} ${question.isResolved ? styles.questionCardResolved : ''}`}
onClick={() => navigate(`/sessions/${sessionId}/questions/${question.questionId}`)}>

{/* 질문 헤더 */}
Expand Down Expand Up @@ -902,7 +885,7 @@ function QnAListPage() {
placeholder="댓글을 입력해주세요..."
value={commentInputs[question.questionId] || ''}
onChange={e => handleCommentChange(question.questionId, e.target.value)}
onKeyDown={e => { if (e.key === 'Enter') handleCommentSubmit(e, question.questionId); }}
onKeyDown={e => { if (e.key === 'Enter' && !e.nativeEvent.isComposing) handleCommentSubmit(e, question.questionId); }}
onPaste={e => handleCommentPaste(e, question.questionId)}
autoFocus
/>
Expand Down Expand Up @@ -960,7 +943,7 @@ function QnAListPage() {
value={newQuestion}
onChange={e => setNewQuestion(e.target.value)}
onKeyDown={e => {
if (e.key === 'Enter') isStaff ? handleNewUnderstandCheck() : handleNewQuestion();
if (e.key === 'Enter' && !e.nativeEvent.isComposing) isStaff ? handleNewUnderstandCheck() : handleNewQuestion();
}}
onPaste={handleNewQuestionPaste}
disabled={isSubmitting}
Expand Down
103 changes: 91 additions & 12 deletions frontend/src/pages/qna/QnAListPage.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
/* ── 페이지 레이아웃 ── */
/* .pageWrapper {
background: var(--gray50);
min-height: 100vh;
} */

.page {
/* background: var(--gray50); */
display: flex;
flex-direction: column;
min-height: 100vh;
Expand All @@ -19,6 +25,7 @@
margin: 10px;
color: var(--black);
padding-top: 60px;
padding-bottom: 40px;
font-weight: 700;
line-height: normal;
}
Expand Down Expand Up @@ -108,17 +115,20 @@

/* ── 이해도 바 ── */
.understandBar {
padding: 8px 16px;
margin-top: 20px;
margin-bottom: 20px;
margin-bottom: 30px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
border-radius: 10px;
border: 1px solid var(--dark);
background: var(--white);
box-shadow: 1px 2px 3px 0 rgba(0, 0, 0, 0.25);
box-shadow: none;
width: 100%;
height: 56px;
min-height: 56px;
padding: 10px 16px;
box-sizing: border-box;
}

Expand All @@ -129,6 +139,8 @@
color: var(--gray600);
display: flex;
align-items: center;
align-self: center;
flex-shrink: 0;
padding: 0;
line-height: 1;
}
Expand All @@ -145,12 +157,18 @@
font-size: 24px;
font-weight: 500;
color: var(--black);
/* padding: 12px */
}

.longText {
font-size: 19px;
}

.understandCount {
font-weight: 300;
color: var(--black);
font-size: 18px;
white-space: nowrap;
}

/* ── O/X 버튼 ── */
Expand Down Expand Up @@ -207,18 +225,35 @@
}

.questionCard {
padding: 14px 16px;
padding: 16px 18px;
cursor: pointer;
transition: box-shadow 0.2s;
border-radius: 30px;
border-radius: 20px;
background: var(--white);
box-shadow: 1px 2px 3px 0 rgba(0, 0, 0, 0.25);
box-shadow:
0 1px 4px rgba(0,0,0,0.06),
0 0 0 1px rgba(0,0,0,0.03);
width: 95%;
box-sizing: border-box;
min-height: 40px;
}

/* 해결된 질문: 미해결 질문과 한눈에 구분되도록 배경을 연한 회색으로 + 카드 전체를 흐리게 처리 (초록 테두리는 미해결 질문 전용이므로 제외) */
.questionCardResolved {
background: var(--gray50);
opacity: 0.6;
border-color: transparent;
box-shadow:
0 1px 4px rgba(0,0,0,0.06),
0 0 0 1px rgba(0,0,0,0.03);
}

.questionCard:hover {
transform: translateY(-1px);
box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.15);
}

.questionCardResolved:hover {
box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.15);
}

Expand Down Expand Up @@ -620,7 +655,13 @@
}

.understandName {
font-size: 20px;
font-size: 18px;
}

.longText {
font-size: 17px;
margin: 15px;

}

.understandCount {
Expand All @@ -637,6 +678,40 @@
}
}

/* ════════════════════════════════════════
반응형 — (600px 이하)
════════════════════════════════════════ */
@media (max-width: 600px) {
.understandBar {
padding: 10px 12px;
gap: 4px;
}

.understandName {
font-size: 18px;
margin: 6px
}

.longText {
font-size: 15px;
margin: 8px
}

.understandCount {
font-size: 15px;
}

.oxBtn {
width: 32px;
height: 32px;
}

.arrowBtn svg {
width: 24px;
height: 24px;
}
}


/* ════════════════════════════════════════
반응형 — 모바일 (480px 이하)
Expand All @@ -661,23 +736,27 @@

/* ── 이해도 바 ── */
.understandBar {
height: auto;
min-height: 48px;
padding: 8px 10px;
flex-wrap: wrap;
}

.understandName {
font-size: 17px;
font-size: 18px;
margin: 6px
}

.longText {
font-size: 15px;
margin: 8px
}

.understandCount {
font-size: 14px;
}

.oxBtn {
width: 30px;
height: 30px;
width: 29px;
height: 29px;
font-size: 12px;
margin: 0 2px;
}
Expand Down
118 changes: 60 additions & 58 deletions frontend/src/pages/qna/QnAMainPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,69 +44,71 @@ function QNAMainPage() {
if (error) return <div className={styles.page}>오류: {error}</div>;

return (
<div className={styles.page}>
<div className={styles.pageWrapper}>
<div className={styles.page}>

{/* ── 진행 중인 세션 ── */}
{activeSessions.length > 0 && (
<>
<section className={styles.section}>
<h2 className={styles.sectionTitle}>현재 세션</h2>
{activeSessions.map(session => (
<div
key={session.sessionId}
className={styles.card}
onClick={() => navigate(`/sessions/${session.sessionId}/questions`, { state: { status: 'IN_SESSION' } })}
>
<p className={styles.cardTitle}>
<span className={styles.icon}>{getIcon(session.dayPart)}</span>
{session.title}
</p>
<p className={styles.cardWeek}>
{session.week}주차 {DAY_OF_WEEK_KO[session.dayOfWeek]} {DAY_PART_KO[session.dayPart]}
</p>
<p className={styles.cardDate}>{formatDate(session.sessionDate)}</p>
<p className={styles.cardTime}>{getTime(session.dayPart)}</p>
</div>
))}
</section>
<hr className={styles.divider} />
</>
)}
{/* ── 진행 중인 세션 ── */}
{activeSessions.length > 0 && (
<>
<section className={styles.section}>
<h2 className={styles.sectionTitle}>현재 세션</h2>
{activeSessions.map(session => (
<div
key={session.sessionId}
className={styles.card}
onClick={() => navigate(`/sessions/${session.sessionId}/questions`, { state: { status: 'IN_SESSION' } })}
>
<p className={styles.cardTitle}>
<span className={styles.icon}>{getIcon(session.dayPart)}</span>
{session.title}
</p>
<p className={styles.cardWeek}>
{session.week}주차 {DAY_OF_WEEK_KO[session.dayOfWeek]} {DAY_PART_KO[session.dayPart]}
</p>
<p className={styles.cardDate}>{formatDate(session.sessionDate)}</p>
<p className={styles.cardTime}>{getTime(session.dayPart)}</p>
</div>
))}
</section>
<hr className={styles.divider} />
</>
)}

{/* ── 지난 세션 ── */}
{pastSessions.length > 0 && (
<section className={styles.section}>
<h2 className={styles.sectionTitle}>지난 세션</h2>
<div className={styles.list}>
{pastSessions.map(session => (
<div
key={session.sessionId}
className={styles.listItem}
onClick={() => navigate(`/sessions/${session.sessionId}/questions`, { state: { status: 'AFTER_SESSION' } })}
>
<span>
<span className={styles.icon}>{getIcon(session.dayPart)}</span>
<span className={styles.listTitle}>{session.title}</span>
<span className={styles.listWeek}>
&nbsp;• {session.week}주차 {DAY_OF_WEEK_KO[session.dayOfWeek]} {DAY_PART_KO[session.dayPart]}
{/* ── 지난 세션 ── */}
{pastSessions.length > 0 && (
<section className={styles.section}>
<h2 className={styles.sectionTitle}>지난 세션</h2>
<div className={styles.list}>
{pastSessions.map(session => (
<div
key={session.sessionId}
className={styles.listItem}
onClick={() => navigate(`/sessions/${session.sessionId}/questions`, { state: { status: 'AFTER_SESSION' } })}
>
<span>
<span className={styles.icon}>{getIcon(session.dayPart)}</span>
<span className={styles.listTitle}>{session.title}</span>
<span className={styles.listWeek}>
&nbsp;• {session.week}주차 {DAY_OF_WEEK_KO[session.dayOfWeek]} {DAY_PART_KO[session.dayPart]}
</span>
</span>
</span>
<button className={styles.enterBtn}>
<FiLogIn size={25} />
</button>
</div>
))}
</div>
</section>
)}
<button className={styles.enterBtn}>
<FiLogIn className={styles.enterIcon} />
</button>
</div>
))}
</div>
</section>
)}

{/* ── 세션 없을 때 ── */}
{activeSessions.length === 0 && pastSessions.length === 0 && (
<section className={styles.section}>
<p className={styles.empty}>아직 생성된 Q&A가 없어요</p>
</section>
)}
{/* ── 세션 없을 때 ── */}
{activeSessions.length === 0 && pastSessions.length === 0 && (
<section className={styles.section}>
<p className={styles.empty}>아직 생성된 Q&A가 없어요</p>
</section>
)}

</div>
</div>
);
}
Expand Down
Loading
Loading