refactor: 템플릿에서 기본적으로 제공하고 있는 워크 플로우에 디자인과 라우팅 흡수

This commit is contained in:
donghyeon-ka
2026-09-23 12:42:10 +09:00
parent afde2b1da1
commit aaa384c145
181 changed files with 12553 additions and 5280 deletions
@@ -1,3 +1,5 @@
import { useTechLogCopy } from "../studio-copy.ts";
import { Button, InputControl, TextAreaControl } from "../../../../../presentation/design-system/index.ts";
import type { components } from "../../../contracts/studio/generated.ts";
import { createNewItemId } from "../../../domain/studio/local-id.ts";
import { FieldNotice, type FieldIssue } from "./field-issues.tsx";
@@ -10,6 +12,7 @@ export const REFERENCE_FIELD_PATHS = ["/purpose", "/rules", "/applyWhen", "/exce
const orderedRules = (rules: ReferenceRule[]) => rules.map((rule, order) => ({ ...rule, order }));
export function ReferenceFields({ draft, issues, onChange }: { draft: ReferenceInput; issues: readonly FieldIssue[]; onChange(draft: ReferenceInput): void }) {
const copy = useTechLogCopy();
const update = (patch: Partial<ReferenceInput>) => onChange({ ...draft, ...patch });
const moveRule = (index: number, delta: -1 | 1) => {
const target = index + delta;
@@ -25,7 +28,7 @@ export function ReferenceFields({ draft, issues, onChange }: { draft: ReferenceI
<label className="studio-document-block" data-tone="purpose">
<span className="studio-document-block__label">이 기준을 쓰는 이유</span>
<textarea aria-label="이 기준을 쓰는 이유" value={draft.purpose} placeholder="이 기준이 어떤 판단을 빠르게 만드는지 적어 주세요." onChange={(event) => update({ purpose: event.currentTarget.value })} />
<TextAreaControl aria-label="이 기준을 쓰는 이유" value={draft.purpose} placeholder="이 기준이 어떤 판단을 빠르게 만드는지 적어 주세요." onChange={(event) => update({ purpose: event.currentTarget.value })} />
<FieldNotice issues={issues} path="/purpose" />
</label>
@@ -36,13 +39,13 @@ export function ReferenceFields({ draft, issues, onChange }: { draft: ReferenceI
<div className="studio-rule-block studio-ordered-item" key={rule.id}>
<span className="studio-rule-block__number" aria-hidden="true">{String(index + 1).padStart(2, "0")}</span>
<div className="studio-rule-block__writing">
<input aria-label={`판단 기준 ${index + 1} 제목`} value={rule.title} placeholder="한 줄 판단 기준" onChange={(event) => update({ rules: orderedRules(draft.rules.map((candidate, at) => at === index ? { ...candidate, title: event.currentTarget.value } : candidate)) })} />
<textarea aria-label={`판단 기준 ${index + 1} 본문`} value={rule.body} placeholder="왜 이 기준을 쓰는지, 적용 범위가 무엇인지 설명하세요." onChange={(event) => update({ rules: orderedRules(draft.rules.map((candidate, at) => at === index ? { ...candidate, body: event.currentTarget.value } : candidate)) })} />
<InputControl aria-label={`판단 기준 ${index + 1} 제목`} value={rule.title} placeholder="한 줄 판단 기준" onChange={(event) => update({ rules: orderedRules(draft.rules.map((candidate, at) => at === index ? { ...candidate, title: event.currentTarget.value } : candidate)) })} />
<TextAreaControl aria-label={`판단 기준 ${index + 1} 본문`} value={rule.body} placeholder="왜 이 기준을 쓰는지, 적용 범위가 무엇인지 설명하세요." onChange={(event) => update({ rules: orderedRules(draft.rules.map((candidate, at) => at === index ? { ...candidate, body: event.currentTarget.value } : candidate)) })} />
</div>
<div className="studio-item-actions"><button type="button" aria-label="위로" onClick={() => moveRule(index, -1)} disabled={index === 0}>↑</button><button type="button" aria-label="아래로" onClick={() => moveRule(index, 1)} disabled={index === draft.rules.length - 1}>↓</button><button type="button" onClick={() => update({ rules: orderedRules(draft.rules.filter((_, at) => at !== index)) })}>삭제</button></div>
<div className="studio-item-actions"><Button visualPolicy="inherit" type="button" aria-label={copy("techLog.action.moveUp")} onClick={() => moveRule(index, -1)} disabled={index === 0}>↑</Button><Button visualPolicy="inherit" type="button" aria-label={copy("techLog.action.moveDown")} onClick={() => moveRule(index, 1)} disabled={index === draft.rules.length - 1}>↓</Button><Button visualPolicy="inherit" type="button" onClick={() => update({ rules: orderedRules(draft.rules.filter((_, at) => at !== index)) })}>{copy("techLog.action.delete")}</Button></div>
</div>
))}
<button className="studio-add-item" aria-label="판단 기준 추가" type="button" disabled={draft.rules.length >= 50} onClick={() => { if (draft.rules.length < 50) update({ rules: orderedRules([...draft.rules, { id: createNewItemId(), title: "", body: "", order: draft.rules.length }]) }); }}>+ 판단 기준</button>
<Button visualPolicy="inherit" className="studio-add-item" aria-label="판단 기준 추가" type="button" disabled={draft.rules.length >= 50} onClick={() => { if (draft.rules.length < 50) update({ rules: orderedRules([...draft.rules, { id: createNewItemId(), title: "", body: "", order: draft.rules.length }]) }); }}>{copy("techLog.action.addCriterion")}</Button>
</fieldset>
<OrderedTextList label="적용할 때" tone="fact" items={draft.applyWhen} onChange={(applyWhen) => update({ applyWhen })} />
@@ -52,7 +55,7 @@ export function ReferenceFields({ draft, issues, onChange }: { draft: ReferenceI
<OrderedTextList label="예시" tone="example" items={draft.examples} onChange={(examples) => update({ examples })} />
<FieldNotice issues={issues} path="/examples" />
<label className="studio-inline-property studio-inline-property--date"><span>마지막 검증일</span><input aria-label="마지막 검증일" type="date" value={draft.verifiedOn ?? ""} onChange={(event) => update({ verifiedOn: event.currentTarget.value || null })} /><FieldNotice issues={issues} path="/verifiedOn" /></label>
<label className="studio-inline-property studio-inline-property--date"><span>마지막 검증일</span><InputControl aria-label="마지막 검증일" type="date" value={draft.verifiedOn ?? ""} onChange={(event) => update({ verifiedOn: event.currentTarget.value || null })} /><FieldNotice issues={issues} path="/verifiedOn" /></label>
</section>
);
}