feat: 자료 상세의 큰 그림과 영향 범위, 구조 화면의 프로젝트-주제 나무

Asset 상세는 이름과 사실 몇 줄뿐이었다. 목록의 썸네일은 "이게 그건가"를 가리는 데
쓰고, 상세에서는 실제로 무엇이 그려져 있는지 읽어야 한다 — 바꾸거나 지우기 전에
확인하는 자리다. 큰 그림을 싣고, 쓰이는 자료라면 지우기 전에 몇 개 기록이 깨지는지를
동작 옆에 못 박는다.

주제와 프로젝트 화면은 목록 둘뿐이라 여느 CMS 의 분류 관리와 같았다. 이 제품에서
값어치 있는 것은 그 둘의 관계다. 「구조」를 먼저 두고 프로젝트 → 주제 나무를 그린다.
답하는 질문이 비어 있는 주제와, 어느 프로젝트에도 걸리지 않은 주제를 함께 드러낸다 —
걸리지 않았다는 사실 자체가 구조의 상태이므로 숨기면 그 주제는 어느 화면에서도 보이지
않는다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015c8cBFUaVr7KLVUx6ujz7D
This commit is contained in:
DongHyeonka
2026-09-16 01:32:51 +09:00
co-authored by Claude Opus 5
parent 5399e19429
commit 172dff705b
3 changed files with 149 additions and 2 deletions
@@ -393,6 +393,17 @@ export function AssetLibrary(props: Readonly<{ gateway: StudioAssetGateway }>) {
<h2 ref={detailHeadingRef} tabIndex={-1}>
{selected.asset.originalFilename || selected.asset.assetKey}
</h2>
{/*
큰 그림. 목록의 썸네일은 "이게 그건가"를 가리는 데 쓰고, 여기서는 실제로 무엇이
그려져 있는지 읽어야 한다 — 바꾸거나 지우기 전에 확인하는 자리다.
*/}
{selected.asset.publicPath && selected.asset.mediaType.startsWith("image/") ? (
<img
className="asset-detail-preview"
src={selected.asset.publicPath}
alt={selected.asset.decorative ? "" : (selected.asset.altText ?? "")}
/>
) : null}
<dl className="asset-detail-facts">
<div><dt>상태</dt><dd>{ASSET_STATUS_LABELS[selected.asset.managementStatus]}</dd></div>
<div><dt>파일</dt><dd>{assetFacts(selected.asset)}</dd></div>
@@ -424,6 +435,16 @@ export function AssetLibrary(props: Readonly<{ gateway: StudioAssetGateway }>) {
) : (
<p>아직 어느 기록도 이 자료를 쓰지 않습니다.</p>
)}
{/*
쓰이는 자료를 지우면 그 기록들의 그림 자리가 통째로 빈다. 지우기 전에 무엇이 깨질지
수가 아니라 이름으로 보여야 한다 — 위의 「쓰이는 곳」이 그 목록이고, 여기서는 그
사실을 동작 옆에 한 번 더 못 박는다.
*/}
{selected.usages.length > 0 ? (
<p className="asset-detail-warning" role="status">
{`${selected.usages.length}개 기록이 이 자료를 쓰고 있습니다. 지우면 그 자리가 빕니다.`}
</p>
) : null}
<div className="asset-detail-actions">
{/*
삭제는 되돌릴 수 없다. 보관은 목록에서 내리는 것뿐이라 묻지 않는다 — 둘을 같은
@@ -41,7 +41,9 @@ export function TaxonomyManager() {
「추가」 버튼 두 개가 같은 이름·같은 모양으로 나란히 섰고, 주제 행은 프로젝트에 맞춘 그리드라
절반이 빈칸이었다. 탭으로 나눠 한 번에 한 종류만 다룬다.
*/
const [tab, setTab] = useState<"TOPIC" | "PROJECT">("TOPIC");
const [tab, setTab] = useState<"STRUCTURE" | "TOPIC" | "PROJECT">("STRUCTURE");
/* 프로젝트마다 어느 주제를 묶었는지. 목록에는 없고 상세에만 있어 따로 읽는다. */
const [links, setLinks] = useState<ReadonlyMap<string, readonly string[]>>(new Map());
const [pendingDelete, setPendingDelete] = useState<
{ kind: "TOPIC"; topic: TopicEdit } | { kind: "PROJECT"; project: ProjectIndexItem } | null
>(null);
@@ -61,8 +63,27 @@ export function TaxonomyManager() {
([topicList, projectPage]) => {
if (cancelled) return;
setTopics(topicList);
setProjects(projectPage.items ?? []);
const items = projectPage.items ?? [];
setProjects(items);
setLoading(false);
/*
어느 프로젝트가 어느 주제를 묶었는지는 목록에 없고 상세에만 있다. 구조를 그리려면
그 연결이 필요하므로 따로 읽는다 — 실패해도 목록 두 개는 이미 그려져 있으므로
구조 탭만 비고 화면 전체가 죽지는 않는다.
*/
void Promise.all(
items.map(async (project) =>
project.id
? ([project.id, (await managementGateway.getProject(project.id)).topicIds ?? []] as const)
: null,
),
).then(
(pairs) => {
if (cancelled) return;
setLinks(new Map(pairs.filter((pair) => pair !== null)));
},
() => undefined,
);
},
() => {
if (cancelled) return;
@@ -226,6 +247,21 @@ export function TaxonomyManager() {
</header>
<div className="studio-taxonomy-tabs" role="tablist" aria-label="주제와 프로젝트">
{/*
구조가 먼저다. 주제와 프로젝트를 따로 세는 목록 둘만 있으면 이 화면은 여느 CMS 의
분류 관리와 같아진다 — 이 제품에서 값어치 있는 것은 그 둘의 <em>관계</em>다.
*/}
<button
type="button"
role="tab"
id="taxonomy-tab-structure"
aria-selected={tab === "STRUCTURE"}
aria-controls={tab === "STRUCTURE" ? "taxonomy-panel" : undefined}
tabIndex={tab === "STRUCTURE" ? 0 : -1}
onClick={() => setTab("STRUCTURE")}
>
구조
</button>
<button
type="button"
role="tab"
@@ -310,6 +346,77 @@ export function TaxonomyManager() {
</p>
) : null}
{!loading && topics && projects && tab === "STRUCTURE" ? (
<div className="studio-structure-tree">
<ol>
{projects.map((project) => {
const linked = links.get(project.id ?? "") ?? [];
const inProject = topics.filter((topic) => topic.id && linked.includes(topic.id));
return (
<li key={project.id ?? project.slug}>
<div className="studio-structure-project">
{project.id ? (
<GuardedStudioLink href={`/studio/projects/${project.id}`}>
{project.name}
</GuardedStudioLink>
) : (
<strong>{project.name}</strong>
)}
<span>{PROJECT_PHASE_LABELS[project.phase] ?? project.phase}</span>
</div>
{inProject.length > 0 ? (
<ul>
{inProject.map((topic) => (
<li key={topic.id ?? topic.slug}>
{topic.id ? (
<GuardedStudioLink href={`/studio/topics/${topic.id}`}>
{topic.name}
</GuardedStudioLink>
) : (
topic.name
)}
{/* 질문이 비어 있으면 공개 주제 화면의 첫 문장이 비어 나온다. */}
{topic.thesis?.trim() ? null : <em>답하는 질문 없음</em>}
</li>
))}
</ul>
) : (
<p className="studio-structure-empty">묶은 주제가 없습니다.</p>
)}
</li>
);
})}
</ol>
{/*
어느 프로젝트에도 걸리지 않은 주제. 걸리지 않았다는 사실 자체가 구조의 상태이므로
숨기지 않는다 — 숨기면 그 주제는 어느 화면에서도 보이지 않는다.
*/}
{(() => {
const linkedIds = new Set([...links.values()].flat());
const orphans = topics.filter((topic) => topic.id && !linkedIds.has(topic.id));
if (orphans.length === 0) return null;
return (
<section className="studio-structure-orphans" aria-labelledby="orphan-topics-title">
<h2 id="orphan-topics-title">어느 프로젝트에도 걸리지 않은 주제</h2>
<ul>
{orphans.map((topic) => (
<li key={topic.id ?? topic.slug}>
{topic.id ? (
<GuardedStudioLink href={`/studio/topics/${topic.id}`}>
{topic.name}
</GuardedStudioLink>
) : (
topic.name
)}
</li>
))}
</ul>
</section>
);
})()}
</div>
) : null}
{!loading && topics && tab === "TOPIC" ? (
<>
<p className="studio-result-count">{topics.length}개의 주제</p>
@@ -504,3 +504,22 @@
0%, 100% { opacity: 0.25; }
50% { opacity: 1; }
}
/* Asset 상세 — 바꾸거나 지우기 전에 무엇인지, 무엇이 깨지는지 */
.studio-app .asset-detail-preview { display: block; max-width: 100%; max-height: 320px; margin: 16px 0 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--canvas); }
.studio-app .asset-detail-warning { margin: 18px 0 0; padding: 11px 14px; border-left: 3px solid var(--warning); background: var(--warning-soft); color: #75521f; font-size: 14px; }
/* 구조 — 이 제품에서 값어치 있는 것은 주제와 프로젝트의 관계다 */
.studio-app .studio-structure-tree > ol { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line-strong); }
.studio-app .studio-structure-tree > ol > li { padding-block: 22px; border-bottom: 1px solid var(--line); }
.studio-app .studio-structure-project { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.studio-app .studio-structure-project a,
.studio-app .studio-structure-project strong { color: var(--ink); font-size: 17px; font-weight: 650; }
.studio-app .studio-structure-project > span { color: var(--faint); font-size: 12px; }
.studio-app .studio-structure-tree ul { margin: 11px 0 0; padding: 0 0 0 18px; border-left: 1px solid var(--line); list-style: none; }
.studio-app .studio-structure-tree ul li { display: flex; flex-wrap: wrap; gap: 5px 12px; align-items: baseline; padding-block: 5px; }
.studio-app .studio-structure-tree ul a { color: var(--ink-soft); font-size: 15px; }
.studio-app .studio-structure-tree ul em { color: var(--warning); font-size: 12px; font-style: normal; }
.studio-app .studio-structure-empty { margin: 10px 0 0; color: var(--faint); font-size: 13px; }
.studio-app .studio-structure-orphans { margin-top: 34px; }
.studio-app .studio-structure-orphans h2 { margin: 0 0 12px; font-size: 13px; font-weight: 650; color: var(--muted); }