diff --git a/dashboard/15-final/app/dashboard/invoices/page.tsx b/dashboard/15-final/app/dashboard/invoices/page.tsx
index c6de907..7b19125 100644
--- a/dashboard/15-final/app/dashboard/invoices/page.tsx
+++ b/dashboard/15-final/app/dashboard/invoices/page.tsx
@@ -3,6 +3,7 @@ import Search from '@/app/ui/invoices/search';
import { CreateInvoice } from '@/app/ui/invoices/buttons';
import Table from '@/app/ui/invoices/table';
import { fetchFilteredInvoices } from '@/app/lib/data';
+import { lusitana } from '@/app/ui/fonts';
export default async function Page({
searchParams,
@@ -25,14 +26,16 @@ export default async function Page({
return (
-
Invoices
+ Invoices
+
+
+
-
);
}
diff --git a/dashboard/15-final/app/dashboard/layout.tsx b/dashboard/15-final/app/dashboard/layout.tsx
index 291d5ca..024d269 100644
--- a/dashboard/15-final/app/dashboard/layout.tsx
+++ b/dashboard/15-final/app/dashboard/layout.tsx
@@ -6,7 +6,7 @@ export default function Layout({ children }: { children: React.ReactNode }) {
-
{children}
+
{children}
);
}
diff --git a/dashboard/15-final/app/lib/data.ts b/dashboard/15-final/app/lib/data.ts
index 3138221..2ddced7 100644
--- a/dashboard/15-final/app/lib/data.ts
+++ b/dashboard/15-final/app/lib/data.ts
@@ -82,7 +82,7 @@ export async function fetchFilteredInvoices(
query: string,
currentPage: number,
) {
- const itemsPerPage = 10;
+ const itemsPerPage = 6;
const offset = (currentPage - 1) * itemsPerPage;
try {
diff --git a/dashboard/15-final/app/ui/invoices/buttons.tsx b/dashboard/15-final/app/ui/invoices/buttons.tsx
index b2800cc..f3e348b 100644
--- a/dashboard/15-final/app/ui/invoices/buttons.tsx
+++ b/dashboard/15-final/app/ui/invoices/buttons.tsx
@@ -1,4 +1,4 @@
-import { PencilSquareIcon, TrashIcon } from '@heroicons/react/24/outline';
+import { PencilIcon, PlusIcon, TrashIcon } from '@heroicons/react/24/outline';
import Link from 'next/link';
import { deleteInvoice } from '@/app/lib/actions';
@@ -6,9 +6,10 @@ export function CreateInvoice() {
return (
- Create Invoice
+ Create Invoice{' '}
+
);
}
@@ -17,9 +18,9 @@ export function UpdateInvoice({ id }: { id: string }) {
return (
-
+
);
}
@@ -28,9 +29,9 @@ export function DeleteInvoice({ id }: { id: string }) {
return (
);
diff --git a/dashboard/15-final/app/ui/invoices/pagination.tsx b/dashboard/15-final/app/ui/invoices/pagination.tsx
index 30ca93a..71f6f39 100644
--- a/dashboard/15-final/app/ui/invoices/pagination.tsx
+++ b/dashboard/15-final/app/ui/invoices/pagination.tsx
@@ -1,6 +1,6 @@
'use client';
-import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/24/outline';
+import { ArrowLeftIcon, ArrowRightIcon } from '@heroicons/react/24/outline';
import { usePathname, useSearchParams } from 'next/navigation';
import clsx from 'clsx';
import Link from 'next/link';
@@ -26,46 +26,50 @@ export default function Pagination({
};
return (
-
+
-
+
- {allPages.map((page) => {
- const PageTag = page === currentPage ? 'p' : Link;
- return (
-
- {page}
-
- );
- })}
+
+ {allPages.map((page, i) => {
+ const PageTag = page === currentPage ? 'p' : Link;
+ return (
+
+ {page}
+
+ );
+ })}
+
-
+
);
diff --git a/dashboard/15-final/app/ui/invoices/search.tsx b/dashboard/15-final/app/ui/invoices/search.tsx
index a09b2cf..a7a3977 100644
--- a/dashboard/15-final/app/ui/invoices/search.tsx
+++ b/dashboard/15-final/app/ui/invoices/search.tsx
@@ -22,16 +22,16 @@ export default function Search() {
}, 300);
return (
-
+
-
+
{
handleSearch(e.target.value);
}}
diff --git a/dashboard/15-final/app/ui/invoices/status.tsx b/dashboard/15-final/app/ui/invoices/status.tsx
index ce2534c..b79eb88 100644
--- a/dashboard/15-final/app/ui/invoices/status.tsx
+++ b/dashboard/15-final/app/ui/invoices/status.tsx
@@ -1,25 +1,27 @@
-import { CheckCircleIcon, ClockIcon } from '@heroicons/react/24/outline';
+import { CheckIcon, ClockIcon } from '@heroicons/react/24/outline';
import clsx from 'clsx';
export default function InvoiceStatus({ status }: { status: string }) {
return (
{status === 'pending' ? (
<>
- Pending
+ Pending
+
>
) : null}
{status === 'paid' ? (
<>
- Paid
+ Paid
+
>
) : null}
diff --git a/dashboard/15-final/app/ui/invoices/table.tsx b/dashboard/15-final/app/ui/invoices/table.tsx
index d8c2437..94fb312 100644
--- a/dashboard/15-final/app/ui/invoices/table.tsx
+++ b/dashboard/15-final/app/ui/invoices/table.tsx
@@ -9,38 +9,96 @@ export default async function InvoicesTable({
}: {
invoices: InvoicesTable[];
}) {
+ const styles = `
+ /* Round top-left and top-right corners of the first row in tbody */
+ tbody tr:first-child td:first-child {
+ border-top-left-radius: 8px;
+ }
+ tbody tr:first-child td:last-child {
+ border-top-right-radius: 8px;
+ }
+
+ /* Round bottom-left and bottom-right corners of the last row in tbody */
+ tbody tr:last-child td:first-child {
+ border-bottom-left-radius: 8px;
+ }
+ tbody tr:last-child td:last-child {
+ border-bottom-right-radius: 8px;
+ }
+ `;
return (
-
+
+
-
-
-
+
+
+ {invoices?.map((invoice) => (
+
+
+
+
+
+ {formatCurrency(invoice.amount)}
+
+
{formatDateToLocal(invoice.date)}
+
+
+
+
+
+
+
+ ))}
+
+
+
- |
+ |
Customer
|
-
+ |
Email
|
-
+ |
Amount
|
-
+ |
Date
|
-
+ |
Status
|
-
+ |
Edit
|
-
+
{invoices?.map((invoice) => (
-
- |
+ |
+ |
{invoice.name}
|
-
+ |
{invoice.email}
|
-
+ |
{formatCurrency(invoice.amount)}
|
-
+ |
{formatDateToLocal(invoice.date)}
|
-
+ |
|
-
+ |
|