import { CalendarIcon } from "@heroicons/react/24/outline"; import { fetchRevenue } from "@/app/lib/data"; import { generateYAxis } from "@/app/lib/utils"; import { lusitana } from "@/app/ui/fonts"; // This component is representational only. // For data visualization UI, check out: // https://www.tremor.so/ // https://www.chartjs.org/ // https://airbnb.io/visx/ export default async function RevenueChart() { // Make component async, remove the props const revenue = await fetchRevenue(); // Fetch data inside the component const chartHeight = 350; //NOTE: comment in this code when you get to this point in the course const { yAxisLabels, topLabel } = generateYAxis(revenue); if (!revenue || revenue.length === 0) { return

No data available.

; } return (

Recent Revenue

{/* NOTE: comment in this code when you get to this point in the course */} {
{yAxisLabels.map((label) => (

{label}

))}
{revenue.map((month) => (

{month.month}

))}

Last 12 months

}
); }