From fedb7b0fbef9f567f0f8c9ad4d1ed3854f053b2a Mon Sep 17 00:00:00 2001 From: Yared Yemane Date: Tue, 3 Nov 2026 12:32:21 +0300 Subject: [PATCH] Restyle admin tables and remove retired type and legacy archive views --- scripts/learning-integration.test.mjs | 11 +++ src/api/questionTypeDefinitions.api.ts | 12 ++- .../DynamicTableBuilder.tsx | 4 +- src/components/ui/table.tsx | 6 +- src/index.css | 93 +++++++++---------- .../LearningHierarchyPage.tsx | 14 +-- .../AttachPracticeReviewStep.tsx | 2 +- 7 files changed, 77 insertions(+), 65 deletions(-) diff --git a/scripts/learning-integration.test.mjs b/scripts/learning-integration.test.mjs index 913dc3d..c981158 100644 --- a/scripts/learning-integration.test.mjs +++ b/scripts/learning-integration.test.mjs @@ -203,3 +203,14 @@ test("new makeup subscriptions default to the supported backend category", async const form = await loadModule("src/pages/settings/components/CreateSubscriptionPlanDialog.shared.ts") assert.equal(form.EMPTY_SUBSCRIPTION_PLAN_DRAFT.category, "EDUCATION") }) + + +test("retired Audio Conversation is excluded while historical reads remain available", async () => { + const retired = {id: 10, key: "audio_conversation_type", display_name: "Audio Conversation", status: "INACTIVE"} + const current = {id: 11, key: "makeup_knowledge_check", display_name: "Makeup knowledge check", status: "ACTIVE"} + const api = await loadModule("src/api/questionTypeDefinitions.api.ts", {get: async (path) => ({data:{data: path.endsWith("/10") ? retired : {definitions:[retired,current],total_count:2}}})}) + const result = await api.getQuestionTypeDefinitions() + assert.deepEqual(result.definitions.map(def => def.key), ["makeup_knowledge_check"]) + assert.equal(result.total_count,1) + assert.equal((await api.getQuestionTypeDefinitionById(10)).key,"audio_conversation_type") +}) diff --git a/src/api/questionTypeDefinitions.api.ts b/src/api/questionTypeDefinitions.api.ts index 060771b..d9d8820 100644 --- a/src/api/questionTypeDefinitions.api.ts +++ b/src/api/questionTypeDefinitions.api.ts @@ -354,7 +354,7 @@ async function fetchQuestionTypeDefinitionsPage( * Lists question type definitions. When `limit` / `offset` are omitted, fetches every page * so dropdowns receive the full catalog (the API defaults to a capped page size). */ -export async function getQuestionTypeDefinitions( +async function getQuestionTypeDefinitionsIncludingRetired( params?: QuestionTypeDefinitionsListParams, ): Promise { const hasExplicitPagination = params?.limit !== undefined || params?.offset !== undefined @@ -644,3 +644,13 @@ export async function getQuestionTypeDefinitionPractices( const raw = unwrapApiPayload(res) ?? res.data return parsePracticesPage(raw, definitionId, params) } + +/** Retired language-learning types are excluded from new authoring, including older servers. */ +export async function getQuestionTypeDefinitions( + params?: QuestionTypeDefinitionsListParams, +): Promise { + const result = await getQuestionTypeDefinitionsIncludingRetired(params) + const definitions = result.definitions.filter((definition) => definition.key !== "audio_conversation_type") + const hidden = result.definitions.length - definitions.length + return { ...result, definitions, total_count: Math.max(0, (result.total_count ?? result.definitions.length) - hidden) } +} diff --git a/src/components/content-management/DynamicTableBuilder.tsx b/src/components/content-management/DynamicTableBuilder.tsx index c758538..2eac81a 100644 --- a/src/components/content-management/DynamicTableBuilder.tsx +++ b/src/components/content-management/DynamicTableBuilder.tsx @@ -106,7 +106,7 @@ export function DynamicTableBuilder({

- +
{table.columns.map((col, colIndex) => ( @@ -216,7 +216,7 @@ export function DynamicTableBuilder({ Learner preview

-
+
{previewColumns.map((col, i) => ( diff --git a/src/components/ui/table.tsx b/src/components/ui/table.tsx index f6bb01e..10634c3 100644 --- a/src/components/ui/table.tsx +++ b/src/components/ui/table.tsx @@ -12,7 +12,7 @@ export const Table = React.forwardRef(
) if (noWrapper) return table - return
{table}
+ return
{table}
}, ) Table.displayName = "Table" @@ -53,7 +53,7 @@ export const TableHead = React.forwardRef (
), @@ -62,7 +62,7 @@ TableHead.displayName = "TableHead" export const TableCell = React.forwardRef>( ({ className, ...props }, ref) => ( - + ), ) TableCell.displayName = "TableCell" diff --git a/src/index.css b/src/index.css index b4e4d31..cef4158 100644 --- a/src/index.css +++ b/src/index.css @@ -791,79 +791,78 @@ @layer components { .admin-data-table { - --table-header: #111111; - --table-header-text: #ffffff; + --table-header: #f8f9fa; + --table-header-text: #343a40; --table-row: #ffffff; - --table-hover: #f5f5f5; - --table-selected: #e8e8e8; - --table-divider: #e5e5e5; - --table-edge: #737373; + --table-stripe: #fafafa; + --table-hover: #fff1b8; + --table-selected: #626fc1; + --table-divider: #d3d6da; + --table-edge: #525fbd; border-collapse: collapse; + border: 1px solid var(--table-divider); + background: var(--table-row); font-variant-numeric: tabular-nums; + font-size: 13px; } - - .admin-data-table > thead > tr { - background: var(--table-header); - border-bottom: 3px solid var(--table-edge); - } - - .admin-data-table > thead > tr > th { - height: 54px; - padding-top: 17px; - padding-bottom: 17px; + .admin-data-table > thead > tr { background: var(--table-header); border-bottom: 1px solid var(--table-divider); } + .admin-data-table > thead > tr > :is(th, td) { + height: 40px; + padding: 9px 12px; background: var(--table-header); color: var(--table-header-text); - font-size: 12px; - font-weight: 600; + font-size: 13px; + font-weight: 500; + line-height: 1.4; letter-spacing: 0; text-transform: none; - border-right: 1px solid #ffffff14; + border: 1px solid var(--table-divider); + vertical-align: middle; } - - .admin-data-table > thead > tr > th:last-child { border-right: 0; } .admin-data-table > thead :is(button, svg) { color: inherit; } - + .admin-data-table > thead input { min-height: 30px; border-radius: 2px; font-size: 12px; box-shadow: none; } .admin-data-table > tbody > tr { --table-current-row: var(--table-row); - --table-current-edge: transparent; background: var(--table-current-row); border-bottom: 1px solid var(--table-divider); - transition: background-color 140ms ease; + transition: background-color 120ms ease; } - + .admin-data-table > tbody > tr:nth-child(even) { --table-current-row: var(--table-stripe); } .admin-data-table > tbody > tr:hover:not(:has(td[colspan])), - .admin-data-table > tbody > tr:focus-within { - --table-current-row: var(--table-hover); - --table-current-edge: var(--table-edge); + .admin-data-table > tbody > tr:focus-within { --table-current-row: var(--table-hover); } + .admin-data-table > tbody > tr > td { + padding: 10px 12px; + border: 1px solid var(--table-divider); + line-height: 1.45; + vertical-align: middle; } - .admin-data-table > tbody > tr[data-state="selected"], + .admin-data-table > tbody > tr[aria-selected="true"], .admin-data-table > tbody > tr:has(input[type="checkbox"]:checked), .admin-data-table > tbody > tr:has([role="checkbox"][data-state="checked"]) { --table-current-row: var(--table-selected); - --table-current-edge: var(--table-edge); + color: #ffffff; } - - .admin-data-table > tbody > tr:last-child { border-bottom: 0; } - .admin-data-table > tbody > tr > td:not([colspan]) { padding-top: 20px; padding-bottom: 20px; } - .admin-data-table > tbody > tr > td:first-child:not([colspan]) { box-shadow: inset 3px 0 var(--table-current-edge); } + .admin-data-table > tbody > tr:is([data-state="selected"], [aria-selected="true"]) > td, + .admin-data-table > tbody > tr:has(input[type="checkbox"]:checked) > td, + .admin-data-table > tbody > tr:has([role="checkbox"][data-state="checked"]) > td { color: #ffffff; } + .admin-data-table > tbody > tr:is([data-state="selected"], [aria-selected="true"]) :is(a, button:not([class*="bg-"]), [class*="text-grayScale-"]), + .admin-data-table > tbody > tr:has(input[type="checkbox"]:checked) :is(a, button:not([class*="bg-"]), [class*="text-grayScale-"]) { color: inherit; } .admin-data-table > tbody > tr > td.sticky { background: var(--table-current-row); } .admin-data-table input[type="checkbox"] { accent-color: var(--table-edge); } - .admin-data-table > tfoot { background: var(--table-hover); border-top: 2px solid var(--table-divider); } - + .admin-data-table > tfoot { background: var(--table-header); border-top: 1px solid var(--table-divider); } + .admin-data-table > tfoot > tr > td { padding: 10px 12px; border: 1px solid var(--table-divider); } html.dark .admin-data-table { - --table-header: #111111; - --table-header-text: #fafafa; - --table-row: #262626; - --table-hover: #333333; - --table-selected: #404040; - --table-divider: #404040; - --table-edge: #bdbdbd; - } - - @media (prefers-reduced-motion: reduce) { - .admin-data-table > tbody > tr { transition: none; } + --table-header: #25282d; + --table-header-text: #eeeeee; + --table-row: #191b1f; + --table-stripe: #202227; + --table-hover: #453d25; + --table-selected: #414d96; + --table-divider: #41454b; + --table-edge: #aab4ff; } + @media (prefers-reduced-motion: reduce) { .admin-data-table > tbody > tr { transition: none; } } } @layer components { diff --git a/src/pages/content-management/LearningHierarchyPage.tsx b/src/pages/content-management/LearningHierarchyPage.tsx index a4d95d4..0544aca 100644 --- a/src/pages/content-management/LearningHierarchyPage.tsx +++ b/src/pages/content-management/LearningHierarchyPage.tsx @@ -32,7 +32,6 @@ export function LearningHierarchyPage() { const [failed, setFailed] = useState(false) const [busy, setBusy] = useState(false) const [search, setSearch] = useState("") - const [showLegacy, setShowLegacy] = useState(false) const [editor, setEditor] = useState(null) const [deleting, setDeleting] = useState<{ item: Item; kind: Kind } | null>(null) const [form, setForm] = useState({ name: "", description: "", thumbnail: "", video_url: "", access_tier: "FREE" }) @@ -112,13 +111,13 @@ export function LearningHierarchyPage() { finally { setBusy(false) } } const title = chapter?.name ?? course?.name ?? "Courses" - const matches = (item: Item) => (kind !== "course" || !!item.is_archived === showLegacy) && (item.name ?? item.title ?? "").toLowerCase().includes(search.toLowerCase()) + const matches = (item: Item) => (kind !== "course" || !item.is_archived) && (item.name ?? item.title ?? "").toLowerCase().includes(search.toLowerCase()) function card(item: Item, itemKind: Kind, index?: number) { return

{item.name ?? item.title}

{item.publish_status === "PUBLISHED" ? "Published" : "Draft"}{item.access_tier ? ` · ${item.access_tier.toLowerCase()}` : ""}

- {index !== undefined && !search && !showLegacy && <>} + {index !== undefined && !search && <>}
@@ -137,16 +136,9 @@ export function LearningHierarchyPage() {

{title}

{chapterId ? "Manage the lessons and quizzes in this chapter." : courseId ? "Organize this course into chapters." : "Create courses, organize chapters, and add lessons and chapter quizzes."}

{courseId && } - {kind === "course" &&
-
- - -
- {showLegacy &&

Retired general-learning fixtures are kept here to preserve historical records and learner progress. They are unavailable in the learner catalog.

} -
} setSearch(event.target.value)} /> {loading ?

Loading content…

: failed ?

Content could not be loaded.

: <> -

{collection[kind]}

{items.map((item, index) => matches(item) ? card(item, kind, index) : null)}
{!items.some(matches) &&

{search ? "No matching content." : showLegacy ? "No archived courses." : `No ${collection[kind]} yet. Add your first ${kind} to get started.`}

}
+

{collection[kind]}

{items.map((item, index) => matches(item) ? card(item, kind, index) : null)}
{!items.some(matches) &&

{search ? "No matching content." : `No ${collection[kind]} yet. Add your first ${kind} to get started.`}

}
{chapterId &&

Chapter quizzes

{quizzes.filter(matches).map(item => card(item, "quiz"))}
{!quizzes.some(matches) &&

{search ? "No matching quizzes." : "No quizzes yet. Create a quiz, add its questions, then publish it."}

}
} } { if (!open && !busy) setEditor(null) }}>{editor?.item ? "Edit" : "Add"} {editor?.kind}
diff --git a/src/pages/content-management/components/practice-steps/AttachPracticeReviewStep.tsx b/src/pages/content-management/components/practice-steps/AttachPracticeReviewStep.tsx index 6c722a0..47fa782 100644 --- a/src/pages/content-management/components/practice-steps/AttachPracticeReviewStep.tsx +++ b/src/pages/content-management/components/practice-steps/AttachPracticeReviewStep.tsx @@ -120,7 +120,7 @@ export function AttachPracticeReviewStep({ {isExpanded && (
- +