Align subscription plan categories with backend allowed values.
Replace EXAM_PREP and SKILLS with IELTS and DUOLINGO, and centralize category labels across payments and user subscriptions. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
8e0ebe077a
commit
1915d89bc3
|
|
@ -9,8 +9,8 @@ export const SUBSCRIPTION_PLAN_CATEGORIES: {
|
|||
label: string
|
||||
}[] = [
|
||||
{ value: "LEARN_ENGLISH", label: "Learn English" },
|
||||
{ value: "EXAM_PREP", label: "Exam prep" },
|
||||
{ value: "SKILLS", label: "Skills" },
|
||||
{ value: "IELTS", label: "IELTS" },
|
||||
{ value: "DUOLINGO", label: "Duolingo" },
|
||||
]
|
||||
|
||||
export const SUBSCRIPTION_DURATION_UNITS: {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import {
|
|||
paymentCustomerName,
|
||||
paymentStatusBadgeVariant,
|
||||
} from "../../lib/payments"
|
||||
import { SUBSCRIPTION_CURRENCIES } from "../../lib/subscriptionPlans"
|
||||
import { SUBSCRIPTION_CURRENCIES, SUBSCRIPTION_PLAN_CATEGORIES } from "../../lib/subscriptionPlans"
|
||||
import type {
|
||||
Payment,
|
||||
PaymentPlanCategory,
|
||||
|
|
@ -64,11 +64,7 @@ const PROVIDER_FILTERS: { value: PaymentProvider; label: string }[] = [
|
|||
{ value: "ARIFPAY", label: "Arifpay" },
|
||||
]
|
||||
|
||||
const PLAN_CATEGORY_FILTERS: { value: PaymentPlanCategory; label: string }[] = [
|
||||
{ value: "LEARN_ENGLISH", label: "Learn English" },
|
||||
{ value: "IELTS", label: "IELTS" },
|
||||
{ value: "DUOLINGO", label: "Duolingo" },
|
||||
]
|
||||
const PLAN_CATEGORY_FILTERS = SUBSCRIPTION_PLAN_CATEGORIES
|
||||
|
||||
type PaymentListFilters = {
|
||||
status: PaymentStatus | ""
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import {
|
|||
TableRow,
|
||||
} from "../../../components/ui/table";
|
||||
import { cn } from "../../../lib/utils";
|
||||
import { formatPlanCategory } from "../../../lib/subscriptionPlans";
|
||||
import type { UserSubscriptionsData } from "../../../types/userAdmin.types";
|
||||
|
||||
function formatStatusLabel(status: string): string {
|
||||
|
|
@ -24,10 +25,7 @@ function formatStatusLabel(status: string): string {
|
|||
}
|
||||
|
||||
function formatCategoryLabel(value: string): string {
|
||||
return value
|
||||
.split("_")
|
||||
.map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase())
|
||||
.join(" ");
|
||||
return formatPlanCategory(value);
|
||||
}
|
||||
|
||||
function formatDateTime(value?: string | null): string {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import type { SubscriptionPlanCategory } from "./subscription.types"
|
||||
|
||||
export type PaymentStatus =
|
||||
| "PENDING"
|
||||
| "PROCESSING"
|
||||
|
|
@ -11,7 +13,7 @@ export type PaymentProvider = "CHAPA" | "ARIFPAY" | string
|
|||
|
||||
export type PaymentMethod = PaymentProvider | string
|
||||
|
||||
export type PaymentPlanCategory = "LEARN_ENGLISH" | "IELTS" | "DUOLINGO" | string
|
||||
export type PaymentPlanCategory = SubscriptionPlanCategory
|
||||
|
||||
export interface Payment {
|
||||
id: number
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
export type SubscriptionPlanDurationUnit = "MONTH" | "YEAR" | "WEEK" | "DAY" | string
|
||||
|
||||
export type SubscriptionPlanCategory = "LEARN_ENGLISH" | "EXAM_PREP" | "SKILLS" | string
|
||||
export type SubscriptionPlanCategory = "LEARN_ENGLISH" | "IELTS" | "DUOLINGO"
|
||||
|
||||
export interface SubscriptionPlan {
|
||||
id: number
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user