ifixkart-admin/New admin panel/ikixkart-dashboard/components/charts/ApexChart.tsx
Adithiyan bbd3a3e959 feat: initial commit — full platform snapshot
- Backend: FastAPI app with all models, services, schemas, routes
- Admin Panel: Next.js dashboard with all modules
  (CRM, POS, repairs, warranties, billing, notifications, etc.)
- Ecommerce: storefront (submodule) + product catalog
- AI Agents: .agents/ skill library for Antigravity IDE
- Docs: architecture, billing, notification gateway markdown
- Submodules: Backend/OpenWA, Ecommerce/File 2/storefront
2026-10-13 12:59:47 +05:30

48 lines
1.5 KiB
TypeScript

'use client';
import { useEffect, useState } from 'react';
import type { ApexOptions } from 'apexcharts';
import { cn } from '@/lib/utils';
interface ApexChartProps {
type: 'line' | 'area' | 'bar' | 'pie' | 'donut' | 'radialBar' | 'scatter' | 'bubble' | 'heatmap' | 'candlestick' | 'boxPlot' | 'radar' | 'polarArea' | 'rangeBar' | 'rangeArea' | 'treemap';
series: ApexOptions['series'];
options: ApexOptions;
height?: number | string;
width?: string | number;
className?: string;
}
export function ApexChart({ type, series, options, height = 280, width = '100%', className }: ApexChartProps) {
const [Chart, setChart] = useState<typeof import('react-apexcharts').default | null>(null);
useEffect(() => {
let cancelled = false;
import('react-apexcharts').then((mod) => {
if (!cancelled) setChart(() => mod.default);
});
return () => {
cancelled = true;
};
}, []);
if (!Chart) {
return (
<div
className={cn('min-w-0 w-full max-w-full overflow-hidden animate-pulse rounded-[5px] bg-muted', className)}
style={{ height }}
/>
);
}
return (
<div
className={cn(
'min-w-0 w-full max-w-full overflow-hidden [&_.apexcharts-canvas]:!w-full [&_.apexcharts-canvas]:!max-w-full [&_.apexcharts-canvas]:!overflow-hidden [&_.apexcharts-svg]:!max-w-full',
className
)}
>
<Chart type={type} series={series} options={options} height={height} width={width} />
</div>
);
}