feat: 주제의 논지와 축을 Studio 에서 쓸 수 있게 한다
「주제·프로젝트」 화면은 주제를 만들고 지울 수만 있었다. 이름과 slug 말고는 쓸 자리가 없어, 주제가 답하는 질문(논지)도 축의 이름도 어디에도 적을 수 없었다 — 공개 주제 화면이 그 둘을 읽는데 쓸 곳이 없으니 늘 비어 있었다. 주제 편집 화면을 프로젝트 편집기와 같은 자리·같은 클래스로 둔다. 축(variant)은 주제 안의 접근/구조 하나다. 인증 경계라면 SPA·BFF·Mediator 가 각각 하나고, 각자 만들어 보고 무엇을 알게 됐는지가 다르다. 비교표가 읽는 것은 요약이 아니라 그 결론이라, 두 칸을 따로 둔다 — 기록의 요약 첫 줄을 잘라 쓰면 안 되는 자리다. 프로젝트에도 논지 칸을 둔다. 목적은 시작할 때 쓰는 글이고 논지는 끝나고 쓰는 글이다. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011nAjrqNHGPNngN4aUbcyvJ
This commit is contained in:
co-authored by
Claude Opus 5
parent
15e6ea8f15
commit
3616502463
@@ -15,6 +15,7 @@ import type {
|
||||
ReleaseIndexPage,
|
||||
ReleaseUpdateRequest,
|
||||
TopicEdit,
|
||||
TopicVariantEdit,
|
||||
} from "../../contracts/management/contract.ts";
|
||||
import type {
|
||||
DeletableDocumentKind,
|
||||
@@ -77,6 +78,15 @@ export function createHttpManagementGateway(
|
||||
listTopics: () => run<TopicEdit[]>("listStudioTopics", {}),
|
||||
createTopic: (input: TopicEdit) => run<TopicEdit>("createTopic", input),
|
||||
updateTopic: (id: string, body: TopicEdit) => run<TopicEdit>("updateTopic", { id, body }),
|
||||
listTopicVariants: (topicId: string) =>
|
||||
run<TopicVariantEdit[]>("listTopicVariants", { id: topicId }),
|
||||
createTopicVariant: (topicId: string, body: TopicVariantEdit) =>
|
||||
run<TopicVariantEdit>("createTopicVariant", { id: topicId, body }),
|
||||
updateTopicVariant: (topicId: string, variantId: string, body: TopicVariantEdit) =>
|
||||
run<TopicVariantEdit>("updateTopicVariant", { id: topicId, variantId, body }),
|
||||
deleteTopicVariant: async (topicId: string, variantId: string, expectedVersion: number) => {
|
||||
await run<void>("deleteTopicVariant", { id: topicId, variantId, expectedVersion });
|
||||
},
|
||||
deleteTopic: async (id: string, expectedVersion: number) => {
|
||||
await run<void>("deleteTopic", { id, expectedVersion });
|
||||
},
|
||||
|
||||
@@ -15,6 +15,7 @@ import type {
|
||||
ReleaseIndexPage,
|
||||
ReleaseUpdateRequest,
|
||||
TopicEdit,
|
||||
TopicVariantEdit,
|
||||
} from "../../contracts/management/contract.ts";
|
||||
|
||||
/**
|
||||
@@ -32,6 +33,18 @@ export type ManagementGateway = Readonly<{
|
||||
createTopic(input: TopicEdit): Promise<TopicEdit>;
|
||||
updateTopic(id: string, body: TopicEdit): Promise<TopicEdit>;
|
||||
deleteTopic(id: string, expectedVersion: number): Promise<void>;
|
||||
/*
|
||||
주제 안의 축. 「구조」「조회 전략」처럼 주제마다 이름이 다른 축 하나가 접근 하나고, 기록은
|
||||
거기에 걸린다. 아무 축에도 걸리지 않은 기록은 그 주제의 공통 기록이다.
|
||||
*/
|
||||
listTopicVariants(topicId: string): Promise<TopicVariantEdit[]>;
|
||||
createTopicVariant(topicId: string, body: TopicVariantEdit): Promise<TopicVariantEdit>;
|
||||
updateTopicVariant(
|
||||
topicId: string,
|
||||
variantId: string,
|
||||
body: TopicVariantEdit,
|
||||
): Promise<TopicVariantEdit>;
|
||||
deleteTopicVariant(topicId: string, variantId: string, expectedVersion: number): Promise<void>;
|
||||
listProjects(page?: number, size?: number): Promise<ProjectIndexPage>;
|
||||
/*
|
||||
홈 「지금 집중하는 것」 편집기가 쓰는 둘. 질문 항목은 `primaryProject` 를 들고 오므로 그것으로
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { components } from "./generated.ts";
|
||||
type Schemas = components["schemas"];
|
||||
|
||||
export type TopicEdit = Schemas["TopicEdit"];
|
||||
export type TopicVariantEdit = Schemas["TopicVariantEdit"];
|
||||
export type ProjectEditResponse = Schemas["ProjectEditResponse"];
|
||||
export type ProjectIndexItem = Schemas["ProjectIndexItem"];
|
||||
export type ProjectIndexPage = Schemas["ProjectIndexPage"];
|
||||
|
||||
@@ -56,6 +56,7 @@ const TECH_LOG_ROUTE_SPECS = [
|
||||
defineSpec({ routeId: "TECH_LOG_STUDIO_ASSETS", path: "/studio/assets", layoutGroup: "STUDIO", paramsSchema: null, searchSchema: null, title: "Asset", navigationLabel: null, navigationOrder: null }),
|
||||
defineSpec({ routeId: "TECH_LOG_STUDIO_TAXONOMY", path: "/studio/taxonomy", layoutGroup: "STUDIO", paramsSchema: null, searchSchema: null, title: "주제와 프로젝트", navigationLabel: "주제·프로젝트", navigationOrder: 40 }),
|
||||
defineSpec({ routeId: "TECH_LOG_STUDIO_PROJECT_EDIT", path: "/studio/projects/:id", layoutGroup: "STUDIO", paramsSchema: "TechLogDocumentIdParams", searchSchema: null, title: "프로젝트 편집", navigationLabel: null, navigationOrder: null }),
|
||||
defineSpec({ routeId: "TECH_LOG_STUDIO_TOPIC_EDIT", path: "/studio/topics/:id", layoutGroup: "STUDIO", paramsSchema: "TechLogDocumentIdParams", searchSchema: null, title: "주제 편집", navigationLabel: null, navigationOrder: null }),
|
||||
defineSpec({ routeId: "TECH_LOG_STUDIO_RELEASES", path: "/studio/releases", layoutGroup: "STUDIO", paramsSchema: null, searchSchema: null, title: "릴리즈", navigationLabel: "릴리즈", navigationOrder: 50 }),
|
||||
defineSpec({ routeId: "TECH_LOG_STUDIO_RELEASE_EDIT", path: "/studio/releases/:id", layoutGroup: "STUDIO", paramsSchema: "TechLogDocumentIdParams", searchSchema: null, title: "릴리즈 편집", navigationLabel: null, navigationOrder: null }),
|
||||
defineSpec({ routeId: "TECH_LOG_STUDIO_NOT_FOUND", path: "/studio/*", layoutGroup: "STUDIO", paramsSchema: "TechLogStudioSplat", searchSchema: null, title: "Studio 화면을 찾을 수 없습니다", navigationLabel: null, navigationOrder: null }),
|
||||
|
||||
@@ -66,6 +66,7 @@ type Draft = {
|
||||
name: string;
|
||||
slug: string;
|
||||
oneLinePurpose: string;
|
||||
thesis: string;
|
||||
purposeMarkdown: string;
|
||||
boundaryMarkdown: string;
|
||||
systemOverviewMarkdown: string;
|
||||
@@ -81,6 +82,7 @@ function toDraft(project: ProjectEditResponse): Draft {
|
||||
name: project.name,
|
||||
slug: project.slug ?? "",
|
||||
oneLinePurpose: project.oneLinePurpose ?? "",
|
||||
thesis: project.thesis ?? "",
|
||||
purposeMarkdown: project.purposeMarkdown ?? "",
|
||||
boundaryMarkdown: project.boundaryMarkdown ?? "",
|
||||
systemOverviewMarkdown: project.systemOverviewMarkdown ?? "",
|
||||
@@ -175,6 +177,7 @@ export function ProjectEditor() {
|
||||
name: draft.name.trim(),
|
||||
slug: draft.slug.trim() || slugFromName(draft.name),
|
||||
oneLinePurpose: draft.oneLinePurpose,
|
||||
thesis: draft.thesis,
|
||||
purposeMarkdown: draft.purposeMarkdown,
|
||||
boundaryMarkdown: draft.boundaryMarkdown,
|
||||
systemOverviewMarkdown: draft.systemOverviewMarkdown,
|
||||
@@ -300,6 +303,21 @@ export function ProjectEditor() {
|
||||
onChange={(event) => update({ oneLinePurpose: event.currentTarget.value })}
|
||||
/>
|
||||
</label>
|
||||
{/*
|
||||
목적은 시작할 때 쓰는 글이고 논지는 끝나고 쓰는 글이다. 담을 칸이 없어 공개
|
||||
화면은 목적을 대신 보여 줬고, 그래서 프로젝트 화면에는 늘 시작할 때의 말만
|
||||
남았다.
|
||||
*/}
|
||||
<label className="studio-field studio-field--wide">
|
||||
<span>논지 — 이 프로젝트가 밝힌 것</span>
|
||||
<textarea
|
||||
value={draft.thesis}
|
||||
maxLength={2000}
|
||||
rows={3}
|
||||
placeholder="공개 프로젝트 화면의 첫 문단입니다. 비우면 한 줄 목적이 대신 나갑니다."
|
||||
onChange={(event) => update({ thesis: event.currentTarget.value })}
|
||||
/>
|
||||
</label>
|
||||
<label className="studio-field">
|
||||
<span>현재 목표</span>
|
||||
<input
|
||||
|
||||
@@ -278,7 +278,20 @@ export function TaxonomyManager() {
|
||||
<article className="studio-document-row" key={topic.id ?? topic.slug}>
|
||||
<p className="studio-row-label">TOPIC</p>
|
||||
<div className="studio-document-title">
|
||||
<h2>{topic.name}</h2>
|
||||
{/*
|
||||
주제는 만들고 지울 수만 있었다. 이름과 slug 말고 쓸 자리가 없어, 주제가
|
||||
답하는 질문도 축의 이름도 어디에도 적을 수 없었다 — 공개 주제 화면이 그
|
||||
둘을 읽는데 쓸 곳이 없으니 늘 비어 있었다. 프로젝트와 같은 자리에 링크를 둔다.
|
||||
*/}
|
||||
<h2>
|
||||
{topic.id ? (
|
||||
<GuardedStudioLink href={`/studio/topics/${topic.id}`}>
|
||||
{topic.name}
|
||||
</GuardedStudioLink>
|
||||
) : (
|
||||
topic.name
|
||||
)}
|
||||
</h2>
|
||||
<p>{topic.slug}</p>
|
||||
</div>
|
||||
<dl>
|
||||
|
||||
@@ -0,0 +1,426 @@
|
||||
import { useCallback, useEffect, useState, type FormEvent } from "react";
|
||||
|
||||
import type { TopicEdit, TopicVariantEdit } from "../../../contracts/management/contract.ts";
|
||||
import { managementFailureMessage } from "../../../application/ports/management-gateway-error.ts";
|
||||
import { useRouteInput } from "../../../../../presentation/routes/route-input.tsx";
|
||||
import { GuardedStudioLink } from "./guarded-studio-link.tsx";
|
||||
import { slugFromName } from "./slug-from-name.ts";
|
||||
import { useSaveShortcut } from "./use-save-shortcut.ts";
|
||||
import { useStudio } from "../use-studio.ts";
|
||||
|
||||
/** 경로 파라미터는 `unknown` 으로 들어온다 — 라우터가 코덱을 통과시킨 값이라도 타입은 좁혀 써야 한다. */
|
||||
function routeId(value: unknown): string {
|
||||
return typeof value === "string" ? value : "";
|
||||
}
|
||||
|
||||
type Draft = {
|
||||
name: string;
|
||||
slug: string;
|
||||
description: string;
|
||||
scope: string;
|
||||
thesis: string;
|
||||
variantLabel: string;
|
||||
};
|
||||
|
||||
function toDraft(topic: TopicEdit): Draft {
|
||||
return {
|
||||
name: topic.name,
|
||||
slug: topic.slug,
|
||||
description: topic.description ?? "",
|
||||
scope: topic.scope ?? "",
|
||||
thesis: topic.thesis ?? "",
|
||||
variantLabel: topic.variantLabel ?? "",
|
||||
};
|
||||
}
|
||||
|
||||
type VariantDraft = {
|
||||
slug: string;
|
||||
title: string;
|
||||
summary: string;
|
||||
conclusion: string;
|
||||
};
|
||||
|
||||
const EMPTY_VARIANT: VariantDraft = { slug: "", title: "", summary: "", conclusion: "" };
|
||||
|
||||
/**
|
||||
* 주제 한 편을 편집한다.
|
||||
*
|
||||
* <p>「주제·프로젝트」 화면은 주제를 만들고 지울 수만 있었다. 이름과 slug 말고는 쓸 자리가 없어,
|
||||
* 주제가 답하는 질문(논지)도 축의 이름도 어디에도 적을 수 없었다 — 공개 주제 화면이 그 둘을 읽는데
|
||||
* 쓸 곳이 없으니 늘 비어 있었다.
|
||||
*
|
||||
* <p>축(variant)은 주제 안의 접근/구조 하나다. 인증 경계라면 SPA·BFF·Mediator 가 각각 하나고,
|
||||
* 각자 만들어 보고 무엇을 알게 됐는지가 다르다. 비교표가 읽는 것은 요약이 아니라 그 결론이다.
|
||||
*
|
||||
* <p>새 CSS 를 만들지 않는다 — 프로젝트 편집기와 같은 클래스를 쓰므로 Studio 의 나머지와 같은
|
||||
* 간격·타이포·색을 따른다.
|
||||
*/
|
||||
export function TopicEditor() {
|
||||
const { params } = useRouteInput<"TECH_LOG_STUDIO_TOPIC_EDIT">();
|
||||
const topicId = routeId(params.id);
|
||||
const { managementGateway, setRequestAnnouncement } = useStudio();
|
||||
|
||||
const [topic, setTopic] = useState<TopicEdit | null>(null);
|
||||
const [draft, setDraft] = useState<Draft | null>(null);
|
||||
const [variants, setVariants] = useState<TopicVariantEdit[]>([]);
|
||||
const [newVariant, setNewVariant] = useState<VariantDraft>(EMPTY_VARIANT);
|
||||
const [pending, setPending] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
const [generation, setGeneration] = useState(0);
|
||||
|
||||
const reload = useCallback(() => setGeneration((value) => value + 1), []);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
// 동기적으로 던지는 호출도 잡는다 — 다른 Studio 편집기와 같은 이유다.
|
||||
void (async () => {
|
||||
try {
|
||||
const [topicList, variantList] = await Promise.all([
|
||||
managementGateway.listTopics(),
|
||||
managementGateway.listTopicVariants(topicId),
|
||||
]);
|
||||
if (cancelled) return;
|
||||
const loaded = topicList.find((entry) => entry.id === topicId);
|
||||
if (!loaded) {
|
||||
setError("주제를 찾을 수 없습니다.");
|
||||
return;
|
||||
}
|
||||
setTopic(loaded);
|
||||
setDraft(toDraft(loaded));
|
||||
setVariants(variantList);
|
||||
setError("");
|
||||
} catch {
|
||||
if (!cancelled) setError("주제를 불러오지 못했습니다.");
|
||||
}
|
||||
})();
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [managementGateway, topicId, generation]);
|
||||
|
||||
const update = (patch: Partial<Draft>) =>
|
||||
setDraft((current) => (current ? { ...current, ...patch } : current));
|
||||
|
||||
const save = async (event: FormEvent) => {
|
||||
event.preventDefault();
|
||||
if (pending || !topic || !draft || topic.id === undefined || topic.version === undefined) return;
|
||||
setPending(true);
|
||||
setError("");
|
||||
try {
|
||||
const saved = await managementGateway.updateTopic(topic.id, {
|
||||
expectedVersion: topic.version,
|
||||
name: draft.name.trim(),
|
||||
// slug 는 공개 주소다. 비워 두면 주제 화면에 닿을 수 없으므로 이름에서 만들어 채운다.
|
||||
slug: draft.slug.trim() || slugFromName(draft.name),
|
||||
description: draft.description,
|
||||
scope: draft.scope,
|
||||
thesis: draft.thesis,
|
||||
variantLabel: draft.variantLabel.trim(),
|
||||
});
|
||||
setRequestAnnouncement(`주제를 버전 ${saved.version}으로 저장했습니다.`);
|
||||
reload();
|
||||
} catch (failure) {
|
||||
setError(managementFailureMessage(failure, "주제를 저장하지 못했습니다."));
|
||||
} finally {
|
||||
setPending(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 폼 제출과 같은 일을 하므로 submit 이벤트를 만들어 보낸다 — 검증·기본값 처리가 한 곳에 남는다.
|
||||
useSaveShortcut(
|
||||
() => void save({ preventDefault: () => {} } as FormEvent),
|
||||
Boolean(topic && draft) && !pending,
|
||||
);
|
||||
|
||||
const addVariant = async (event: FormEvent) => {
|
||||
event.preventDefault();
|
||||
if (pending || !newVariant.title.trim()) return;
|
||||
setPending(true);
|
||||
setError("");
|
||||
try {
|
||||
await managementGateway.createTopicVariant(topicId, {
|
||||
slug: newVariant.slug.trim() || slugFromName(newVariant.title),
|
||||
title: newVariant.title.trim(),
|
||||
summary: newVariant.summary,
|
||||
conclusion: newVariant.conclusion,
|
||||
displayOrder: variants.length,
|
||||
});
|
||||
setNewVariant(EMPTY_VARIANT);
|
||||
setRequestAnnouncement(`${newVariant.title} 을(를) 추가했습니다.`);
|
||||
reload();
|
||||
} catch (failure) {
|
||||
setError(managementFailureMessage(failure, "축을 추가하지 못했습니다."));
|
||||
} finally {
|
||||
setPending(false);
|
||||
}
|
||||
};
|
||||
|
||||
const saveVariant = async (variant: TopicVariantEdit) => {
|
||||
if (pending || variant.id === undefined || variant.version === undefined) return;
|
||||
setPending(true);
|
||||
setError("");
|
||||
try {
|
||||
await managementGateway.updateTopicVariant(topicId, variant.id, {
|
||||
expectedVersion: variant.version,
|
||||
slug: variant.slug,
|
||||
title: variant.title,
|
||||
summary: variant.summary,
|
||||
conclusion: variant.conclusion,
|
||||
displayOrder: variant.displayOrder,
|
||||
});
|
||||
setRequestAnnouncement(`${variant.title} 을(를) 저장했습니다.`);
|
||||
reload();
|
||||
} catch (failure) {
|
||||
setError(managementFailureMessage(failure, "축을 저장하지 못했습니다."));
|
||||
} finally {
|
||||
setPending(false);
|
||||
}
|
||||
};
|
||||
|
||||
const removeVariant = async (variant: TopicVariantEdit) => {
|
||||
if (pending || variant.id === undefined || variant.version === undefined) return;
|
||||
setPending(true);
|
||||
setError("");
|
||||
try {
|
||||
await managementGateway.deleteTopicVariant(topicId, variant.id, variant.version);
|
||||
setRequestAnnouncement(`${variant.title} 을(를) 삭제했습니다.`);
|
||||
reload();
|
||||
} catch (failure) {
|
||||
setError(managementFailureMessage(failure, "축을 삭제하지 못했습니다."));
|
||||
} finally {
|
||||
setPending(false);
|
||||
}
|
||||
};
|
||||
|
||||
const patchVariant = (id: string | undefined, patch: Partial<TopicVariantEdit>) =>
|
||||
setVariants((current) =>
|
||||
current.map((variant) => (variant.id === id ? { ...variant, ...patch } : variant)),
|
||||
);
|
||||
|
||||
const axisLabel = draft?.variantLabel.trim() || "축";
|
||||
|
||||
return (
|
||||
<div className="studio-page studio-editor-page">
|
||||
<header className="studio-page-top">
|
||||
<div className="studio-page-heading">
|
||||
<p className="studio-eyebrow">TOPIC · VERSION {topic?.version ?? "—"}</p>
|
||||
<h1>{topic?.name ?? "주제"}</h1>
|
||||
<p>공개 주제 화면이 여기 값을 그대로 읽습니다.</p>
|
||||
</div>
|
||||
<GuardedStudioLink className="studio-primary-action" href="/studio/taxonomy">
|
||||
주제·프로젝트로
|
||||
</GuardedStudioLink>
|
||||
</header>
|
||||
|
||||
{error ? (
|
||||
<p className="studio-screen-error" role="alert">
|
||||
{error}
|
||||
</p>
|
||||
) : null}
|
||||
{!topic && !error ? (
|
||||
<p className="studio-loading" role="status">
|
||||
주제를 불러오는 중입니다.
|
||||
</p>
|
||||
) : null}
|
||||
|
||||
{topic && draft ? (
|
||||
<>
|
||||
<form onSubmit={save}>
|
||||
<section className="studio-editor-section" aria-labelledby="studio-topic-basics-title">
|
||||
<div className="studio-editor-section-heading">
|
||||
<p className="studio-eyebrow">TOPIC</p>
|
||||
<h2 id="studio-topic-basics-title">기본 정보</h2>
|
||||
<p>목록과 주제 화면에 그대로 나가는 값입니다.</p>
|
||||
</div>
|
||||
<div className="studio-field-grid">
|
||||
<label className="studio-field studio-field--wide">
|
||||
<span>이름</span>
|
||||
<input
|
||||
value={draft.name}
|
||||
maxLength={120}
|
||||
onChange={(event) => update({ name: event.currentTarget.value })}
|
||||
/>
|
||||
</label>
|
||||
<label className="studio-field">
|
||||
<span>slug</span>
|
||||
<input
|
||||
value={draft.slug}
|
||||
maxLength={100}
|
||||
placeholder="비우면 이름에서 만듭니다"
|
||||
onChange={(event) => update({ slug: event.currentTarget.value })}
|
||||
/>
|
||||
</label>
|
||||
{/*
|
||||
축의 이름은 주제마다 다르다 — 인증 경계에서는 「구조」, 조회 성능에서는
|
||||
「조회 전략」. 내부 모델 이름(variant)을 화면에 그대로 쓰지 않는다.
|
||||
*/}
|
||||
<label className="studio-field">
|
||||
<span>축 이름</span>
|
||||
<input
|
||||
value={draft.variantLabel}
|
||||
maxLength={40}
|
||||
placeholder="예: 구조 / 조회 전략 · 비우면 축을 쓰지 않습니다"
|
||||
onChange={(event) => update({ variantLabel: event.currentTarget.value })}
|
||||
/>
|
||||
</label>
|
||||
<label className="studio-field studio-field--wide">
|
||||
<span>설명</span>
|
||||
<input
|
||||
value={draft.description}
|
||||
maxLength={300}
|
||||
placeholder="목록에서 이 주제를 가려내는 한 줄입니다."
|
||||
onChange={(event) => update({ description: event.currentTarget.value })}
|
||||
/>
|
||||
</label>
|
||||
{/*
|
||||
논지는 이 주제가 답하는 질문이다. 기록을 합쳐 자동으로 나오는 글이 아니라
|
||||
사람이 쓰는 글이라, 담을 칸이 없던 동안 주제 화면의 첫 문단이 비어 있었다.
|
||||
*/}
|
||||
<label className="studio-field studio-field--wide">
|
||||
<span>논지 — 이 주제가 답하는 질문</span>
|
||||
<textarea
|
||||
value={draft.thesis}
|
||||
maxLength={2000}
|
||||
rows={3}
|
||||
placeholder="공개 주제 화면의 첫 문단입니다. 비우면 설명이 대신 나갑니다."
|
||||
onChange={(event) => update({ thesis: event.currentTarget.value })}
|
||||
/>
|
||||
</label>
|
||||
<label className="studio-field studio-field--wide">
|
||||
<span>범위</span>
|
||||
<input
|
||||
value={draft.scope}
|
||||
maxLength={300}
|
||||
onChange={(event) => update({ scope: event.currentTarget.value })}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<div className="studio-editor-actions">
|
||||
<button className="studio-primary-action" type="submit" disabled={pending}>
|
||||
저장
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
</form>
|
||||
|
||||
<section className="studio-editor-section" aria-labelledby="studio-topic-variants-title">
|
||||
<div className="studio-editor-section-heading">
|
||||
<p className="studio-eyebrow">{axisLabel.toUpperCase()}</p>
|
||||
<h2 id="studio-topic-variants-title">{`${axisLabel} 목록`}</h2>
|
||||
<p>
|
||||
이 주제 안에서 실제로 만들어 본 접근입니다. 어느 축에도 걸리지 않은 기록은 이
|
||||
주제의 공통 기록으로 읽힙니다.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p className="studio-result-count">{`${variants.length}개의 ${axisLabel}`}</p>
|
||||
{variants.map((variant) => (
|
||||
<article className="studio-document-row" key={variant.id ?? variant.slug}>
|
||||
<div className="studio-field-grid">
|
||||
<label className="studio-field">
|
||||
<span>제목</span>
|
||||
<input
|
||||
value={variant.title}
|
||||
maxLength={80}
|
||||
onChange={(event) =>
|
||||
patchVariant(variant.id, { title: event.currentTarget.value })
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="studio-field">
|
||||
<span>slug</span>
|
||||
<input
|
||||
value={variant.slug}
|
||||
maxLength={100}
|
||||
onChange={(event) =>
|
||||
patchVariant(variant.id, { slug: event.currentTarget.value })
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="studio-field studio-field--wide">
|
||||
<span>요약 — 이것이 무엇인가</span>
|
||||
<input
|
||||
value={variant.summary ?? ""}
|
||||
maxLength={600}
|
||||
onChange={(event) =>
|
||||
patchVariant(variant.id, { summary: event.currentTarget.value })
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
{/*
|
||||
비교표가 읽는 것은 이 칸이다. 기록의 요약 첫 줄을 잘라 쓰면 안 되는 자리라
|
||||
따로 둔다 — 요약은 무엇인가를 말하고, 결론은 무엇을 알게 됐는가를 말한다.
|
||||
*/}
|
||||
<label className="studio-field studio-field--wide">
|
||||
<span>결론 — 만들어 보고 무엇을 알게 됐나</span>
|
||||
<textarea
|
||||
value={variant.conclusion ?? ""}
|
||||
maxLength={600}
|
||||
rows={2}
|
||||
onChange={(event) =>
|
||||
patchVariant(variant.id, { conclusion: event.currentTarget.value })
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<div className="studio-editor-actions">
|
||||
<button
|
||||
className="studio-primary-action"
|
||||
type="button"
|
||||
disabled={pending}
|
||||
onClick={() => void saveVariant(variant)}
|
||||
>
|
||||
저장
|
||||
</button>
|
||||
<button
|
||||
className="studio-danger-action"
|
||||
type="button"
|
||||
disabled={pending}
|
||||
onClick={() => void removeVariant(variant)}
|
||||
>
|
||||
삭제
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
|
||||
<form onSubmit={addVariant}>
|
||||
<div className="studio-field-grid">
|
||||
<label className="studio-field">
|
||||
<span>{`새 ${axisLabel} 제목`}</span>
|
||||
<input
|
||||
value={newVariant.title}
|
||||
maxLength={80}
|
||||
onChange={(event) => {
|
||||
// 갱신 함수가 돌 때 `currentTarget` 은 이미 null 이다. 먼저 읽어 둔다.
|
||||
const value = event.currentTarget.value;
|
||||
setNewVariant((current) => ({ ...current, title: value }));
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
<label className="studio-field">
|
||||
<span>slug</span>
|
||||
<input
|
||||
value={newVariant.slug}
|
||||
maxLength={100}
|
||||
placeholder="비우면 제목에서 만듭니다"
|
||||
onChange={(event) => {
|
||||
// 갱신 함수가 돌 때 `currentTarget` 은 이미 null 이다. 먼저 읽어 둔다.
|
||||
const value = event.currentTarget.value;
|
||||
setNewVariant((current) => ({ ...current, slug: value }));
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<div className="studio-editor-actions">
|
||||
<button className="studio-primary-action" type="submit" disabled={pending}>
|
||||
추가
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { TopicEditor } from "../components/topic-editor.tsx";
|
||||
|
||||
export function TopicEditPage() {
|
||||
return <TopicEditor />;
|
||||
}
|
||||
@@ -230,6 +230,13 @@ export const TECH_LOG_ROUTE_RUNTIME = Object.freeze({
|
||||
"ProjectEditPage",
|
||||
),
|
||||
),
|
||||
TECH_LOG_STUDIO_TOPIC_EDIT: runtime(
|
||||
"TECH_LOG_STUDIO_TOPIC_EDIT",
|
||||
routeModule(
|
||||
() => import("./studio/pages/topic-edit-page.tsx"),
|
||||
"TopicEditPage",
|
||||
),
|
||||
),
|
||||
TECH_LOG_STUDIO_RELEASES: runtime(
|
||||
"TECH_LOG_STUDIO_RELEASES",
|
||||
routeModule(
|
||||
|
||||
@@ -41,6 +41,7 @@ const expectedRoutes = [
|
||||
["TECH_LOG_STUDIO_ASSETS", "/studio/assets", "STUDIO", null, null],
|
||||
["TECH_LOG_STUDIO_TAXONOMY", "/studio/taxonomy", "STUDIO", null, null],
|
||||
["TECH_LOG_STUDIO_PROJECT_EDIT", "/studio/projects/:id", "STUDIO", "TechLogDocumentIdParams", null],
|
||||
["TECH_LOG_STUDIO_TOPIC_EDIT", "/studio/topics/:id", "STUDIO", "TechLogDocumentIdParams", null],
|
||||
["TECH_LOG_STUDIO_RELEASES", "/studio/releases", "STUDIO", null, null],
|
||||
["TECH_LOG_STUDIO_RELEASE_EDIT", "/studio/releases/:id", "STUDIO", "TechLogDocumentIdParams", null],
|
||||
["TECH_LOG_STUDIO_NOT_FOUND", "/studio/*", "STUDIO", "TechLogStudioSplat", null],
|
||||
@@ -77,6 +78,7 @@ const expectedTitles = {
|
||||
TECH_LOG_STUDIO_ASSETS: "Asset",
|
||||
TECH_LOG_STUDIO_TAXONOMY: "주제와 프로젝트",
|
||||
TECH_LOG_STUDIO_PROJECT_EDIT: "프로젝트 편집",
|
||||
TECH_LOG_STUDIO_TOPIC_EDIT: "주제 편집",
|
||||
TECH_LOG_STUDIO_RELEASES: "릴리즈",
|
||||
TECH_LOG_STUDIO_RELEASE_EDIT: "릴리즈 편집",
|
||||
TECH_LOG_STUDIO_NOT_FOUND: "Studio 화면을 찾을 수 없습니다",
|
||||
@@ -158,7 +160,7 @@ describe("TechLog route boundary contract", () => {
|
||||
for (const locale of ["ko-KR", "en-US"] as const) {
|
||||
const catalog: Readonly<Record<string, string>> =
|
||||
TECH_LOG_MESSAGE_CATALOGS[locale];
|
||||
expect(Object.keys(catalog)).toHaveLength(66);
|
||||
expect(Object.keys(catalog)).toHaveLength(68);
|
||||
for (const [routeId, title] of Object.entries(expectedTitles)) {
|
||||
expect(catalog[`route.${routeId}.title`]).toBe(title);
|
||||
expect(catalog[`route.${routeId}.navigation`]).toBe(title);
|
||||
|
||||
Reference in New Issue
Block a user