Repository navigation
feat: 판결 결과 페이지 구현 (판결/유형 탭, JudgmentResult, JudgmentTypeResult) #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
45176cb
2d32cb4
7c205fe
9d0c982
8e502b5
d6413b9
5ba3e39
4f42530
82daceb
11c1b7f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 } } } } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nickname 쓰나요? name 안쓰고?!
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아 네임이에요?? 저 닉네임인줄 알았습니다 수정하도록 하겠습니다 ㅎㅎ |
||
| statements: true | ||
| } | ||
| }> | ||
|
|
@@ -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(), | ||
|
|
@@ -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, | ||
| }, | ||
| }) | ||
|
|
@@ -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, | ||
| }, | ||
| }) | ||
|
|
||
| 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; | ||
|
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; | ||
| } | ||
| 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) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 페이지도 마찬가지로, 지금 props로 받아오고 있는데 이렇게 되면 새로고침시 데이터가 다 날라가요. 그래서
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
| ) | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.