changes some status

This commit is contained in:
Jelaletdin12
2026-10-02 17:43:37 +05:00
parent cbd17608c1
commit 6e626482f6
15 changed files with 553 additions and 99 deletions

View File

@@ -2,6 +2,7 @@ import { useCallback } from "react";
import { useTranslation } from "react-i18next";
import type { TFunction } from "i18next";
import { REGION_LABELS } from "@/constants/regionCodes";
import { getOrderTypeLabel } from "@/constants/orderTypes";
import type { LocalizedName, OrderType } from "@/features/dashboard/api/analyticsApi";
// ─── Formatting ───────────────────────────────────────────────────────────────
@@ -39,15 +40,7 @@ export function useLocalizedName() {
}
export function orderTypeLabel(type: OrderType | string, t: TFunction): string {
const fallback: Record<string, string> = {
loan: "Karz sargytlary",
loan_paid_off_letter: "Karzyň ýapylandygy",
card: "Täze kart",
card_pin: "Kart pin",
card_rekwizit: "Kart rekwizit",
visa_master: "Visa/Master",
};
return t(`analytics.orderType.${type}`, fallback[type] ?? type);
return getOrderTypeLabel(type, t);
}
export function regionLabel(code: string, t: TFunction): string {

View File

@@ -4,6 +4,7 @@ import type { TFunction } from "i18next";
import { Info } from "lucide-react";
import { Cell, Pie, PieChart } from "recharts";
import { Card, CardContent } from "@/components/ui/card";
import { getEducationLabel, getMarriageLabel } from "@/constants/formOptions";
import { Skeleton } from "@/components/ui/skeleton";
import { ChartContainer, ChartTooltip, ChartTooltipContent } from "@/components/ui/chart";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
@@ -299,11 +300,10 @@ export function CustomersSection({ data, isLoading, isError, onRetry }: QueryPro
}
const unknown = t("analytics.unknown", "Näbelli");
const humanize = (k: string) => k.charAt(0).toUpperCase() + k.slice(1).toLowerCase().replace(/_/g, " ");
const ageLabel = (k: string) =>
k === "under25" ? t("analytics.age.under25", "25 ýaşdan kiçi") : k === "unknown" ? unknown : `${k} ${t("analytics.age.years", "ýaş")}`;
const educationLabel = (k: string) => (k === "unknown" ? unknown : t(`options.education.${k}`, humanize(k)));
const marriageLabel = (k: string) => (k === "unknown" ? unknown : t(`options.marriage.${k}`, humanize(k)));
const educationLabel = (k: string) => (k === "unknown" ? unknown : getEducationLabel(k, t));
const marriageLabel = (k: string) => (k === "unknown" ? unknown : getMarriageLabel(k, t));
const guarantorLabel = (k: string) =>
({
none: t("analytics.guarantors.none", "Zamunsyz"),