import { formatDateAxis } from '@components/shared/DetailedAreaChart' import dayjs from 'dayjs' import { BirdeyePriceResponse } from 'hooks/useBirdeyeMarketPrices' import { useTheme } from 'next-themes' import { useMemo } from 'react' import { Area, AreaChart, ResponsiveContainer, XAxis, YAxis } from 'recharts' import { COLORS } from 'styles/colors' import { formatCurrencyValue } from 'utils/numbers' const PriceChart = ({ prices, daysToShow, }: { prices: BirdeyePriceResponse[] daysToShow: number }) => { const { theme } = useTheme() const change = useMemo(() => { return prices[prices.length - 1].value - prices[0].value }, [prices]) return (
= 0 ? COLORS.UP[theme] : COLORS.DOWN[theme] } stopOpacity={0.15} /> = 0 ? COLORS.UP[theme] : COLORS.DOWN[theme] } stopOpacity={0} /> = 0 ? COLORS.UP[theme] : COLORS.DOWN[theme]} strokeWidth={1.5} fill="url(#gradientArea)" /> formatDateAxis(dayjs(d * 1000).toISOString(), daysToShow) } /> formatCurrencyValue(x)} tickLine={false} width={prices[0].value < 0.00001 ? 100 : 60} />
) } export default PriceChart