|
1 | 1 | import { Skeleton } from '@heroui/skeleton'; |
2 | 2 | import { getInvoiceDrafts } from '@lib/api/backend'; |
3 | 3 | import { BorderedCard } from '@shared/cards/BorderedCard'; |
| 4 | +import { DetailedAlert } from '@shared/DetailedAlert'; |
4 | 5 | import EmptyData from '@shared/EmptyData'; |
5 | 6 | import ListHeader from '@shared/ListHeader'; |
6 | 7 | import { InvoiceDraft } from '@typedefs/general'; |
7 | 8 | import _ from 'lodash'; |
8 | 9 | import { useEffect, useState } from 'react'; |
9 | 10 | import toast from 'react-hot-toast'; |
10 | | -import { RiDraftLine, RiErrorWarningLine, RiFileInfoLine } from 'react-icons/ri'; |
| 11 | +import { RiCloseCircleLine, RiDraftLine, RiFileInfoLine } from 'react-icons/ri'; |
11 | 12 | import BillingMonthSelect from './BillingMonthSelect'; |
12 | 13 | import DraftInvoiceCard from './DraftInvoiceCard'; |
13 | 14 |
|
14 | 15 | function Invoicing() { |
15 | | - const [billingInfo, _setBillingInfo] = useState({ |
16 | | - companyName: '—', |
17 | | - billingEmail: '—', |
18 | | - vatNumber: '—', |
19 | | - paymentAddress: '—', |
20 | | - }); |
21 | | - |
22 | 16 | const [uniqueMonths, setUniqueMonths] = useState<string[]>([]); |
23 | 17 | const [invoiceDrafts, setInvoiceDrafts] = useState<InvoiceDraft[] | undefined>(); |
24 | 18 |
|
@@ -62,8 +56,9 @@ function Invoicing() { |
62 | 56 | setUniqueMonths(months); |
63 | 57 | } catch (error: any) { |
64 | 58 | console.error(error); |
65 | | - setError(error.message); |
66 | | - toast.error('Failed to fetch invoice drafts.'); |
| 59 | + const errorMessage = 'Failed to fetch invoice drafts'; |
| 60 | + setError(errorMessage); |
| 61 | + toast.error(errorMessage); |
67 | 62 | } finally { |
68 | 63 | setLoading(false); |
69 | 64 | } |
@@ -112,9 +107,14 @@ function Invoicing() { |
112 | 107 | ))} |
113 | 108 | </> |
114 | 109 | ) : error !== null ? ( |
115 | | - <div className="row gap-1.5 rounded-lg bg-red-100 p-4 text-red-700"> |
116 | | - <RiErrorWarningLine className="text-xl" /> |
117 | | - <div className="text-sm font-medium">{error}</div> |
| 110 | + <div className="py-8 lg:py-12"> |
| 111 | + <DetailedAlert |
| 112 | + variant="red" |
| 113 | + icon={<RiCloseCircleLine />} |
| 114 | + title="Error" |
| 115 | + description={<div>{error}</div>} |
| 116 | + isCompact |
| 117 | + /> |
118 | 118 | </div> |
119 | 119 | ) : invoiceDrafts === undefined || selectedMonth === undefined || !invoiceDrafts.length ? ( |
120 | 120 | <div className="center-all w-full p-14"> |
|
0 commit comments