diff --git a/packages/types/index.d.ts b/packages/types/index.d.ts
index 40be642a..a8a7e48f 100644
--- a/packages/types/index.d.ts
+++ b/packages/types/index.d.ts
@@ -368,6 +368,14 @@ type TBillingLinkCardAction = {
src: string;
}
+type TInvoice = {
+ id: number
+ amount: number
+ currency: string
+ payout_date: string
+ receipt_url: string
+}
+
declare module 'axios' {
interface AxiosResponse {
httpError?: IJSONObject;
diff --git a/packages/web/src/components/Invoices/index.ee.tsx b/packages/web/src/components/Invoices/index.ee.tsx
index 09f2a671..b64bc3a6 100644
--- a/packages/web/src/components/Invoices/index.ee.tsx
+++ b/packages/web/src/components/Invoices/index.ee.tsx
@@ -1,95 +1,19 @@
import * as React from 'react';
-import { Link } from 'react-router-dom';
+import { DateTime } from 'luxon';
import Box from '@mui/material/Box';
-import Button from '@mui/material/Button';
-import Chip from '@mui/material/Chip';
+import Link from '@mui/material/Link';
import Card from '@mui/material/Card';
-import CardActions from '@mui/material/CardActions';
import CardContent from '@mui/material/CardContent';
import Divider from '@mui/material/Divider';
import Grid from '@mui/material/Grid';
import Typography from '@mui/material/Typography';
-import { TBillingCardAction } from '@automatisch/types';
-import * as URLS from 'config/urls';
-import useBillingAndUsageData from 'hooks/useBillingAndUsageData.ee';
+import useInvoices from 'hooks/useInvoices.ee';
import useFormatMessage from 'hooks/useFormatMessage';
-const capitalize = (str: string) =>
- str[0].toUpperCase() + str.slice(1, str.length);
-
-type BillingCardProps = {
- name: string;
- title?: string;
- action?: TBillingCardAction;
-};
-
-function BillingCard(props: BillingCardProps) {
- const { name, title = '', action } = props;
-
- return (
- theme.palette.background.default,
- }}
- >
-
-
- {name}
-
-
-
- {title}
-
-
-
-
-
-
-
- );
-}
-
-function Action(props: { action?: TBillingCardAction }) {
- const { action } = props;
- if (!action) return ;
-
- const { text, type } = action;
-
- if (type === 'link') {
- if (action.src.startsWith('http')) {
- return (
-
- );
- } else {
- return (
-
- );
- }
- }
-
- if (type === 'text') {
- return (
-
- {text}
-
- );
- }
-
- return ;
-}
-
export default function Invoices() {
const formatMessage = useFormatMessage();
- const billingAndUsageData = useBillingAndUsageData();
+ const { invoices } = useInvoices();
return (
@@ -97,93 +21,70 @@ export default function Invoices() {
- Invoices
+ {formatMessage('invoices.invoices')}
-
+
- Date
+ {formatMessage('invoices.date')}
-
+
- Amount
+ {formatMessage('invoices.amount')}
-
+
- Invoice
+ {formatMessage('invoices.invoice')}
+
-
-
- (
+
+ {invoiceIndex !== 0 && }
+
+
- Mar 16, 2023
-
-
+
+
+ {DateTime.fromISO(invoice.payout_date).toFormat('LLL dd, yyyy')}
+
+
-
- €20.00
-
+
+ €{invoice.amount}
+
-
-
-
- Link
-
-
-
-
-
-
-
-
-
- Mar 16, 2023
-
-
-
-
- €20.00
-
-
-
-
- Link
-
-
-
+
+
+
+ {formatMessage('invoices.link')}
+
+
+
+
+
+ ))}
diff --git a/packages/web/src/graphql/queries/get-invoices.ee.ts b/packages/web/src/graphql/queries/get-invoices.ee.ts
new file mode 100644
index 00000000..1710debf
--- /dev/null
+++ b/packages/web/src/graphql/queries/get-invoices.ee.ts
@@ -0,0 +1,14 @@
+import { gql } from '@apollo/client';
+
+export const GET_INVOICES = gql`
+ query GetInvoices {
+ getInvoices {
+ id
+ amount
+ currency
+ payout_date
+ receipt_url
+ }
+ }
+`;
+
diff --git a/packages/web/src/hooks/useInvoices.ee.ts b/packages/web/src/hooks/useInvoices.ee.ts
new file mode 100644
index 00000000..8afdc48c
--- /dev/null
+++ b/packages/web/src/hooks/useInvoices.ee.ts
@@ -0,0 +1,18 @@
+import { useQuery } from '@apollo/client';
+import { TInvoice } from '@automatisch/types';
+
+import { GET_INVOICES } from 'graphql/queries/get-invoices.ee';
+
+type UseInvoicesReturn = {
+ invoices: TInvoice[],
+ loading: boolean;
+};
+
+export default function useInvoices(): UseInvoicesReturn {
+ const { data, loading } = useQuery(GET_INVOICES);
+
+ return {
+ invoices: data?.getInvoices || [],
+ loading: loading
+ };
+}
diff --git a/packages/web/src/locales/en.json b/packages/web/src/locales/en.json
index e183f58c..56b65f62 100644
--- a/packages/web/src/locales/en.json
+++ b/packages/web/src/locales/en.json
@@ -148,5 +148,10 @@
"usageDataInformation.yourUsage": "Your usage",
"usageDataInformation.yourUsageDescription": "Last 30 days total usage",
"usageDataInformation.yourUsageTasks": "Tasks",
- "usageDataInformation.upgrade": "Upgrade"
+ "usageDataInformation.upgrade": "Upgrade",
+ "invoices.invoices": "Invoices",
+ "invoices.date": "Date",
+ "invoices.amount": "Amount",
+ "invoices.invoice": "Invoice",
+ "invoices.link": "Link"
}
\ No newline at end of file