From 38f6a47f6500bed31d05ddc7a7125e937c64b34f Mon Sep 17 00:00:00 2001 From: behnam Date: Fri, 1 Nov 2024 18:23:00 +0300 Subject: [PATCH] Update latest invoices architecture to follow controller architecture --- src/app/dashboard/(overview)/page.tsx | 2 +- .../latest-invoices-controller.ts | 5 ++++ .../{ => latest-invoices}/latest-invoices.tsx | 26 ++++++++++--------- 3 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 src/app/dashboard/components/latest-invoices/latest-invoices-controller.ts rename src/app/dashboard/components/{ => latest-invoices}/latest-invoices.tsx (88%) diff --git a/src/app/dashboard/(overview)/page.tsx b/src/app/dashboard/(overview)/page.tsx index e6017fc..519d478 100644 --- a/src/app/dashboard/(overview)/page.tsx +++ b/src/app/dashboard/(overview)/page.tsx @@ -1,6 +1,6 @@ import { LatestInvoicesSkeleton, RevenueChartSkeleton } from "@/app/dashboard/components/skeletons/skeletons"; import CardWrapper from "@/app/dashboard/components/cards/cards"; -import LatestInvoices from "@/app/dashboard/components/latest-invoices"; +import LatestInvoices from "@/app/dashboard/components/latest-invoices/latest-invoices"; import RevenueChart from "@/app/dashboard/components/revenue-chart/revenue-chart"; import { Suspense } from "react"; diff --git a/src/app/dashboard/components/latest-invoices/latest-invoices-controller.ts b/src/app/dashboard/components/latest-invoices/latest-invoices-controller.ts new file mode 100644 index 0000000..45bde22 --- /dev/null +++ b/src/app/dashboard/components/latest-invoices/latest-invoices-controller.ts @@ -0,0 +1,5 @@ +import fetchCustomerInvoicesUsecase from "@/feature/core/customer-invoice/domain/usecase/fetch-customer-invoices-usecase"; + +export default function latestInvoicesController() { + return fetchCustomerInvoicesUsecase() +} \ No newline at end of file diff --git a/src/app/dashboard/components/latest-invoices.tsx b/src/app/dashboard/components/latest-invoices/latest-invoices.tsx similarity index 88% rename from src/app/dashboard/components/latest-invoices.tsx rename to src/app/dashboard/components/latest-invoices/latest-invoices.tsx index 6f62655..0db6556 100644 --- a/src/app/dashboard/components/latest-invoices.tsx +++ b/src/app/dashboard/components/latest-invoices/latest-invoices.tsx @@ -1,19 +1,12 @@ -import fetchCustomerInvoicesUsecase from '@/feature/core/customer-invoice/domain/usecase/fetch-customer-invoices-usecase'; +import latestInvoicesController from '@/app/dashboard/components/latest-invoices/latest-invoices-controller'; import { ArrowPathIcon } from '@heroicons/react/24/outline'; import clsx from 'clsx'; import Image from 'next/image'; + export default async function LatestInvoices() { - const latestInvoices = await fetchCustomerInvoicesUsecase(); + const latestInvoices = await latestInvoicesController(); - return ( -
-

- Latest Invoices -

-
- -
- {latestInvoices.map((invoice, i) => { + const invoices = latestInvoices.map((invoice, i) => { return (
); - })} + }) + return ( +
+

+ Latest Invoices +

+
+ +
+ {invoices}