diff --git a/src/lib/activityLogDisplay.ts b/src/lib/activityLogDisplay.ts
index b3b6fef..17feffb 100644
--- a/src/lib/activityLogDisplay.ts
+++ b/src/lib/activityLogDisplay.ts
@@ -225,11 +225,11 @@ export const RESOURCE_TYPE_OPTIONS: { value: string; label: string }[] = [
{ value: "CATEGORY", label: "Category" },
{ value: "SUB_COURSE", label: "Sub-course" },
{ value: "QUESTION_SET", label: "Question set" },
- { value: "EXAM_PREP_CATALOG_COURSE", label: "Exam prep course" },
- { value: "EXAM_PREP_UNIT", label: "Exam prep unit" },
- { value: "EXAM_PREP_MODULE", label: "Exam prep module" },
- { value: "EXAM_PREP_LESSON", label: "Exam prep lesson" },
- { value: "EXAM_PREP_PRACTICE", label: "Exam prep practice" },
+ { value: "EXAM_PREP_CATALOG_COURSE", label: "Duolingo/IELTS course" },
+ { value: "EXAM_PREP_UNIT", label: "Duolingo/IELTS unit" },
+ { value: "EXAM_PREP_MODULE", label: "Duolingo/IELTS module" },
+ { value: "EXAM_PREP_LESSON", label: "Duolingo/IELTS lesson" },
+ { value: "EXAM_PREP_PRACTICE", label: "Duolingo/IELTS practice" },
{ value: "APP_VERSION", label: "App version" },
{ value: "FIELD_OPTION", label: "Field option" },
{ value: "DEVICE", label: "Device" },
diff --git a/src/lib/analytics.ts b/src/lib/analytics.ts
index 074132c..ea77d98 100644
--- a/src/lib/analytics.ts
+++ b/src/lib/analytics.ts
@@ -184,7 +184,7 @@ export function getPrimaryQuestionTypeSummary(questionsByType: LabelCount[]): st
}
export function getVideoLessonsSummary(lmsLessonsWithVideo = 0, examPrepLessonsWithVideo = 0): string {
- return `${lmsLessonsWithVideo.toLocaleString()} LMS · ${examPrepLessonsWithVideo.toLocaleString()} exam prep lessons`
+ return `${lmsLessonsWithVideo.toLocaleString()} LMS · ${examPrepLessonsWithVideo.toLocaleString()} Duolingo/IELTS lessons`
}
export interface MonthlyRevenuePoint {
diff --git a/src/pages/analytics/AnalyticsPage.tsx b/src/pages/analytics/AnalyticsPage.tsx
index affed77..d9abb02 100644
--- a/src/pages/analytics/AnalyticsPage.tsx
+++ b/src/pages/analytics/AnalyticsPage.tsx
@@ -7,9 +7,6 @@ import {
BarChart,
CartesianGrid,
Cell,
- Legend,
- Line,
- LineChart,
Pie,
PieChart,
ResponsiveContainer,
@@ -49,13 +46,10 @@ import { cn } from "../../lib/utils"
import { getDashboard } from "../../api/analytics.api"
import { AnalyticsTimeRangeFilter, getDashboardFilterLabel } from "../../components/analytics/AnalyticsTimeRangeFilter"
import {
- ActivePlansBreakdownCard,
MonthlyRevenueAreaChart,
MonthlyRevenueTrendPanel,
- RenewalRateCard,
SensitiveYtdValue,
analyticsSoftCardClass,
- labelCountsToPieSlices,
} from "../../components/analytics/SubscriptionRevenueVisuals"
import {
getPrimaryQuestionTypeSummary,
@@ -64,15 +58,27 @@ import {
getSubscriptionMetrics,
getVideoLessonsSummary,
formatPercentRate,
- buildSubscriptionStatusPie,
- aggregateRevenueByMonth,
formatAnalyticsSeriesDate,
+ aggregateRevenueByMonth,
formatRevenueAxisTick,
} from "../../lib/analytics"
import type { DashboardData, DashboardFilters, LabelCount } from "../../types/analytics.types"
+import { UnassignedLabel, isUnassignedLabel } from "../../lib/displayValue"
const PIE_COLORS = ["#9E2891", "#FFD23F", "#1DE9B6", "#C26FC0", "#6366F1", "#F97316", "#14B8A6", "#EF4444", "#8B5CF6", "#EC4899", "#06B6D4", "#84CC16"]
+function genderAnalyticsRowLabel(label: string): ReactNode {
+ const trimmed = label?.trim() ?? ""
+ if (
+ isUnassignedLabel(trimmed) ||
+ trimmed.toUpperCase() === "OTHER" ||
+ trimmed.toLowerCase() === "unknown"
+ ) {
+ return
+ }
+ return formatAnalyticsLabel(label)
+}
+
function formatDate(dateStr: string) {
return formatAnalyticsSeriesDate(dateStr)
}
@@ -139,11 +145,13 @@ function BreakdownList({
data,
total,
scrollable: _scrollable,
+ formatRowLabel,
}: {
title: string
data: LabelCount[]
total?: number
scrollable?: boolean
+ formatRowLabel?: (label: string) => ReactNode
}) {
const computedTotal = total ?? data.reduce((s, d) => s + d.count, 0)
const sorted = [...data].sort((a, b) => b.count - a.count)
@@ -159,7 +167,15 @@ function BreakdownList({
>
{sorted.map((item, i) => {
const pct = computedTotal > 0 ? (item.count / computedTotal) * 100 : 0
- const displayLabel = formatAnalyticsLabel(item.label)
+ const displayLabel = formatRowLabel
+ ? formatRowLabel(item.label)
+ : formatAnalyticsLabel(item.label)
+ const titleText =
+ typeof displayLabel === "string"
+ ? displayLabel
+ : isUnassignedLabel(item.label) || item.label.toUpperCase() === "OTHER"
+ ? "unassigned"
+ : formatAnalyticsLabel(item.label)
return (
@@ -168,7 +184,7 @@ function BreakdownList({
className="h-2 w-2 shrink-0 rounded-full"
style={{ backgroundColor: PIE_COLORS[i % PIE_COLORS.length] }}
/>
-
+
{displayLabel}
@@ -198,68 +214,6 @@ function BreakdownList({
)
}
-function AmountBreakdownList({
- title,
- data,
-}: {
- title: string
- data: { label: string; count: number; amount: number }[]
-}) {
- const totalAmount = data.reduce((s, d) => s + d.amount, 0)
- const sorted = [...data].sort((a, b) => b.amount - a.amount)
- return (
-
-
- {title}
-
-
- {sorted.length > 0 ? (
-
- {sorted.map((item, i) => {
- const pct = totalAmount > 0 ? (item.amount / totalAmount) * 100 : 0
- const displayLabel = formatAnalyticsLabel(item.label)
- return (
-
-
-
-
-
- {displayLabel}
-
-
-
-
- ETB {item.amount.toLocaleString()}
-
-
- ({item.count.toLocaleString()} · {pct.toFixed(0)}%)
-
-
-
-
-
- )
- })}
-
- ) : (
- No data available
- )}
-
-
- )
-}
-
function DonutCard({
title,
data,
@@ -453,54 +407,19 @@ export function AnalyticsPage() {
count: d.count,
}))
+ const snapshot = subscriptions.snapshot
+ const renewal = subscriptions.renewal
+ const periodFilterLabel = getDashboardFilterLabel(filters)
+ const newThisPeriod =
+ renewal && renewal.first_time_subscriptions + renewal.returning_subscriptions > 0
+ ? renewal.first_time_subscriptions + renewal.returning_subscriptions
+ : subscriptions.total_subscriptions
+
const subscriptionData = subscriptions.new_subscriptions_last_30_days.map((d) => ({
date: formatDate(d.date),
count: d.count,
}))
- const snapshot = subscriptions.snapshot
- const renewal = subscriptions.renewal
- const cancelByDate = new Map(
- (subscriptions.cancellations_last_30_days ?? []).map((d) => [d.date, d.count]),
- )
- const expireByDate = new Map(
- (subscriptions.expirations_last_30_days ?? []).map((d) => [d.date, d.count]),
- )
- const resubByDate = new Map(
- (subscriptions.resubscriptions_last_30_days ?? []).map((d) => [d.date, d.count]),
- )
- const churnDates = [
- ...new Set([
- ...(subscriptions.cancellations_last_30_days ?? []).map((d) => d.date),
- ...(subscriptions.expirations_last_30_days ?? []).map((d) => d.date),
- ...(subscriptions.resubscriptions_last_30_days ?? []).map((d) => d.date),
- ]),
- ].sort()
- const churnSeries = churnDates.map((date) => ({
- date: formatDate(date),
- cancellations: cancelByDate.get(date) ?? 0,
- expirations: expireByDate.get(date) ?? 0,
- resubscriptions: resubByDate.get(date) ?? 0,
- }))
-
- const activeCategoryPie = (subscriptions.active_by_category ?? []).map((s, i) => ({
- name: formatAnalyticsLabel(s.label),
- value: s.count,
- color: PIE_COLORS[i % PIE_COLORS.length],
- }))
-
- const acquisitionPie = (subscriptions.acquisition_by_source ?? []).map((s, i) => ({
- name: formatAnalyticsLabel(s.label),
- value: s.count,
- color: PIE_COLORS[i % PIE_COLORS.length],
- }))
-
- const cohortPie = (subscriptions.new_by_cohort ?? []).map((s, i) => ({
- name: formatAnalyticsLabel(s.label),
- value: s.count,
- color: PIE_COLORS[i % PIE_COLORS.length],
- }))
-
const revenueData = payments.revenue_last_30_days.map((d) => ({
date: formatDate(d.date),
revenue: d.revenue,
@@ -510,7 +429,8 @@ export function AnalyticsPage() {
const useMonthlyRevenueTrend =
dateFilter?.mode === "year" ||
dateFilter?.mode === "all_time" ||
- (filters.mode === "year" || filters.mode === "all_time")
+ filters.mode === "year" ||
+ filters.mode === "all_time"
const monthlyTrendYear =
(dateFilter?.mode === "year" && dateFilter.year) ||
(filters.mode === "year" && filters.year) ||
@@ -519,10 +439,6 @@ export function AnalyticsPage() {
? aggregateRevenueByMonth(payments.revenue_last_30_days, monthlyTrendYear)
: revenueData
- const subscriptionStatusPie = buildSubscriptionStatusPie(
- subscriptions.by_status,
- PIE_COLORS,
- )
const notifByTypePie = notifications.by_type.slice(0, 8).map((s, i) => ({
name: s.label,
value: s.count,
@@ -738,6 +654,7 @@ export function AnalyticsPage() {
title="Gender"
data={users.by_gender ?? []}
total={users.total_users}
+ formatRowLabel={genderAnalyticsRowLabel}
/>
-
-
{(users.by_knowledge_level?.length ?? 0) > 0 ? (
- {snapshot && (
-
-
- 0 ? "down" : "neutral"}
- />
-
- 0 ? "up" : "neutral"}
- />
-
- )}
- {renewal && (
-
- = 0.3 ? "up" : renewal.expired_in_period > 0 ? "down" : "neutral"}
- />
- 0 ? "up" : "neutral"}
- />
-
- 0
- ? renewal.returning_subscriptions /
- (renewal.first_time_subscriptions + renewal.returning_subscriptions)
- : 0,
- )}
- sub={`${formatNumber(renewal.returning_subscriptions)} of ${formatNumber(renewal.first_time_subscriptions + renewal.returning_subscriptions)} new subs`}
- trend={renewal.returning_subscriptions > 0 ? "up" : "neutral"}
- />
-
- )}
-
+
+
+ 0 ? "down" : "neutral"}
+ />
+
+ 0 ? "up" : "neutral"}
+ />
+ 0 ? "up" : "neutral"}
+ />
+ 0 ? "up" : "neutral"}
+ />
+
+
+
+
}
- ytdLabel={useMonthlyRevenueTrend ? "YTD" : "Period"}
+ ytdLabel="Period total"
>
-
({ label: row.label, count: row.count })),
- )}
- />
-
-
-
-
-
-
-
-
-
-
New Subscriptions
-
- {subscriptions.total_subscriptions.toLocaleString()}
-
-
- +{subscriptions.new_today} today · +{subscriptions.new_week} this week
+
+
+
+
+
New Subscriptions
+
+ Daily new subscriptions · {periodFilterLabel}
+
+
{seriesPeriodLabel}
- {seriesPeriodLabel}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Daily Revenue Detail
-
- Same period as filters · ETB
-
-
-
{seriesPeriodLabel}
-
-
-
-
+
+
-
+
+
+
+
+
+
+
-
+
[`ETB ${Number(v).toLocaleString()}`, "Revenue"]}
contentStyle={{
borderRadius: 10,
border: "1px solid #E8E8E8",
@@ -980,130 +808,55 @@ export function AnalyticsPage() {
fontSize: 12,
}}
/>
-
-
+
+
-
-
-
-
+
+
- {churnSeries.length > 0 && (
-
-
-
-
-
Cancellations, Expirations & Resubscribes
-
- Churn vs win-back over {seriesPeriodLabel.toLowerCase()}
+
+
+
+
+
Daily Revenue
+
+ Successful payments · ETB · {periodFilterLabel}
+
+
{seriesPeriodLabel}
- {seriesPeriodLabel}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- )}
-
-
-
-
-
-
-
- s + r.count, 0) ||
- subscriptions.total_subscriptions
- ).toString()}
- centerLabel="Subs"
- />
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ [`ETB ${Number(v).toLocaleString()}`, "Revenue"]}
+ contentStyle={{
+ borderRadius: 10,
+ border: "1px solid #E8E8E8",
+ boxShadow: "0 8px 24px rgba(0,0,0,0.08)",
+ fontSize: 12,
+ }}
+ />
+
+
+
+
+
+
+
@@ -1187,7 +940,7 @@ export function AnalyticsPage() {
)}
{examPrep && (
setNewCategoryName(e.target.value)}
/>
diff --git a/src/pages/content-management/EditPracticeFlow.tsx b/src/pages/content-management/EditPracticeFlow.tsx
index 7fd5b27..d35c5e3 100644
--- a/src/pages/content-management/EditPracticeFlow.tsx
+++ b/src/pages/content-management/EditPracticeFlow.tsx
@@ -159,7 +159,7 @@ export function EditPracticeFlow() {
const programLabel = isExamPrep
? programType === "skill"
? "Skill-Based Courses"
- : "English Proficiency Exams"
+ : "Duolingo/IELTS"
: level
? `Program ${level}`
: null;
diff --git a/src/pages/content-management/NewContentPage.tsx b/src/pages/content-management/NewContentPage.tsx
index 797db28..26d451d 100644
--- a/src/pages/content-management/NewContentPage.tsx
+++ b/src/pages/content-management/NewContentPage.tsx
@@ -84,8 +84,7 @@ export function NewContentPage() {
Courses
- Manage skill-based and exam preparation courses such as Duolingo
- and IELTS.
+ Manage skill-based and Duolingo/IELTS courses.
diff --git a/src/pages/content-management/ProgramDetailPage.tsx b/src/pages/content-management/ProgramDetailPage.tsx
index 1d1cd03..7b99b61 100644
--- a/src/pages/content-management/ProgramDetailPage.tsx
+++ b/src/pages/content-management/ProgramDetailPage.tsx
@@ -90,9 +90,9 @@ export function ProgramDetailPage() {
// Mock data for "proficiency" program type
const programs: Record = {
proficiency: {
- title: "English Proficiency Exams",
+ title: "Duolingo/IELTS",
description:
- "Manage exam-based learning programs such as Duolingo and IELTS.",
+ "Manage Duolingo/IELTS learning programs.",
courses: [],
},
"skill-based": {
@@ -667,7 +667,7 @@ export function ProgramDetailPage() {
No catalog courses yet
- Create your first exam-prep catalog course to start organizing units, modules, and lessons.
+ Create your first Duolingo/IELTS catalog course to start organizing units, modules, and lessons.
) : programType === "proficiency" && filteredProficiencyCourses.length === 0 ? (
diff --git a/src/pages/content-management/ProgramTypeSelectionPage.tsx b/src/pages/content-management/ProgramTypeSelectionPage.tsx
index 63c5803..fe0d006 100644
--- a/src/pages/content-management/ProgramTypeSelectionPage.tsx
+++ b/src/pages/content-management/ProgramTypeSelectionPage.tsx
@@ -54,7 +54,7 @@ export function ProgramTypeSelectionPage() {
- {/* English Proficiency Exams Card */}
+ {/* Duolingo/IELTS Card */}
@@ -63,11 +63,11 @@ export function ProgramTypeSelectionPage() {
- English Proficiency Exams
+ Duolingo/IELTS
- Exam preparation courses such as IELTS, and Duolingo. Structure
- content by band scores, sections, and mock tests.
+ Duolingo/IELTS courses. Structure content by band scores,
+ sections, and mock tests.
diff --git a/src/pages/content-management/components/ExamPrepContentHierarchyList.tsx b/src/pages/content-management/components/ExamPrepContentHierarchyList.tsx
index 77aa672..5584fbd 100644
--- a/src/pages/content-management/components/ExamPrepContentHierarchyList.tsx
+++ b/src/pages/content-management/components/ExamPrepContentHierarchyList.tsx
@@ -135,7 +135,7 @@ export function ExamPrepContentHierarchyList() {
setLessons(fetchedLessons)
} catch (error) {
console.error("Failed to fetch exam prep hierarchy:", error)
- notifyApiError(error, "Failed to load exam prep content")
+ notifyApiError(error, "Failed to load Duolingo/IELTS content")
} finally {
setLoading({})
}
diff --git a/src/pages/content-management/components/practice-steps/AttachPracticeStep1.tsx b/src/pages/content-management/components/practice-steps/AttachPracticeStep1.tsx
index 9cdfe38..2f13df7 100644
--- a/src/pages/content-management/components/practice-steps/AttachPracticeStep1.tsx
+++ b/src/pages/content-management/components/practice-steps/AttachPracticeStep1.tsx
@@ -38,7 +38,7 @@ export function AttachPracticeStep1({
>
Choose Program
Skill-Based Courses
-
English Proficiency Exams
+
Duolingo/IELTS
diff --git a/src/pages/content-management/components/practice-steps/ProgramAttachStep1.tsx b/src/pages/content-management/components/practice-steps/ProgramAttachStep1.tsx
index 45fe4cb..c7c6715 100644
--- a/src/pages/content-management/components/practice-steps/ProgramAttachStep1.tsx
+++ b/src/pages/content-management/components/practice-steps/ProgramAttachStep1.tsx
@@ -37,7 +37,7 @@ export function ProgramAttachStep1({
}
>
Choose Program
-
English Proficiency Exams
+
Duolingo/IELTS
Skill-Based Courses
diff --git a/src/pages/content-management/components/practice-steps/SelectPracticeToAttachStep.tsx b/src/pages/content-management/components/practice-steps/SelectPracticeToAttachStep.tsx
index f27ba1b..06ab36d 100644
--- a/src/pages/content-management/components/practice-steps/SelectPracticeToAttachStep.tsx
+++ b/src/pages/content-management/components/practice-steps/SelectPracticeToAttachStep.tsx
@@ -189,7 +189,7 @@ export function SelectPracticeToAttachStep({
{unlinkedOnly
? isExamPrep
- ? "No unlinked exam-prep practices match your search. Try all practices or create a new shell first."
+ ? "No unlinked Duolingo/IELTS practices match your search. Try all practices or create a new shell first."
: "No unlinked practices match your search. Try all practices or create a new shell from Question Types."
: "Try a different search, switch to unlinked only, or create a new practice instead."}
diff --git a/src/pages/personas/PersonasPage.tsx b/src/pages/personas/PersonasPage.tsx
index 273c75f..195e23e 100644
--- a/src/pages/personas/PersonasPage.tsx
+++ b/src/pages/personas/PersonasPage.tsx
@@ -194,7 +194,7 @@ export function PersonasPage() {
Personas
Manage coach and character profiles linked to practice shells in Learn English and
- exam-prep content.
+ Duolingo/IELTS content.
diff --git a/src/pages/user-management/components/UserLearningActivitySection.tsx b/src/pages/user-management/components/UserLearningActivitySection.tsx
index 4b18c66..987b1f3 100644
--- a/src/pages/user-management/components/UserLearningActivitySection.tsx
+++ b/src/pages/user-management/components/UserLearningActivitySection.tsx
@@ -272,7 +272,7 @@ export function UserLearningActivitySection({
Learning activity
- LMS and exam prep progress trees for this learner.
+ LMS and Duolingo/IELTS progress trees for this learner.
@@ -307,7 +307,7 @@ export function UserLearningActivitySection({
)}
onClick={() => setTrack("exam_prep")}
>
- Exam prep
+ Duolingo/IELTS
@@ -373,7 +373,7 @@ export function UserLearningActivitySection({
{!loading && !error && activity && track === "exam_prep" ? (
<>
-
+
course.access.is_accessible).length}
@@ -393,7 +393,7 @@ export function UserLearningActivitySection({
disabled={catalogCourses.length === 0}
>
- {catalogCourses.length === 0 ? "No exam prep courses" : "Select exam prep course..."}
+ {catalogCourses.length === 0 ? "No Duolingo/IELTS courses" : "Select Duolingo/IELTS course..."}
{catalogCourses.map((course) => (
@@ -406,7 +406,7 @@ export function UserLearningActivitySection({
{selectedCatalogCourse ? (
) : (
- No exam prep activity yet.
+ No Duolingo/IELTS activity yet.
)}
>
) : null}