"use client"
import { Bar, BarChart, LabelList, XAxis, YAxis, Cell } from "recharts"
import { cn } from "@/lib/utils"
import {
ChartContainer,
type ChartConfig,
} from "@/components/ui/chart"
const COLORS = [
"#4ade80",
"#60a5fa",
"#f87171",
"#fb923c",
"#c084fc",
]
const chartConfig = {
total_seconds: {
label: "Seconds",
},
} satisfies ChartConfig
type ChartData = {
language: string
total_seconds: number
label: string
}
interface MyBarChartProps {
data: ChartData[]
className?: string
}
interface MyBarChartSkeletonProps {
className?: string
}
export function MyBarChart({ data, className }: MyBarChartProps) {
return (
{data.map((_, index) => (
|
))}
(
{String(value)}
)}
/>
)
}
export function MyBarChartSkeleton({ className }: MyBarChartSkeletonProps) {
const fakeData = [
{ language: "a", total_seconds: 102000 },
{ language: "b", total_seconds: 59000 },
{ language: "c", total_seconds: 41000 },
{ language: "d", total_seconds: 28000 },
{ language: "e", total_seconds: 17000 },
]
return (
)
}
export function MyBarChartError({ className }: MyBarChartSkeletonProps) {
const fakeData = [
{ language: "a", total_seconds: 102000 },
{ language: "b", total_seconds: 59000 },
{ language: "c", total_seconds: 41000 },
{ language: "d", total_seconds: 28000 },
{ language: "e", total_seconds: 17000 },
]
return (
Failed to fetch Wakatime stats :/
)
}