From db28d8d3e79bbbedf0b10b0e9bd0fc9619407804 Mon Sep 17 00:00:00 2001 From: Jakub Knetl Date: Tue, 2 Jan 2024 18:26:37 +0100 Subject: [PATCH] Chapter 9 - group cards to stream them at once --- app/dashboard/(overview)/page.tsx | 14 +++++--------- app/ui/dashboard/cards.tsx | 13 +++++++++---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/app/dashboard/(overview)/page.tsx b/app/dashboard/(overview)/page.tsx index b5a8806..a5dd5dd 100644 --- a/app/dashboard/(overview)/page.tsx +++ b/app/dashboard/(overview)/page.tsx @@ -4,7 +4,8 @@ import LatestInvoices from '@/app/ui/dashboard/latest-invoices'; import { lusitana } from '@/app/ui/fonts'; import { fetchCardData} from "@/app/lib/data"; import { Suspense } from 'react'; -import {LatestInvoicesSkeleton, RevenueChartSkeleton} from '@/app/ui/skeletons'; +import {CardsSkeleton, LatestInvoicesSkeleton, RevenueChartSkeleton} from '@/app/ui/skeletons'; +import CardWrapper from '@/app/ui/dashboard/cards'; export default async function Page() { @@ -20,14 +21,9 @@ export default async function Page() { Dashboard
- - - - + }> + +
}> diff --git a/app/ui/dashboard/cards.tsx b/app/ui/dashboard/cards.tsx index 0ee0286..72e4226 100644 --- a/app/ui/dashboard/cards.tsx +++ b/app/ui/dashboard/cards.tsx @@ -5,6 +5,7 @@ import { InboxIcon, } from '@heroicons/react/24/outline'; import { lusitana } from '@/app/ui/fonts'; +import {fetchCardData} from "@/app/lib/data"; const iconMap = { collected: BanknotesIcon, @@ -14,18 +15,22 @@ const iconMap = { }; export default async function CardWrapper() { + const { + numberOfInvoices, + numberOfCustomers, + totalPaidInvoices, + totalPendingInvoices, + } = await fetchCardData(); return ( <> - {/* NOTE: comment in this code when you get to this point in the course */} - - {/* + */} + /> ); }