mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
fix: improve campaign stats, shared chart components, and i18n coverage
- Extract shared chart constants to constants/charts.ts - Add TREND_STYLES to stats/constants.ts for reuse - Fix useChartColors with MutationObserver for theme changes - Fix DailyChart date parsing to prevent timezone shift - Add truncate to StatCard value for overflow safety - Fix CampaignCard copy feedback inside try block - Add NaN validation and staleTime to AdminCampaignStats - Replace hardcoded strings with i18n keys in Referral page - Add missing i18n keys across all 4 locales (en, ru, zh, fa) - Add sales stats route to AdminPanel and App router
This commit is contained in:
22
src/constants/charts.ts
Normal file
22
src/constants/charts.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export const CHART_COMMON = {
|
||||
KOPEKS_DIVISOR: 100,
|
||||
GRADIENT: {
|
||||
START_OFFSET: '5%',
|
||||
END_OFFSET: '95%',
|
||||
START_OPACITY: 0.3,
|
||||
END_OPACITY: 0,
|
||||
},
|
||||
AXIS: {
|
||||
TICK_FONT_SIZE: 11,
|
||||
},
|
||||
TOOLTIP: {
|
||||
BORDER_RADIUS: '8px',
|
||||
FONT_SIZE: '12px',
|
||||
},
|
||||
STROKE_WIDTH: 2,
|
||||
GRID_DASH: '3 3',
|
||||
STALE_TIME: 60_000,
|
||||
CHART: {
|
||||
MARGIN: { top: 5, right: 10, left: 0, bottom: 5 },
|
||||
},
|
||||
} as const;
|
||||
@@ -1,39 +1,33 @@
|
||||
import { CHART_COMMON } from './charts';
|
||||
|
||||
export const PARTNER_STATS = {
|
||||
/** Chart visual configuration */
|
||||
CHART: {
|
||||
...CHART_COMMON.CHART,
|
||||
HEIGHT: 200,
|
||||
MARGIN: { top: 5, right: 10, left: 0, bottom: 5 },
|
||||
},
|
||||
/** Kopeks-to-currency divisor */
|
||||
KOPEKS_DIVISOR: 100,
|
||||
KOPEKS_DIVISOR: CHART_COMMON.KOPEKS_DIVISOR,
|
||||
/** Copy feedback duration in ms */
|
||||
COPY_FEEDBACK_MS: 2000,
|
||||
/** Gradient stop offsets */
|
||||
GRADIENT: {
|
||||
START_OFFSET: '5%',
|
||||
END_OFFSET: '95%',
|
||||
START_OPACITY: 0.3,
|
||||
END_OPACITY: 0,
|
||||
},
|
||||
GRADIENT: CHART_COMMON.GRADIENT,
|
||||
/** Axis tick styling */
|
||||
AXIS: {
|
||||
TICK_FONT_SIZE: 11,
|
||||
TICK_FONT_SIZE: CHART_COMMON.AXIS.TICK_FONT_SIZE,
|
||||
EARNINGS_WIDTH: 45,
|
||||
REFERRALS_WIDTH: 30,
|
||||
},
|
||||
/** Tooltip styling */
|
||||
TOOLTIP: {
|
||||
BORDER_RADIUS: '8px',
|
||||
FONT_SIZE: '12px',
|
||||
},
|
||||
TOOLTIP: CHART_COMMON.TOOLTIP,
|
||||
/** Area stroke width */
|
||||
STROKE_WIDTH: 2,
|
||||
STROKE_WIDTH: CHART_COMMON.STROKE_WIDTH,
|
||||
/** Grid dash array */
|
||||
GRID_DASH: '3 3',
|
||||
GRID_DASH: CHART_COMMON.GRID_DASH,
|
||||
/** Skeleton count for loading state */
|
||||
SKELETON_COUNT: 3,
|
||||
/** Maximum conversion rate for progress bar */
|
||||
MAX_CONVERSION_RATE: 100,
|
||||
/** Stale time for campaign stats query (ms) */
|
||||
STATS_STALE_TIME: 60_000,
|
||||
STATS_STALE_TIME: CHART_COMMON.STALE_TIME,
|
||||
} as const;
|
||||
|
||||
Reference in New Issue
Block a user