Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
Binary file removed docs/screenshots/common-components-test.png
Binary file not shown.
17 changes: 17 additions & 0 deletions next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ const nextConfig: NextConfig = {
sassOptions: {
includePaths: [path.join(process.cwd(), 'src')],
},
images: {
remotePatterns: [
{
protocol: 'https',
hostname: '*.supabase.co',
pathname: '/storage/v1/object/public/**',
},
{
protocol: 'https',
hostname: 'k.kakaocdn.net',
},
{
protocol: 'http',
hostname: 'k.kakaocdn.net',
},
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
],
},
};

export default nextConfig;
9 changes: 9 additions & 0 deletions src/app/(page)/disputes/[id]/DisputePage.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,15 @@
color: var(--text-primary);
}

// ===========================
// Judgment Sub-tabs (판결 / 유형)
// ===========================

.judgmentSubTabs {
padding: fn.r(16) fn.r(20) 0;
}


// ===========================
// Judgement Placeholder
// ===========================
Expand Down
44 changes: 39 additions & 5 deletions src/app/(page)/disputes/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import StatusBadge from '@/components/ui/StatusBadge'
import CategoryIcon from '@/components/ui/CategoryIcon'
import InviteChoiceModal from '@/components/room/InviteChoiceModal'
import { useDispute, useRequestJudgment } from '@/domains/dispute/dispute.hooks'
import { useJudgment } from '@/domains/judgement/judgement.hooks'
import JudgmentResult from '@/components/judgement/JudgmentResult'
import JudgmentTypeResult from '@/components/judgement/JudgmentTypeResult'
import Tab from '@/components/ui/Tab'
import { useToastStore } from '@/stores/toastStore'
import styles from './DisputePage.module.scss'

Expand All @@ -32,13 +36,17 @@ export default function DisputePage({ params }: { params: Promise<{ id: string }

const { data: dispute, isLoading: fetchLoading } = useDispute(id)
const { mutate: requestJudgment, isPending: isJudging } = useRequestJudgment(id)

// judged(판결완료) + closed(종료) 모두 판결 결과 탭 노출
const isCompleted = dispute !== undefined && (COMPLETED_STATUSES as readonly string[]).includes(dispute.status)
// 판결 완료/종료 상태일 때만 fetch — 불필요한 API 호출 방지
const { data: judgment, isLoading: judgmentLoading } = useJudgment(id, isCompleted)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
const showToast = useToastStore((s) => s.show)

const [activeTab, setActiveTab] = React.useState('statement')
const [judgmentSubTab, setJudgmentSubTab] = React.useState<'verdict' | 'type'>('verdict')
const [showSoloModal, setShowSoloModal] = React.useState(false)
const [isInviting, setIsInviting] = React.useState(false)

const isCompleted = dispute !== undefined && (COMPLETED_STATUSES as readonly string[]).includes(dispute.status)
const canJudge = dispute?.status === 'waiting_opponent' || dispute?.status === 'both_submitted'
const isSolo = dispute !== undefined && dispute.participants.length === 1
const roleAStatement = dispute?.statements?.find((s) => s.role === 'role_a')
Expand Down Expand Up @@ -180,9 +188,35 @@ export default function DisputePage({ params }: { params: Promise<{ id: string }
)}

{isCompleted && activeTab === 'judgement' && (
<div className={styles.judgementPlaceholder}>
<p className={styles.empty}>판결 결과 준비 중</p>
</div>
<>
{/* 판결 / 유형 서브탭 — 공통 Tab 컴포넌트 사용 */}
<div className={styles.judgmentSubTabs}>
<Tab
items={[
{ label: '판결', value: 'verdict' },
{ label: '유형', value: 'type' },
]}
activeValue={judgmentSubTab}
onChange={(v) => setJudgmentSubTab(v as 'verdict' | 'type')}
/>
</div>

{judgmentLoading ? (
<div className={styles.judgementPlaceholder}>
<Spinner />
</div>
) : judgment ? (
judgmentSubTab === 'verdict' ? (
<JudgmentResult judgment={judgment} participants={dispute.participants} />
) : (
<JudgmentTypeResult judgment={judgment} participants={dispute.participants} />
)
) : (
<div className={styles.judgementPlaceholder}>
<p className={styles.empty}>판결 결과를 불러올 수 없습니다.</p>
</div>
)}
</>
)}
</div>

Expand Down
8 changes: 4 additions & 4 deletions src/app/api/disputes/[id]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const updateDisputeSchema = z

type DisputeForDetail = Prisma.DisputeGetPayload<{
include: {
participants: { include: { user: { select: { profileImageUrl: true } } } }
participants: { include: { user: { select: { nickname: true; profileImageUrl: true } } } }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nickname 쓰나요? name 안쓰고?!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 네임이에요?? 저 닉네임인줄 알았습니다 수정하도록 하겠습니다 ㅎㅎ

statements: true
}
}>
Expand All @@ -41,7 +41,7 @@ function toParticipantDto(p: DisputeForDetail['participants'][number]): DisputeP
disputeId: p.disputeId,
userId: p.userId,
role: p.role.toLowerCase() as DisputeParticipantDto['role'],
nickname: null,
nickname: p.user.nickname ?? null,
profileImageUrl: p.user.profileImageUrl ?? null,
joinedAt: p.joinedAt.toISOString(),
createdAt: p.createdAt.toISOString(),
Expand Down Expand Up @@ -105,7 +105,7 @@ export async function GET(
participants: { some: { userId } },
},
include: {
participants: { include: { user: { select: { profileImageUrl: true } } } },
participants: { include: { user: { select: { nickname: true, profileImageUrl: true } } } },
statements: true,
},
})
Expand Down Expand Up @@ -221,7 +221,7 @@ export async function PATCH(
}),
},
include: {
participants: { include: { user: { select: { profileImageUrl: true } } } },
participants: { include: { user: { select: { nickname: true, profileImageUrl: true } } } },
statements: true,
},
})
Expand Down
2 changes: 0 additions & 2 deletions src/app/api/disputes/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ function toParticipantDto(p: DisputeForList['participants'][number]): DisputePar
disputeId: p.disputeId,
userId: p.userId,
role: p.role.toLowerCase() as DisputeParticipantDto['role'],
// DisputeParticipantDto 타입에 nickname이 선언되어 있어 null로 채워 타입 불일치 방지
// 닉네임을 DB에서 조회하지 않으므로 null 반환 (타입이 string | null을 허용함)
nickname: null,
profileImageUrl: p.user.profileImageUrl ?? null,
joinedAt: p.joinedAt.toISOString(),
Expand Down
Empty file.
1 change: 0 additions & 1 deletion src/components/home/NewCaseButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export default function NewCaseButton() {
setIsCreating(true)
setErrorMessage(null)
const controller = new AbortController()
// 방 생성 + 사건 생성 두 번의 순차 API 호출을 커버할 수 있도록 30초로 설정
const timeout = setTimeout(() => controller.abort(), 30000)
try {
const roomRes = await fetch('/api/rooms', {
Expand Down
123 changes: 123 additions & 0 deletions src/components/judgement/JudgmentResult.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
@use '@/styles/abstracts/variables' as v;
@use '@/styles/abstracts/mixins' as m;
@use '@/styles/abstracts/functions' as fn;

.container {
display: flex;
flex-direction: column;
gap: fn.r(24);
padding: fn.r(16);
}

/* ──────────────────────────────────────
공통 섹션
────────────────────────────────────── */

.section {
display: flex;
flex-direction: column;
gap: fn.r(16);
}

.sectionTitle {
font-size: v.$font-size-body-m;
font-weight: v.$font-weight-semibold;
color: v.$color-black-700;
}

/* ──────────────────────────────────────
카드 (잘못 / 화해 공통)
────────────────────────────────────── */

.cards {
display: flex;
flex-direction: column;
gap: fn.r(8);
}

/* 잘못 카드 — bg-page + 내부 테두리 */
.card {
display: flex;
flex-direction: column;
gap: fn.r(8);
padding: fn.r(8) fn.r(12);
border-radius: fn.r(12);
background-color: var(--bg-page);
box-shadow: inset 0 0 0 1px var(--border-default);
}

/* 화해 제안 카드 — bg-surface-soft, 테두리 없음 */
.suggestedCard {
display: flex;
flex-direction: column;
gap: fn.r(8);
padding: fn.r(8) fn.r(12);
border-radius: fn.r(12);
background-color: var(--bg-surface-soft);
}

.cardHeader {
display: flex;
align-items: center;
gap: fn.r(8);
}

/* 아바타: 프로필 이미지 없을 때 회색 원 fallback */
.avatar {
width: fn.r(24);
height: fn.r(24);
border-radius: 50%;
overflow: hidden;
flex-shrink: 0;
}

.avatarImg {
width: 100%;
height: 100%;
object-fit: cover;
}

.avatarFallback {
width: 100%;
height: 100%;
background-color: v.$color-black-200;
}

.cardLabel {
@include m.text-label-s;
color: v.$color-black-400;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
}

.cardContent {
@include m.text-body-s;
color: v.$color-black-700;
line-height: 1.6;
}

/* AI 고지 문구 */
.aiNotice {
@include m.text-caption;
color: v.$color-black-400;
text-align: center;
}

/* ──────────────────────────────────────
화해 제안 섹션
— 선물 아이콘이 절대 위치로 우측 고정되어 아래 카드와 살짝 겹침
────────────────────────────────────── */

.reconcileSection {
position: relative;
display: flex;
flex-direction: column;
gap: fn.r(16);
}

.reconcileIcon {
position: absolute;
right: 0;
/* top 0 기준: 제목 높이(~24px) + gap(16px) = 카드 시작점(~40px)
아이콘 높이 52px → 카드에 약 12px 겹침 */
top: 0;
z-index: 1;
}
103 changes: 103 additions & 0 deletions src/components/judgement/JudgmentResult.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
'use client'

import Image from 'next/image'
import type { AiJudgmentDto } from '@/types/judgment'
import type { DisputeParticipantDto } from '@/types/dispute'
import styles from './JudgmentResult.module.scss'

interface Props {
judgment: AiJudgmentDto
participants: DisputeParticipantDto[]
}

function Avatar({ src }: { src: string | null }) {
return (
<div className={styles.avatar}>
{src
? <Image src={src} alt="" width={0} height={0} sizes="100vw" className={styles.avatarImg} />
: <div className={styles.avatarFallback} />
}
</div>
)
}

export default function JudgmentResult({ judgment, participants }: Props) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 페이지도 마찬가지로, 지금 props로 받아오고 있는데 이렇게 되면 새로고침시 데이터가 다 날라가요. 그래서
props로 넘겨주는 거보다 그냥 id를 기준으로 페이지 진입시 get API를 호출하는 것이 안전합니다.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 !

const isSolo = participants.length === 1
const participantA = participants.find((p) => p.role === 'role_a')
const participantB = participants.find((p) => p.role === 'role_b')

const showReconcile = !!judgment.aSuggestedLine || (!isSolo && !!judgment.bSuggestedLine)

return (
<div className={styles.container}>

{/* ── 판결결과 ── */}
<section className={styles.section}>
<h3 className={styles.sectionTitle}>판결결과</h3>

<div className={styles.cards}>
{judgment.aFault && (
<div className={styles.card}>
<div className={styles.cardHeader}>
<Avatar src={participantA?.profileImageUrl ?? null} />
<span className={styles.cardLabel}>{participantA?.nickname ?? 'A'}님의 잘못</span>
</div>
<p className={styles.cardContent}>{judgment.aFault}</p>
</div>
)}

{/* B의 잘못은 2인 판결에서만 노출 */}
{!isSolo && judgment.bFault && (
<div className={styles.card}>
<div className={styles.cardHeader}>
<Avatar src={participantB?.profileImageUrl ?? null} />
<span className={styles.cardLabel}>{participantB?.nickname ?? 'B'}님의 잘못</span>
</div>
<p className={styles.cardContent}>{judgment.bFault}</p>
</div>
)}
</div>

<p className={styles.aiNotice}>AI의 답변결과이니 참고용으로만 봐주세요</p>
</section>

{/* ── 화해 제안 ── */}
{showReconcile && (
<section className={styles.reconcileSection}>
<h3 className={styles.sectionTitle}>이렇게 사과해보면 어떨까요?</h3>
{/* 선물 아이콘: 제목 우측 상단 고정, 아래 카드와 살짝 겹침 */}
<Image
src="/images/characters/character-gift.png"
alt=""
width={52}
height={52}
className={styles.reconcileIcon}
/>

<div className={styles.cards}>
{judgment.aSuggestedLine && (
<div className={styles.suggestedCard}>
<div className={styles.cardHeader}>
<Avatar src={participantA?.profileImageUrl ?? null} />
<span className={styles.cardLabel}>{participantA?.nickname ?? 'A'}님</span>
</div>
<p className={styles.cardContent}>{judgment.aSuggestedLine}</p>
</div>
)}

{!isSolo && judgment.bSuggestedLine && (
<div className={styles.suggestedCard}>
<div className={styles.cardHeader}>
<Avatar src={participantB?.profileImageUrl ?? null} />
<span className={styles.cardLabel}>{participantB?.nickname ?? 'B'}님</span>
</div>
<p className={styles.cardContent}>{judgment.bSuggestedLine}</p>
</div>
)}
</div>
</section>
)}
</div>
)
}

Loading