fix: 오류 수정
This commit is contained in:
@@ -3,13 +3,14 @@ import { useRef, useState, type KeyboardEvent } from "react";
|
||||
import type { components } from "../../../contracts/studio/generated.ts";
|
||||
import type { Asset } from "../../../contracts/studio/contract.ts";
|
||||
import type { DocumentEditorController } from "./document-editor-controller.ts";
|
||||
import { CaseFields } from "./case-fields.tsx";
|
||||
import { CommonDocumentFields } from "./common-document-fields.tsx";
|
||||
import { CASE_FIELD_PATHS, CaseFields } from "./case-fields.tsx";
|
||||
import { COMMON_FIELD_PATHS, CommonDocumentFields } from "./common-document-fields.tsx";
|
||||
import { DocumentStatusRail } from "./document-status-rail.tsx";
|
||||
import { InstantPreview } from "./instant-preview.tsx";
|
||||
import { ProjectDecisionFields } from "./project-decision-fields.tsx";
|
||||
import { QuestionFields } from "./question-fields.tsx";
|
||||
import { ReferenceFields } from "./reference-fields.tsx";
|
||||
import { DECISION_FIELD_PATHS, ProjectDecisionFields } from "./project-decision-fields.tsx";
|
||||
import { issuesOutside } from "./field-issues.tsx";
|
||||
import { QUESTION_FIELD_PATHS, QuestionFields } from "./question-fields.tsx";
|
||||
import { REFERENCE_FIELD_PATHS, ReferenceFields } from "./reference-fields.tsx";
|
||||
|
||||
type CatalogEntry = components["schemas"]["CatalogEntry"];
|
||||
|
||||
@@ -48,6 +49,23 @@ export function DocumentEditor({
|
||||
const relations = catalog.filter(({ type }) => type === "RELATION");
|
||||
const evidence = catalog.filter(({ type }) => type === "EVIDENCE");
|
||||
|
||||
/*
|
||||
게시를 막는 것이 무엇인지 그 칸 아래에 적는다. 예전에는 이 목록이 화면 맨 위에 한 덩어리로
|
||||
있었고, 작성자는 `/topicId` 같은 경로를 읽고 어느 칸인지 스스로 찾아야 했다.
|
||||
|
||||
어느 칸에도 붙지 못한 것은 게시 버튼 옆에 남긴다 — 사라지면 이유를 말해 주지 않는 실패만
|
||||
남는다.
|
||||
*/
|
||||
const issues = controller.publishIssues;
|
||||
const kindPaths = controller.draft.kind === "CASE"
|
||||
? CASE_FIELD_PATHS
|
||||
: controller.draft.kind === "REFERENCE"
|
||||
? REFERENCE_FIELD_PATHS
|
||||
: controller.draft.kind === "QUESTION"
|
||||
? QUESTION_FIELD_PATHS
|
||||
: DECISION_FIELD_PATHS;
|
||||
const unplaced = issuesOutside(issues, [...COMMON_FIELD_PATHS, ...kindPaths]);
|
||||
|
||||
return (
|
||||
<div className="studio-editor-page">
|
||||
<div className="studio-editor-tabs" role="tablist" aria-label="문서 편집 화면">
|
||||
@@ -62,49 +80,20 @@ export function DocumentEditor({
|
||||
<h1>문서 편집</h1>
|
||||
<p>{controller.draft.title || "제목 없는 작업본"}</p>
|
||||
</header>
|
||||
{/*
|
||||
게시를 막는 것이 무엇인지 고치는 자리에서 보여 준다. 예전에는 별도 검증 화면으로
|
||||
나가야만 알 수 있었고, 돌아와서는 어느 칸이었는지 기억해야 했다.
|
||||
|
||||
검증은 저장된 버전을 기준으로 도므로 이 목록도 그 버전의 것이다 — 저장한 뒤 다시
|
||||
검증하기 전까지는 방금 고친 것이 아직 반영되지 않는다. 그 사실을 숨기지 않는다.
|
||||
*/}
|
||||
{controller.validation && controller.validation.issues.length ? (
|
||||
<section
|
||||
className={`studio-editor-validation${controller.validation.current ? "" : " studio-editor-validation--stale"}`}
|
||||
role={controller.validation.current ? "alert" : "status"}
|
||||
aria-label="검증에서 지적된 항목"
|
||||
>
|
||||
<p className="studio-editor-validation-title">
|
||||
{controller.validation.current
|
||||
? "게시하려면 아래를 채워야 합니다"
|
||||
: `버전 ${controller.validation.version} 검사에서 지적된 항목입니다 — 저장 후 다시 검증하면 갱신됩니다`}
|
||||
</p>
|
||||
<ul>
|
||||
{controller.validation.issues.map((issue) => (
|
||||
<li key={`${issue.code}-${issue.path}`} data-severity={issue.severity}>
|
||||
<span>{issue.severity === "ERROR" ? "필수" : "확인"}</span>
|
||||
{issue.message}
|
||||
<code>{issue.path}</code>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
) : null}
|
||||
<CommonDocumentFields draft={controller.draft} topics={topics} projects={projects} relations={relations} onUpdate={controller.update} />
|
||||
<CommonDocumentFields draft={controller.draft} topics={topics} projects={projects} relations={relations} issues={issues} onUpdate={controller.update} />
|
||||
{controller.draft.kind === "CASE"
|
||||
? <CaseFields draft={controller.draft} onChange={controller.replace} onAssetsObserved={onAssetsObserved} onAssetUploaded={onAssetUploaded} />
|
||||
? <CaseFields draft={controller.draft} issues={issues} onChange={controller.replace} onAssetsObserved={onAssetsObserved} onAssetUploaded={onAssetUploaded} />
|
||||
: controller.draft.kind === "REFERENCE"
|
||||
? <ReferenceFields draft={controller.draft} onChange={controller.replace} />
|
||||
? <ReferenceFields draft={controller.draft} issues={issues} onChange={controller.replace} />
|
||||
: controller.draft.kind === "QUESTION"
|
||||
? <QuestionFields draft={controller.draft} evidence={evidence} onChange={controller.replace} />
|
||||
: <ProjectDecisionFields draft={controller.draft} onChange={controller.replace} />}
|
||||
? <QuestionFields draft={controller.draft} evidence={evidence} issues={issues} onChange={controller.replace} />
|
||||
: <ProjectDecisionFields draft={controller.draft} issues={issues} onChange={controller.replace} />}
|
||||
</div>
|
||||
<div id="studio-preview-panel" role="tabpanel" aria-labelledby="studio-preview-tab" hidden={tab !== "PREVIEW"}>
|
||||
<InstantPreview draft={controller.draft} catalog={catalog} assets={assets} />
|
||||
</div>
|
||||
</div>
|
||||
<DocumentStatusRail controller={controller} />
|
||||
<DocumentStatusRail controller={controller} unplacedIssues={unplaced} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user