Skip to content

Commit e98e160

Browse files
committed
커리큘럼 목차 밀도 정리
1 parent 16627fd commit e98e160

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

editor/src/components/curriculum/curriculumMarkdownBody.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,12 +966,18 @@ function payloadTextList(value: unknown) {
966966
}
967967

968968
function blockTypeLabel(type: string) {
969+
const normalized = type.trim();
969970
const labels: Record<string, string> = {
970971
image: "이미지",
971972
pdf: "PDF",
972973
video: "비디오",
973974
youtube: "YouTube",
974975
MIME: "미디어",
976+
tip: "팁",
977+
tipCard: "팁",
978+
note: "노트",
979+
warning: "주의",
980+
info: "정보",
975981
};
976-
return labels[type] ?? type.replace(/([a-z])([A-Z])/g, "$1 $2");
982+
return labels[normalized] ?? labels[normalized.toLowerCase()] ?? normalized.replace(/([a-z])([A-Z])/g, "$1 $2");
977983
}

editor/src/components/curriculum/curriculumSurface.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export function CurriculumCellToc({
195195
</ScrollArea>
196196
</div>
197197

198-
<div className="pointer-events-none absolute right-0 top-0 z-40 h-full w-72 translate-x-2 border-l bg-background/98 opacity-0 shadow-xl shadow-background/40 transition duration-150 group-hover/toc:pointer-events-auto group-hover/toc:translate-x-0 group-hover/toc:opacity-100">
198+
<div className="pointer-events-none absolute right-full top-0 z-40 h-full w-72 -translate-x-2 border-r bg-background/98 opacity-0 shadow-xl shadow-background/40 transition duration-150 group-hover/toc:pointer-events-auto group-hover/toc:translate-x-0 group-hover/toc:opacity-100">
199199
<div className="border-b px-3 py-3">
200200
<div className="text-sm font-semibold tracking-normal">셀 목차</div>
201201
<div className="mt-1 text-xs leading-5 text-muted-foreground">마우스를 올려 현재 레슨의 셀로 이동합니다.</div>
@@ -258,8 +258,14 @@ function shouldShowTocItem(block: BlockConfig, label: string) {
258258
"참고",
259259
]);
260260
if (genericLabels.has(normalized)) return false;
261-
if (block.role === "explanation" && block.displayKind === "callout" && normalized.length <= 8) return false;
262-
return true;
261+
if (block.displayKind === "callout") return false;
262+
if (block.sourceType === "tip" || block.sourceType === "tipCard" || block.sourceType === "note") return false;
263+
if (block.role === "title" || block.displayKind === "hero" || block.displayKind === "title") return true;
264+
if (block.type === "code") return true;
265+
if (block.type === "markdown" && block.sourceType === "expansion") return false;
266+
if (block.role === "exercise" || block.displayKind === "practice") return true;
267+
if (block.displayKind === "quiz") return true;
268+
return false;
263269
}
264270

265271
function CurriculumLearningCell({

editor/src/lib/curriculaRegistry.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,7 @@ function normalizeSourceType(value: string) {
825825
}
826826

827827
function blockTypeLabel(type: string) {
828+
const normalized = type.trim();
828829
const labels: Record<string, string> = {
829830
centerText: "중앙 설명",
830831
choiceCards: "선택 카드",
@@ -855,7 +856,7 @@ function blockTypeLabel(type: string) {
855856
warning: "주의",
856857
youtube: "YouTube",
857858
};
858-
return labels[type] ?? type.replace(/([a-z])([A-Z])/g, "$1 $2");
859+
return labels[normalized] ?? labels[normalized.toLowerCase()] ?? normalized.replace(/([a-z])([A-Z])/g, "$1 $2");
859860
}
860861

861862
function mapValue(value: unknown): YamlMap {

0 commit comments

Comments
 (0)