Refine analytics KPIs and charts, and relabel exam prep as Duolingo/IELTS.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
ef170e7fbd
commit
d16cb84006
|
|
@ -225,11 +225,11 @@ export const RESOURCE_TYPE_OPTIONS: { value: string; label: string }[] = [
|
||||||
{ value: "CATEGORY", label: "Category" },
|
{ value: "CATEGORY", label: "Category" },
|
||||||
{ value: "SUB_COURSE", label: "Sub-course" },
|
{ value: "SUB_COURSE", label: "Sub-course" },
|
||||||
{ value: "QUESTION_SET", label: "Question set" },
|
{ value: "QUESTION_SET", label: "Question set" },
|
||||||
{ value: "EXAM_PREP_CATALOG_COURSE", label: "Exam prep course" },
|
{ value: "EXAM_PREP_CATALOG_COURSE", label: "Duolingo/IELTS course" },
|
||||||
{ value: "EXAM_PREP_UNIT", label: "Exam prep unit" },
|
{ value: "EXAM_PREP_UNIT", label: "Duolingo/IELTS unit" },
|
||||||
{ value: "EXAM_PREP_MODULE", label: "Exam prep module" },
|
{ value: "EXAM_PREP_MODULE", label: "Duolingo/IELTS module" },
|
||||||
{ value: "EXAM_PREP_LESSON", label: "Exam prep lesson" },
|
{ value: "EXAM_PREP_LESSON", label: "Duolingo/IELTS lesson" },
|
||||||
{ value: "EXAM_PREP_PRACTICE", label: "Exam prep practice" },
|
{ value: "EXAM_PREP_PRACTICE", label: "Duolingo/IELTS practice" },
|
||||||
{ value: "APP_VERSION", label: "App version" },
|
{ value: "APP_VERSION", label: "App version" },
|
||||||
{ value: "FIELD_OPTION", label: "Field option" },
|
{ value: "FIELD_OPTION", label: "Field option" },
|
||||||
{ value: "DEVICE", label: "Device" },
|
{ value: "DEVICE", label: "Device" },
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ export function getPrimaryQuestionTypeSummary(questionsByType: LabelCount[]): st
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getVideoLessonsSummary(lmsLessonsWithVideo = 0, examPrepLessonsWithVideo = 0): string {
|
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 {
|
export interface MonthlyRevenuePoint {
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,6 @@ import {
|
||||||
BarChart,
|
BarChart,
|
||||||
CartesianGrid,
|
CartesianGrid,
|
||||||
Cell,
|
Cell,
|
||||||
Legend,
|
|
||||||
Line,
|
|
||||||
LineChart,
|
|
||||||
Pie,
|
Pie,
|
||||||
PieChart,
|
PieChart,
|
||||||
ResponsiveContainer,
|
ResponsiveContainer,
|
||||||
|
|
@ -49,13 +46,10 @@ import { cn } from "../../lib/utils"
|
||||||
import { getDashboard } from "../../api/analytics.api"
|
import { getDashboard } from "../../api/analytics.api"
|
||||||
import { AnalyticsTimeRangeFilter, getDashboardFilterLabel } from "../../components/analytics/AnalyticsTimeRangeFilter"
|
import { AnalyticsTimeRangeFilter, getDashboardFilterLabel } from "../../components/analytics/AnalyticsTimeRangeFilter"
|
||||||
import {
|
import {
|
||||||
ActivePlansBreakdownCard,
|
|
||||||
MonthlyRevenueAreaChart,
|
MonthlyRevenueAreaChart,
|
||||||
MonthlyRevenueTrendPanel,
|
MonthlyRevenueTrendPanel,
|
||||||
RenewalRateCard,
|
|
||||||
SensitiveYtdValue,
|
SensitiveYtdValue,
|
||||||
analyticsSoftCardClass,
|
analyticsSoftCardClass,
|
||||||
labelCountsToPieSlices,
|
|
||||||
} from "../../components/analytics/SubscriptionRevenueVisuals"
|
} from "../../components/analytics/SubscriptionRevenueVisuals"
|
||||||
import {
|
import {
|
||||||
getPrimaryQuestionTypeSummary,
|
getPrimaryQuestionTypeSummary,
|
||||||
|
|
@ -64,15 +58,27 @@ import {
|
||||||
getSubscriptionMetrics,
|
getSubscriptionMetrics,
|
||||||
getVideoLessonsSummary,
|
getVideoLessonsSummary,
|
||||||
formatPercentRate,
|
formatPercentRate,
|
||||||
buildSubscriptionStatusPie,
|
|
||||||
aggregateRevenueByMonth,
|
|
||||||
formatAnalyticsSeriesDate,
|
formatAnalyticsSeriesDate,
|
||||||
|
aggregateRevenueByMonth,
|
||||||
formatRevenueAxisTick,
|
formatRevenueAxisTick,
|
||||||
} from "../../lib/analytics"
|
} from "../../lib/analytics"
|
||||||
import type { DashboardData, DashboardFilters, LabelCount } from "../../types/analytics.types"
|
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"]
|
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 <UnassignedLabel />
|
||||||
|
}
|
||||||
|
return formatAnalyticsLabel(label)
|
||||||
|
}
|
||||||
|
|
||||||
function formatDate(dateStr: string) {
|
function formatDate(dateStr: string) {
|
||||||
return formatAnalyticsSeriesDate(dateStr)
|
return formatAnalyticsSeriesDate(dateStr)
|
||||||
}
|
}
|
||||||
|
|
@ -139,11 +145,13 @@ function BreakdownList({
|
||||||
data,
|
data,
|
||||||
total,
|
total,
|
||||||
scrollable: _scrollable,
|
scrollable: _scrollable,
|
||||||
|
formatRowLabel,
|
||||||
}: {
|
}: {
|
||||||
title: string
|
title: string
|
||||||
data: LabelCount[]
|
data: LabelCount[]
|
||||||
total?: number
|
total?: number
|
||||||
scrollable?: boolean
|
scrollable?: boolean
|
||||||
|
formatRowLabel?: (label: string) => ReactNode
|
||||||
}) {
|
}) {
|
||||||
const computedTotal = total ?? data.reduce((s, d) => s + d.count, 0)
|
const computedTotal = total ?? data.reduce((s, d) => s + d.count, 0)
|
||||||
const sorted = [...data].sort((a, b) => b.count - a.count)
|
const sorted = [...data].sort((a, b) => b.count - a.count)
|
||||||
|
|
@ -159,7 +167,15 @@ function BreakdownList({
|
||||||
>
|
>
|
||||||
{sorted.map((item, i) => {
|
{sorted.map((item, i) => {
|
||||||
const pct = computedTotal > 0 ? (item.count / computedTotal) * 100 : 0
|
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 (
|
return (
|
||||||
<div key={`${item.label}-${i}`}>
|
<div key={`${item.label}-${i}`}>
|
||||||
<div className="mb-1 flex items-center justify-between gap-2 text-xs">
|
<div className="mb-1 flex items-center justify-between gap-2 text-xs">
|
||||||
|
|
@ -168,7 +184,7 @@ function BreakdownList({
|
||||||
className="h-2 w-2 shrink-0 rounded-full"
|
className="h-2 w-2 shrink-0 rounded-full"
|
||||||
style={{ backgroundColor: PIE_COLORS[i % PIE_COLORS.length] }}
|
style={{ backgroundColor: PIE_COLORS[i % PIE_COLORS.length] }}
|
||||||
/>
|
/>
|
||||||
<span className="truncate text-grayScale-600" title={displayLabel}>
|
<span className="truncate text-grayScale-600" title={titleText}>
|
||||||
{displayLabel}
|
{displayLabel}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -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 (
|
|
||||||
<Card className="shadow-none flex flex-col">
|
|
||||||
<CardHeader className="pb-2">
|
|
||||||
<CardTitle className="text-sm">{title}</CardTitle>
|
|
||||||
</CardHeader>
|
|
||||||
<CardContent className="p-4 pt-0 flex-1 flex flex-col">
|
|
||||||
{sorted.length > 0 ? (
|
|
||||||
<div className="space-y-2.5 flex-1 overflow-y-auto overscroll-contain pr-1 max-h-[320px]">
|
|
||||||
{sorted.map((item, i) => {
|
|
||||||
const pct = totalAmount > 0 ? (item.amount / totalAmount) * 100 : 0
|
|
||||||
const displayLabel = formatAnalyticsLabel(item.label)
|
|
||||||
return (
|
|
||||||
<div key={`${item.label}-${i}`}>
|
|
||||||
<div className="mb-1 flex items-center justify-between gap-2 text-xs">
|
|
||||||
<div className="flex min-w-0 items-center gap-2">
|
|
||||||
<span
|
|
||||||
className="h-2 w-2 shrink-0 rounded-full"
|
|
||||||
style={{ backgroundColor: PIE_COLORS[i % PIE_COLORS.length] }}
|
|
||||||
/>
|
|
||||||
<span className="truncate text-grayScale-600" title={displayLabel}>
|
|
||||||
{displayLabel}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<span className="font-semibold text-grayScale-700">
|
|
||||||
<SensitiveValue showToggle={false}>
|
|
||||||
ETB {item.amount.toLocaleString()}
|
|
||||||
</SensitiveValue>
|
|
||||||
<span className="ml-1 font-normal text-grayScale-400">
|
|
||||||
({item.count.toLocaleString()} · {pct.toFixed(0)}%)
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div className="h-1.5 w-full overflow-hidden rounded-full bg-grayScale-100">
|
|
||||||
<div
|
|
||||||
className="h-full rounded-full transition-all"
|
|
||||||
style={{
|
|
||||||
width: `${pct}%`,
|
|
||||||
backgroundColor: PIE_COLORS[i % PIE_COLORS.length],
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div className="py-4 text-center text-xs text-grayScale-400">No data available</div>
|
|
||||||
)}
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
function DonutCard({
|
function DonutCard({
|
||||||
title,
|
title,
|
||||||
data,
|
data,
|
||||||
|
|
@ -453,54 +407,19 @@ export function AnalyticsPage() {
|
||||||
count: d.count,
|
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) => ({
|
const subscriptionData = subscriptions.new_subscriptions_last_30_days.map((d) => ({
|
||||||
date: formatDate(d.date),
|
date: formatDate(d.date),
|
||||||
count: d.count,
|
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) => ({
|
const revenueData = payments.revenue_last_30_days.map((d) => ({
|
||||||
date: formatDate(d.date),
|
date: formatDate(d.date),
|
||||||
revenue: d.revenue,
|
revenue: d.revenue,
|
||||||
|
|
@ -510,7 +429,8 @@ export function AnalyticsPage() {
|
||||||
const useMonthlyRevenueTrend =
|
const useMonthlyRevenueTrend =
|
||||||
dateFilter?.mode === "year" ||
|
dateFilter?.mode === "year" ||
|
||||||
dateFilter?.mode === "all_time" ||
|
dateFilter?.mode === "all_time" ||
|
||||||
(filters.mode === "year" || filters.mode === "all_time")
|
filters.mode === "year" ||
|
||||||
|
filters.mode === "all_time"
|
||||||
const monthlyTrendYear =
|
const monthlyTrendYear =
|
||||||
(dateFilter?.mode === "year" && dateFilter.year) ||
|
(dateFilter?.mode === "year" && dateFilter.year) ||
|
||||||
(filters.mode === "year" && filters.year) ||
|
(filters.mode === "year" && filters.year) ||
|
||||||
|
|
@ -519,10 +439,6 @@ export function AnalyticsPage() {
|
||||||
? aggregateRevenueByMonth(payments.revenue_last_30_days, monthlyTrendYear)
|
? aggregateRevenueByMonth(payments.revenue_last_30_days, monthlyTrendYear)
|
||||||
: revenueData
|
: revenueData
|
||||||
|
|
||||||
const subscriptionStatusPie = buildSubscriptionStatusPie(
|
|
||||||
subscriptions.by_status,
|
|
||||||
PIE_COLORS,
|
|
||||||
)
|
|
||||||
const notifByTypePie = notifications.by_type.slice(0, 8).map((s, i) => ({
|
const notifByTypePie = notifications.by_type.slice(0, 8).map((s, i) => ({
|
||||||
name: s.label,
|
name: s.label,
|
||||||
value: s.count,
|
value: s.count,
|
||||||
|
|
@ -738,6 +654,7 @@ export function AnalyticsPage() {
|
||||||
title="Gender"
|
title="Gender"
|
||||||
data={users.by_gender ?? []}
|
data={users.by_gender ?? []}
|
||||||
total={users.total_users}
|
total={users.total_users}
|
||||||
|
formatRowLabel={genderAnalyticsRowLabel}
|
||||||
/>
|
/>
|
||||||
<BreakdownList
|
<BreakdownList
|
||||||
title="Education level"
|
title="Education level"
|
||||||
|
|
@ -754,16 +671,6 @@ export function AnalyticsPage() {
|
||||||
data={users.by_region ?? []}
|
data={users.by_region ?? []}
|
||||||
total={users.total_users}
|
total={users.total_users}
|
||||||
/>
|
/>
|
||||||
<BreakdownList
|
|
||||||
title="Account role"
|
|
||||||
data={users.by_role ?? []}
|
|
||||||
total={users.total_users}
|
|
||||||
/>
|
|
||||||
<BreakdownList
|
|
||||||
title="Account status"
|
|
||||||
data={users.by_status ?? []}
|
|
||||||
total={users.total_users}
|
|
||||||
/>
|
|
||||||
{(users.by_knowledge_level?.length ?? 0) > 0 ? (
|
{(users.by_knowledge_level?.length ?? 0) > 0 ? (
|
||||||
<BreakdownList
|
<BreakdownList
|
||||||
title="Knowledge level"
|
title="Knowledge level"
|
||||||
|
|
@ -797,123 +704,85 @@ export function AnalyticsPage() {
|
||||||
|
|
||||||
{/* ─── Subscriptions & Revenue ─── */}
|
{/* ─── Subscriptions & Revenue ─── */}
|
||||||
<Section title="Subscriptions & Revenue" icon={DollarSign} defaultOpen={false}>
|
<Section title="Subscriptions & Revenue" icon={DollarSign} defaultOpen={false}>
|
||||||
{snapshot && (
|
<div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-4">
|
||||||
<div className="mb-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-4">
|
|
||||||
<KpiCard
|
<KpiCard
|
||||||
icon={BadgeCheck}
|
icon={BadgeCheck}
|
||||||
label="Active Now"
|
label="Active Now"
|
||||||
value={formatNumber(snapshot.active_now)}
|
value={formatNumber(snapshot?.active_now ?? subscriptionMetrics.active)}
|
||||||
sub={`${formatNumber(snapshot.active_learners)} learners · ${formatNumber(snapshot.lifetime_active)} lifetime · ${formatNumber(snapshot.term_active)} term`}
|
sub={`${formatNumber(snapshot?.active_learners ?? 0)} learners with access`}
|
||||||
trend="neutral"
|
trend="neutral"
|
||||||
/>
|
/>
|
||||||
<KpiCard
|
<KpiCard
|
||||||
icon={TrendingDown}
|
icon={TrendingDown}
|
||||||
label="Expiring Soon"
|
label="Expiring Soon"
|
||||||
value={formatNumber(snapshot.expiring_within_7_days)}
|
value={formatNumber(snapshot?.expiring_within_7_days ?? 0)}
|
||||||
sub={`${formatNumber(snapshot.expiring_within_30_days)} within 30 days · ${formatNumber(snapshot.auto_renew_enabled)} auto-renew`}
|
sub={`${formatNumber(snapshot?.expiring_within_30_days ?? 0)} within 30 days`}
|
||||||
trend={snapshot.expiring_within_7_days > 0 ? "down" : "neutral"}
|
trend={(snapshot?.expiring_within_7_days ?? 0) > 0 ? "down" : "neutral"}
|
||||||
/>
|
/>
|
||||||
<KpiCard
|
<KpiCard
|
||||||
icon={RotateCcw}
|
icon={RotateCcw}
|
||||||
label="Churn Stock"
|
label="Expired"
|
||||||
value={formatNumber(snapshot.expired_now + snapshot.cancelled_now)}
|
value={formatNumber(snapshot?.expired_now ?? 0)}
|
||||||
sub={`${formatNumber(snapshot.expired_now)} expired · ${formatNumber(snapshot.cancelled_now)} cancelled · ${formatNumber(snapshot.pending_now)} pending`}
|
sub={`${formatNumber(snapshot?.cancelled_now ?? 0)} cancelled · ${formatNumber(snapshot?.pending_now ?? 0)} pending`}
|
||||||
trend="neutral"
|
trend="neutral"
|
||||||
/>
|
/>
|
||||||
<KpiCard
|
<KpiCard
|
||||||
icon={CreditCard}
|
icon={CreditCard}
|
||||||
label="New (period)"
|
label="New This Period"
|
||||||
value={formatNumber(subscriptions.total_subscriptions)}
|
value={formatNumber(newThisPeriod)}
|
||||||
sub={`+${subscriptions.new_today} today · +${subscriptions.new_week} week · +${subscriptions.new_month} month`}
|
sub={periodFilterLabel}
|
||||||
trend={subscriptions.new_month > 0 ? "up" : "neutral"}
|
trend={newThisPeriod > 0 ? "up" : "neutral"}
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{renewal && (
|
|
||||||
<div className="mb-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-4">
|
|
||||||
<KpiCard
|
|
||||||
icon={RotateCcw}
|
|
||||||
label="Renewal Rate"
|
|
||||||
value={formatPercentRate(renewal.renewal_rate)}
|
|
||||||
sub={`${formatNumber(renewal.renewed_after_expiry)} renewed of ${formatNumber(renewal.expired_in_period)} expired`}
|
|
||||||
trend={renewal.renewal_rate >= 0.3 ? "up" : renewal.expired_in_period > 0 ? "down" : "neutral"}
|
|
||||||
/>
|
|
||||||
<KpiCard
|
|
||||||
icon={BadgeCheck}
|
|
||||||
label="Resubscribe After Expiry"
|
|
||||||
value={formatNumber(renewal.resubscribe_after_expiry)}
|
|
||||||
sub={`${formatNumber(renewal.returning_subscriptions)} returning · ${formatNumber(renewal.first_time_subscriptions)} first-time`}
|
|
||||||
trend={renewal.resubscribe_after_expiry > 0 ? "up" : "neutral"}
|
|
||||||
/>
|
|
||||||
<KpiCard
|
|
||||||
icon={TrendingUp}
|
|
||||||
label="Avg Days to Resubscribe"
|
|
||||||
value={renewal.avg_days_to_resubscribe.toFixed(1)}
|
|
||||||
sub={`Median ${renewal.median_days_to_resubscribe.toFixed(1)} days after expiry`}
|
|
||||||
trend="neutral"
|
|
||||||
/>
|
/>
|
||||||
<KpiCard
|
<KpiCard
|
||||||
icon={Users}
|
icon={Users}
|
||||||
label="Returning Share"
|
label="First-time"
|
||||||
value={formatPercentRate(
|
value={formatNumber(renewal?.first_time_subscriptions ?? 0)}
|
||||||
renewal.first_time_subscriptions + renewal.returning_subscriptions > 0
|
sub="New subscribers in period"
|
||||||
? renewal.returning_subscriptions /
|
trend={(renewal?.first_time_subscriptions ?? 0) > 0 ? "up" : "neutral"}
|
||||||
(renewal.first_time_subscriptions + renewal.returning_subscriptions)
|
/>
|
||||||
: 0,
|
<KpiCard
|
||||||
)}
|
icon={BadgeCheck}
|
||||||
sub={`${formatNumber(renewal.returning_subscriptions)} of ${formatNumber(renewal.first_time_subscriptions + renewal.returning_subscriptions)} new subs`}
|
label="Resubscribed"
|
||||||
trend={renewal.returning_subscriptions > 0 ? "up" : "neutral"}
|
value={formatNumber(renewal?.returning_subscriptions ?? 0)}
|
||||||
|
sub={`${formatNumber(renewal?.resubscribe_after_expiry ?? 0)} after expiry`}
|
||||||
|
trend={(renewal?.returning_subscriptions ?? 0) > 0 ? "up" : "neutral"}
|
||||||
|
/>
|
||||||
|
<KpiCard
|
||||||
|
icon={TrendingUp}
|
||||||
|
label="Average Days to Resubscribe"
|
||||||
|
value={(renewal?.avg_days_to_resubscribe ?? 0).toFixed(1)}
|
||||||
|
sub={`Median ${(renewal?.median_days_to_resubscribe ?? 0).toFixed(1)} days`}
|
||||||
|
trend="neutral"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
<div className="mb-4 space-y-4">
|
<div className="mt-6 space-y-4">
|
||||||
<MonthlyRevenueTrendPanel
|
<MonthlyRevenueTrendPanel
|
||||||
subtitle={
|
subtitle={
|
||||||
useMonthlyRevenueTrend
|
useMonthlyRevenueTrend
|
||||||
? `Revenue growth over ${monthlyTrendYear}`
|
? `Revenue over ${monthlyTrendYear}`
|
||||||
: `Revenue over ${seriesPeriodLabel.toLowerCase()}`
|
: `Revenue over ${seriesPeriodLabel.toLowerCase()}`
|
||||||
}
|
}
|
||||||
ytdValue={<SensitiveYtdValue amount={payments.total_revenue} />}
|
ytdValue={<SensitiveYtdValue amount={payments.total_revenue} />}
|
||||||
ytdLabel={useMonthlyRevenueTrend ? "YTD" : "Period"}
|
ytdLabel="Period total"
|
||||||
>
|
>
|
||||||
<MonthlyRevenueAreaChart
|
<MonthlyRevenueAreaChart
|
||||||
data={monthlyRevenueTrendData}
|
data={monthlyRevenueTrendData}
|
||||||
xKey={useMonthlyRevenueTrend ? "month" : "date"}
|
xKey={useMonthlyRevenueTrend ? "month" : "date"}
|
||||||
gradientId="analyticsMonthlyRevenueFill"
|
gradientId="analyticsSubsRevenueFill"
|
||||||
height={260}
|
height={260}
|
||||||
yTickFormatter={formatRevenueAxisTick}
|
yTickFormatter={formatRevenueAxisTick}
|
||||||
/>
|
/>
|
||||||
</MonthlyRevenueTrendPanel>
|
</MonthlyRevenueTrendPanel>
|
||||||
|
|
||||||
<div className="grid gap-4 lg:grid-cols-2">
|
|
||||||
<ActivePlansBreakdownCard
|
|
||||||
data={labelCountsToPieSlices(
|
|
||||||
(subscriptions.active_by_plan?.length
|
|
||||||
? subscriptions.active_by_plan
|
|
||||||
: subscriptions.by_status
|
|
||||||
).map((row) => ({ label: row.label, count: row.count })),
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<RenewalRateCard
|
|
||||||
renewalRate={renewal?.renewal_rate ?? 0}
|
|
||||||
autoRenewCount={snapshot?.auto_renew_enabled ?? 0}
|
|
||||||
cancelledCount={snapshot?.cancelled_now ?? 0}
|
|
||||||
activeNow={snapshot?.active_now ?? subscriptionMetrics.active}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="grid gap-4 lg:grid-cols-2">
|
<div className="grid gap-4 lg:grid-cols-2">
|
||||||
<Card className={analyticsSoftCardClass}>
|
<Card className={analyticsSoftCardClass}>
|
||||||
<CardHeader className="pb-2">
|
<CardHeader className="pb-2">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div>
|
<div>
|
||||||
<CardTitle>New Subscriptions</CardTitle>
|
<CardTitle>New Subscriptions</CardTitle>
|
||||||
<div className="mt-1 text-2xl font-semibold tracking-tight">
|
<div className="mt-1 text-xs text-grayScale-400">
|
||||||
{subscriptions.total_subscriptions.toLocaleString()}
|
Daily new subscriptions · {periodFilterLabel}
|
||||||
</div>
|
|
||||||
<div className="text-xs text-grayScale-400">
|
|
||||||
+{subscriptions.new_today} today · +{subscriptions.new_week} this week
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Badge variant="secondary">{seriesPeriodLabel}</Badge>
|
<Badge variant="secondary">{seriesPeriodLabel}</Badge>
|
||||||
|
|
@ -923,7 +792,7 @@ export function AnalyticsPage() {
|
||||||
<ResponsiveContainer width="100%" height="100%">
|
<ResponsiveContainer width="100%" height="100%">
|
||||||
<AreaChart data={subscriptionData} margin={{ left: 8, right: 8, top: 8, bottom: 0 }}>
|
<AreaChart data={subscriptionData} margin={{ left: 8, right: 8, top: 8, bottom: 0 }}>
|
||||||
<defs>
|
<defs>
|
||||||
<linearGradient id="gradSub" x1="0" y1="0" x2="0" y2="1">
|
<linearGradient id="gradSubAnalytics" x1="0" y1="0" x2="0" y2="1">
|
||||||
<stop offset="0%" stopColor="#8E248D" stopOpacity={0.22} />
|
<stop offset="0%" stopColor="#8E248D" stopOpacity={0.22} />
|
||||||
<stop offset="100%" stopColor="#8E248D" stopOpacity={0.02} />
|
<stop offset="100%" stopColor="#8E248D" stopOpacity={0.02} />
|
||||||
</linearGradient>
|
</linearGradient>
|
||||||
|
|
@ -942,9 +811,10 @@ export function AnalyticsPage() {
|
||||||
<Area
|
<Area
|
||||||
type="monotone"
|
type="monotone"
|
||||||
dataKey="count"
|
dataKey="count"
|
||||||
|
name="Subscriptions"
|
||||||
stroke="#8E248D"
|
stroke="#8E248D"
|
||||||
strokeWidth={2.5}
|
strokeWidth={2.5}
|
||||||
fill="url(#gradSub)"
|
fill="url(#gradSubAnalytics)"
|
||||||
dot={{ r: 3.5, fill: "#8E248D", strokeWidth: 0 }}
|
dot={{ r: 3.5, fill: "#8E248D", strokeWidth: 0 }}
|
||||||
/>
|
/>
|
||||||
</AreaChart>
|
</AreaChart>
|
||||||
|
|
@ -956,9 +826,9 @@ export function AnalyticsPage() {
|
||||||
<CardHeader className="pb-2">
|
<CardHeader className="pb-2">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div>
|
<div>
|
||||||
<CardTitle>Daily Revenue Detail</CardTitle>
|
<CardTitle>Daily Revenue</CardTitle>
|
||||||
<div className="mt-1 text-xs text-grayScale-400">
|
<div className="mt-1 text-xs text-grayScale-400">
|
||||||
Same period as filters · ETB
|
Successful payments · ETB · {periodFilterLabel}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Badge variant="secondary">{seriesPeriodLabel}</Badge>
|
<Badge variant="secondary">{seriesPeriodLabel}</Badge>
|
||||||
|
|
@ -987,123 +857,6 @@ export function AnalyticsPage() {
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{churnSeries.length > 0 && (
|
|
||||||
<Card className="mt-4 shadow-none">
|
|
||||||
<CardHeader className="pb-2">
|
|
||||||
<div className="flex items-center justify-between">
|
|
||||||
<div>
|
|
||||||
<CardTitle>Cancellations, Expirations & Resubscribes</CardTitle>
|
|
||||||
<div className="text-xs text-grayScale-400">
|
|
||||||
Churn vs win-back over {seriesPeriodLabel.toLowerCase()}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<Badge variant="secondary">{seriesPeriodLabel}</Badge>
|
|
||||||
</div>
|
|
||||||
</CardHeader>
|
|
||||||
<CardContent className="h-[240px] p-6 pt-2">
|
|
||||||
<ResponsiveContainer width="100%" height="100%">
|
|
||||||
<LineChart data={churnSeries} margin={{ left: 8, right: 8, top: 8, bottom: 0 }}>
|
|
||||||
<CartesianGrid vertical={false} stroke="#E0E0E0" strokeDasharray="4 4" />
|
|
||||||
<XAxis dataKey="date" tickLine={false} axisLine={false} fontSize={11} />
|
|
||||||
<YAxis tickLine={false} axisLine={false} fontSize={11} width={30} allowDecimals={false} />
|
|
||||||
<Tooltip
|
|
||||||
contentStyle={{
|
|
||||||
borderRadius: 12,
|
|
||||||
border: "1px solid #E0E0E0",
|
|
||||||
boxShadow: "0 10px 30px rgba(0,0,0,0.08)",
|
|
||||||
fontSize: 12,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Legend />
|
|
||||||
<Line
|
|
||||||
type="monotone"
|
|
||||||
dataKey="cancellations"
|
|
||||||
name="Cancellations"
|
|
||||||
stroke="#EF4444"
|
|
||||||
strokeWidth={2}
|
|
||||||
dot={false}
|
|
||||||
/>
|
|
||||||
<Line
|
|
||||||
type="monotone"
|
|
||||||
dataKey="expirations"
|
|
||||||
name="Expirations"
|
|
||||||
stroke="#F97316"
|
|
||||||
strokeWidth={2}
|
|
||||||
dot={false}
|
|
||||||
/>
|
|
||||||
<Line
|
|
||||||
type="monotone"
|
|
||||||
dataKey="resubscriptions"
|
|
||||||
name="Resubscribes"
|
|
||||||
stroke="#14B8A6"
|
|
||||||
strokeWidth={2}
|
|
||||||
dot={false}
|
|
||||||
/>
|
|
||||||
</LineChart>
|
|
||||||
</ResponsiveContainer>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div className="mt-4 grid items-start gap-4 lg:grid-cols-3">
|
|
||||||
<DonutCard
|
|
||||||
title="Subscription Status"
|
|
||||||
data={subscriptionStatusPie}
|
|
||||||
centerValue={subscriptions.total_subscriptions.toString()}
|
|
||||||
centerLabel="Total"
|
|
||||||
/>
|
|
||||||
<DonutCard
|
|
||||||
title="Active by Category"
|
|
||||||
data={activeCategoryPie}
|
|
||||||
centerValue={(snapshot?.active_now ?? subscriptionMetrics.active).toString()}
|
|
||||||
centerLabel="Active"
|
|
||||||
/>
|
|
||||||
<DonutCard
|
|
||||||
title="First-time vs Returning"
|
|
||||||
data={cohortPie}
|
|
||||||
centerValue={(
|
|
||||||
(renewal?.first_time_subscriptions ?? 0) + (renewal?.returning_subscriptions ?? 0) ||
|
|
||||||
subscriptions.total_subscriptions
|
|
||||||
).toString()}
|
|
||||||
centerLabel="New"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="mt-4 grid items-start gap-4 lg:grid-cols-3">
|
|
||||||
<DonutCard
|
|
||||||
title="Acquisition Source"
|
|
||||||
data={acquisitionPie}
|
|
||||||
centerValue={(
|
|
||||||
(subscriptions.acquisition_by_source ?? []).reduce((s, r) => s + r.count, 0) ||
|
|
||||||
subscriptions.total_subscriptions
|
|
||||||
).toString()}
|
|
||||||
centerLabel="Subs"
|
|
||||||
/>
|
|
||||||
<BreakdownList
|
|
||||||
title="Active by Plan"
|
|
||||||
data={subscriptions.active_by_plan ?? []}
|
|
||||||
total={snapshot?.active_now}
|
|
||||||
/>
|
|
||||||
<BreakdownList
|
|
||||||
title="Lifetime vs Term"
|
|
||||||
data={subscriptions.active_by_lifetime ?? []}
|
|
||||||
total={snapshot?.active_now}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="mt-4 grid items-start gap-4 lg:grid-cols-3">
|
|
||||||
<AmountBreakdownList
|
|
||||||
title="Revenue by Category"
|
|
||||||
data={subscriptions.revenue_by_category ?? []}
|
|
||||||
/>
|
|
||||||
<BreakdownList title="Payments by Method" data={payments.by_method} total={payments.total_payments} />
|
|
||||||
<BreakdownList title="Payments by Status" data={payments.by_status} total={payments.total_payments} />
|
|
||||||
</div>
|
|
||||||
<div className="mt-4 grid items-start gap-4 lg:grid-cols-3">
|
|
||||||
<BreakdownList
|
|
||||||
title="Subscriptions by Status"
|
|
||||||
data={subscriptions.by_status}
|
|
||||||
total={subscriptions.total_subscriptions}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
|
|
@ -1187,7 +940,7 @@ export function AnalyticsPage() {
|
||||||
)}
|
)}
|
||||||
{examPrep && (
|
{examPrep && (
|
||||||
<BreakdownList
|
<BreakdownList
|
||||||
title="Exam prep"
|
title="Duolingo/IELTS"
|
||||||
data={[
|
data={[
|
||||||
{ label: "Catalog courses", count: examPrep.catalog_courses },
|
{ label: "Catalog courses", count: examPrep.catalog_courses },
|
||||||
{ label: "Units", count: examPrep.units },
|
{ label: "Units", count: examPrep.units },
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ export function AddPracticeFlow() {
|
||||||
const programLabel = isExamPrep
|
const programLabel = isExamPrep
|
||||||
? programType === "skill"
|
? programType === "skill"
|
||||||
? "Skill-Based Courses"
|
? "Skill-Based Courses"
|
||||||
: "English Proficiency Exams"
|
: "Duolingo/IELTS"
|
||||||
: level
|
: level
|
||||||
? `Program ${level}`
|
? `Program ${level}`
|
||||||
: null;
|
: null;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ export function AttachPracticeFlow() {
|
||||||
program:
|
program:
|
||||||
programType === "skill"
|
programType === "skill"
|
||||||
? "Skill-Based Courses"
|
? "Skill-Based Courses"
|
||||||
: "English Proficiency Exams",
|
: "Duolingo/IELTS",
|
||||||
module: "Module 4: Interactive Speaking",
|
module: "Module 4: Interactive Speaking",
|
||||||
video: "Intro to Interactive Speaking",
|
video: "Intro to Interactive Speaking",
|
||||||
questionType: "speaking",
|
questionType: "speaking",
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ export function AttachProgramPracticeFlow() {
|
||||||
const [isPublished, setIsPublished] = useState(false);
|
const [isPublished, setIsPublished] = useState(false);
|
||||||
|
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
program: "English Proficiency Exams",
|
program: "Duolingo/IELTS",
|
||||||
test: "Mock Exam 1",
|
test: "Mock Exam 1",
|
||||||
questionType: "Speaking Practice",
|
questionType: "Speaking Practice",
|
||||||
version: "V 1.0",
|
version: "V 1.0",
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,7 @@ export function CourseCategoryPage() {
|
||||||
Category name
|
Category name
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
placeholder="e.g. Beginner English, Exam Prep"
|
placeholder="e.g. Beginner English, Duolingo/IELTS"
|
||||||
value={newCategoryName}
|
value={newCategoryName}
|
||||||
onChange={(e) => setNewCategoryName(e.target.value)}
|
onChange={(e) => setNewCategoryName(e.target.value)}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ export function EditPracticeFlow() {
|
||||||
const programLabel = isExamPrep
|
const programLabel = isExamPrep
|
||||||
? programType === "skill"
|
? programType === "skill"
|
||||||
? "Skill-Based Courses"
|
? "Skill-Based Courses"
|
||||||
: "English Proficiency Exams"
|
: "Duolingo/IELTS"
|
||||||
: level
|
: level
|
||||||
? `Program ${level}`
|
? `Program ${level}`
|
||||||
: null;
|
: null;
|
||||||
|
|
|
||||||
|
|
@ -84,8 +84,7 @@ export function NewContentPage() {
|
||||||
<CardContent className="border-t border-grayScale-200 bg-white p-8 text-center">
|
<CardContent className="border-t border-grayScale-200 bg-white p-8 text-center">
|
||||||
<h3 className="text-xl font-bold text-grayScale-700">Courses</h3>
|
<h3 className="text-xl font-bold text-grayScale-700">Courses</h3>
|
||||||
<p className="mt-3 text-sm leading-relaxed text-grayScale-500">
|
<p className="mt-3 text-sm leading-relaxed text-grayScale-500">
|
||||||
Manage skill-based and exam preparation courses such as Duolingo
|
Manage skill-based and Duolingo/IELTS courses.
|
||||||
and IELTS.
|
|
||||||
</p>
|
</p>
|
||||||
<Link to="/new-content/courses" className="block w-full">
|
<Link to="/new-content/courses" className="block w-full">
|
||||||
<Button className="mt-8 h-12 w-full rounded-[6px] bg-brand-500 text-base font-semibold ">
|
<Button className="mt-8 h-12 w-full rounded-[6px] bg-brand-500 text-base font-semibold ">
|
||||||
|
|
|
||||||
|
|
@ -90,9 +90,9 @@ export function ProgramDetailPage() {
|
||||||
// Mock data for "proficiency" program type
|
// Mock data for "proficiency" program type
|
||||||
const programs: Record<string, any> = {
|
const programs: Record<string, any> = {
|
||||||
proficiency: {
|
proficiency: {
|
||||||
title: "English Proficiency Exams",
|
title: "Duolingo/IELTS",
|
||||||
description:
|
description:
|
||||||
"Manage exam-based learning programs such as Duolingo and IELTS.",
|
"Manage Duolingo/IELTS learning programs.",
|
||||||
courses: [],
|
courses: [],
|
||||||
},
|
},
|
||||||
"skill-based": {
|
"skill-based": {
|
||||||
|
|
@ -667,7 +667,7 @@ export function ProgramDetailPage() {
|
||||||
No catalog courses yet
|
No catalog courses yet
|
||||||
</p>
|
</p>
|
||||||
<p className="mt-1 text-sm text-grayScale-400">
|
<p className="mt-1 text-sm text-grayScale-400">
|
||||||
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.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
) : programType === "proficiency" && filteredProficiencyCourses.length === 0 ? (
|
) : programType === "proficiency" && filteredProficiencyCourses.length === 0 ? (
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ export function ProgramTypeSelectionPage() {
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
{/* English Proficiency Exams Card */}
|
{/* Duolingo/IELTS Card */}
|
||||||
<Link to="/new-content/courses/proficiency" className="group h-full">
|
<Link to="/new-content/courses/proficiency" className="group h-full">
|
||||||
<div className="bg-white w-[500px] rounded-[6px] border border-grayScale-100 px-10 py-12 h-full transition-all flex flex-col items-start gap-10">
|
<div className="bg-white w-[500px] rounded-[6px] border border-grayScale-100 px-10 py-12 h-full transition-all flex flex-col items-start gap-10">
|
||||||
<div className="h-16 w-16 rounded-full bg-brand-50/10 flex items-center justify-center">
|
<div className="h-16 w-16 rounded-full bg-brand-50/10 flex items-center justify-center">
|
||||||
|
|
@ -63,11 +63,11 @@ export function ProgramTypeSelectionPage() {
|
||||||
|
|
||||||
<div className="space-y-3 flex-1">
|
<div className="space-y-3 flex-1">
|
||||||
<h3 className="text-[20px] font-bold text-grayScale-900 transition-colors">
|
<h3 className="text-[20px] font-bold text-grayScale-900 transition-colors">
|
||||||
English Proficiency Exams
|
Duolingo/IELTS
|
||||||
</h3>
|
</h3>
|
||||||
<p className="text-[15px] leading-relaxed text-grayScale-500 font-medium">
|
<p className="text-[15px] leading-relaxed text-grayScale-500 font-medium">
|
||||||
Exam preparation courses such as IELTS, and Duolingo. Structure
|
Duolingo/IELTS courses. Structure content by band scores,
|
||||||
content by band scores, sections, and mock tests.
|
sections, and mock tests.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ export function ExamPrepContentHierarchyList() {
|
||||||
setLessons(fetchedLessons)
|
setLessons(fetchedLessons)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to fetch exam prep hierarchy:", 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 {
|
} finally {
|
||||||
setLoading({})
|
setLoading({})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ export function AttachPracticeStep1({
|
||||||
>
|
>
|
||||||
<option value="">Choose Program</option>
|
<option value="">Choose Program</option>
|
||||||
<option value="skill">Skill-Based Courses</option>
|
<option value="skill">Skill-Based Courses</option>
|
||||||
<option value="exams">English Proficiency Exams</option>
|
<option value="exams">Duolingo/IELTS</option>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ export function ProgramAttachStep1({
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<option value="">Choose Program</option>
|
<option value="">Choose Program</option>
|
||||||
<option value="exams">English Proficiency Exams</option>
|
<option value="exams">Duolingo/IELTS</option>
|
||||||
<option value="skill">Skill-Based Courses</option>
|
<option value="skill">Skill-Based Courses</option>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ export function SelectPracticeToAttachStep({
|
||||||
<p className="max-w-sm text-xs text-grayScale-500">
|
<p className="max-w-sm text-xs text-grayScale-500">
|
||||||
{unlinkedOnly
|
{unlinkedOnly
|
||||||
? isExamPrep
|
? 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."
|
: "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."}
|
: "Try a different search, switch to unlinked only, or create a new practice instead."}
|
||||||
</p>
|
</p>
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ export function PersonasPage() {
|
||||||
<h1 className="text-2xl font-semibold tracking-tight text-grayScale-800">Personas</h1>
|
<h1 className="text-2xl font-semibold tracking-tight text-grayScale-800">Personas</h1>
|
||||||
<p className="mt-1 max-w-2xl text-sm text-grayScale-500">
|
<p className="mt-1 max-w-2xl text-sm text-grayScale-500">
|
||||||
Manage coach and character profiles linked to practice shells in Learn English and
|
Manage coach and character profiles linked to practice shells in Learn English and
|
||||||
exam-prep content.
|
Duolingo/IELTS content.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-wrap gap-2">
|
<div className="flex flex-wrap gap-2">
|
||||||
|
|
|
||||||
|
|
@ -272,7 +272,7 @@ export function UserLearningActivitySection({
|
||||||
<div>
|
<div>
|
||||||
<CardTitle className="text-base">Learning activity</CardTitle>
|
<CardTitle className="text-base">Learning activity</CardTitle>
|
||||||
<p className="mt-0.5 text-xs text-grayScale-500">
|
<p className="mt-0.5 text-xs text-grayScale-500">
|
||||||
LMS and exam prep progress trees for this learner.
|
LMS and Duolingo/IELTS progress trees for this learner.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -307,7 +307,7 @@ export function UserLearningActivitySection({
|
||||||
)}
|
)}
|
||||||
onClick={() => setTrack("exam_prep")}
|
onClick={() => setTrack("exam_prep")}
|
||||||
>
|
>
|
||||||
Exam prep
|
Duolingo/IELTS
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -373,7 +373,7 @@ export function UserLearningActivitySection({
|
||||||
{!loading && !error && activity && track === "exam_prep" ? (
|
{!loading && !error && activity && track === "exam_prep" ? (
|
||||||
<>
|
<>
|
||||||
<div className="grid gap-2 sm:grid-cols-2 lg:grid-cols-3">
|
<div className="grid gap-2 sm:grid-cols-2 lg:grid-cols-3">
|
||||||
<Metric label="Exam prep courses" value={catalogCourses.length} />
|
<Metric label="Duolingo/IELTS courses" value={catalogCourses.length} />
|
||||||
<Metric
|
<Metric
|
||||||
label="Accessible courses"
|
label="Accessible courses"
|
||||||
value={catalogCourses.filter((course) => course.access.is_accessible).length}
|
value={catalogCourses.filter((course) => course.access.is_accessible).length}
|
||||||
|
|
@ -393,7 +393,7 @@ export function UserLearningActivitySection({
|
||||||
disabled={catalogCourses.length === 0}
|
disabled={catalogCourses.length === 0}
|
||||||
>
|
>
|
||||||
<option value="">
|
<option value="">
|
||||||
{catalogCourses.length === 0 ? "No exam prep courses" : "Select exam prep course..."}
|
{catalogCourses.length === 0 ? "No Duolingo/IELTS courses" : "Select Duolingo/IELTS course..."}
|
||||||
</option>
|
</option>
|
||||||
{catalogCourses.map((course) => (
|
{catalogCourses.map((course) => (
|
||||||
<option key={course.id} value={course.id}>
|
<option key={course.id} value={course.id}>
|
||||||
|
|
@ -406,7 +406,7 @@ export function UserLearningActivitySection({
|
||||||
{selectedCatalogCourse ? (
|
{selectedCatalogCourse ? (
|
||||||
<CourseBlock course={selectedCatalogCourse} examPrep />
|
<CourseBlock course={selectedCatalogCourse} examPrep />
|
||||||
) : (
|
) : (
|
||||||
<p className="py-6 text-center text-sm text-grayScale-400">No exam prep activity yet.</p>
|
<p className="py-6 text-center text-sm text-grayScale-400">No Duolingo/IELTS activity yet.</p>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user