diff --git a/src/components/pages/History/Empty.module.css b/src/components/atoms/Table.module.css
similarity index 50%
rename from src/components/pages/History/Empty.module.css
rename to src/components/atoms/Table.module.css
index 37da6b45b..1bb347b03 100644
--- a/src/components/pages/History/Empty.module.css
+++ b/src/components/atoms/Table.module.css
@@ -1,3 +1,11 @@
+.table div {
+ background-color: transparent !important;
+}
+
+.table [role='columnheader'] {
+ font-weight: var(--font-weight-bold);
+}
+
.empty {
width: 100%;
text-align: left;
diff --git a/src/components/atoms/Table.tsx b/src/components/atoms/Table.tsx
new file mode 100644
index 000000000..62194560d
--- /dev/null
+++ b/src/components/atoms/Table.tsx
@@ -0,0 +1,32 @@
+import React, { ReactElement } from 'react'
+import DataTable, { IDataTableProps } from 'react-data-table-component'
+import Loader from './Loader'
+import styles from './Table.module.css'
+
+interface TableProps extends IDataTableProps {
+ isLoading?: boolean
+}
+
+function Empty(): ReactElement {
+ return
No results found
+}
+
+export default function Table({
+ data,
+ columns,
+ isLoading
+}: TableProps): ReactElement {
+ return (
+ = 9}
+ paginationPerPage={10}
+ noDataComponent={}
+ progressPending={isLoading}
+ progressComponent={}
+ />
+ )
+}
diff --git a/src/components/pages/History/ComputeDetails.tsx b/src/components/pages/History/ComputeDetails.tsx
index a4023f9ef..496aefc44 100644
--- a/src/components/pages/History/ComputeDetails.tsx
+++ b/src/components/pages/History/ComputeDetails.tsx
@@ -8,7 +8,7 @@ import Time from '../../atoms/Time'
import shortid from 'shortid'
import styles from './ComputeDetails.module.css'
import { Status } from './ComputeJobs'
-import { ListItem } from 'components/atoms/Lists'
+import { ListItem } from '../../atoms/Lists'
export default function ComputeDetailsModal({
computeJob,
diff --git a/src/components/pages/History/ComputeJobs.module.css b/src/components/pages/History/ComputeJobs.module.css
index 1e648c17b..1a04d262a 100644
--- a/src/components/pages/History/ComputeJobs.module.css
+++ b/src/components/pages/History/ComputeJobs.module.css
@@ -2,7 +2,3 @@
text-transform: uppercase;
color: var(--color-secondary);
}
-
-.table {
- composes: table from './PoolTransactions.module.css';
-}
diff --git a/src/components/pages/History/ComputeJobs.tsx b/src/components/pages/History/ComputeJobs.tsx
index 8470e623c..3061f3d65 100644
--- a/src/components/pages/History/ComputeJobs.tsx
+++ b/src/components/pages/History/ComputeJobs.tsx
@@ -1,16 +1,14 @@
import { useOcean } from '@oceanprotocol/react'
import React, { ReactElement, useEffect, useState } from 'react'
-import DataTable from 'react-data-table-component'
import Time from '../../atoms/Time'
import styles from './ComputeJobs.module.css'
-import Loader from '../../atoms/Loader'
import Button from '../../atoms/Button'
import ComputeDetails from './ComputeDetails'
import { ComputeJobMetaData } from '../../../@types/ComputeJobMetaData'
import { Link } from 'gatsby'
import { Logger } from '@oceanprotocol/lib'
-import Empty from './Empty'
import Dotdotdot from 'react-dotdotdot'
+import Table from '../../atoms/Table'
function DetailsButton({ row }: { row: ComputeJobMetaData }): ReactElement {
const [isDialogOpen, setIsDialogOpen] = useState(false)
@@ -75,13 +73,13 @@ export default function ComputeJobs(): ReactElement {
const [jobs, setJobs] = useState()
const [isLoading, setIsLoading] = useState(false)
- const getTitle = async (did: string) => {
- const ddo = await ocean.metadatacache.retrieveDDO(did)
- const metadata = ddo.findServiceByType('metadata')
- return metadata.attributes.main.name
- }
-
useEffect(() => {
+ async function getTitle(did: string) {
+ const ddo = await ocean.metadatacache.retrieveDDO(did)
+ const metadata = ddo.findServiceByType('metadata')
+ return metadata.attributes.main.name
+ }
+
async function getJobs() {
if (!ocean || !account) return
setIsLoading(true)
@@ -132,17 +130,5 @@ export default function ComputeJobs(): ReactElement {
getJobs()
}, [ocean, account])
- return isLoading ? (
-
- ) : (
- = 9}
- paginationPerPage={10}
- noDataComponent={}
- />
- )
+ return
}
diff --git a/src/components/pages/History/Empty.tsx b/src/components/pages/History/Empty.tsx
deleted file mode 100644
index 6b06bca14..000000000
--- a/src/components/pages/History/Empty.tsx
+++ /dev/null
@@ -1,6 +0,0 @@
-import React, { ReactElement } from 'react'
-import styles from './Empty.module.css'
-
-export default function Empty(): ReactElement {
- return No results found
-}
diff --git a/src/components/pages/History/PoolTransactions.module.css b/src/components/pages/History/PoolTransactions.module.css
deleted file mode 100644
index 32f41b6af..000000000
--- a/src/components/pages/History/PoolTransactions.module.css
+++ /dev/null
@@ -1,7 +0,0 @@
-.table div {
- background-color: transparent !important;
-}
-
-.table [role='columnheader'] {
- font-weight: var(--font-weight-bold);
-}
diff --git a/src/components/pages/History/PoolTransactions.tsx b/src/components/pages/History/PoolTransactions.tsx
index 1d6d94970..ffbf80e8c 100644
--- a/src/components/pages/History/PoolTransactions.tsx
+++ b/src/components/pages/History/PoolTransactions.tsx
@@ -1,14 +1,11 @@
import { PoolTransaction } from '@oceanprotocol/lib/dist/node/balancer/OceanPool'
import { useMetadata, useOcean } from '@oceanprotocol/react'
-import Loader from '../../atoms/Loader'
import { Link } from 'gatsby'
import React, { ReactElement, useEffect, useState } from 'react'
-import DataTable from 'react-data-table-component'
import EtherscanLink from '../../atoms/EtherscanLink'
import Time from '../../atoms/Time'
-import styles from './PoolTransactions.module.css'
-import Empty from './Empty'
import Dotdotdot from 'react-dotdotdot'
+import Table from '../../atoms/Table'
function AssetTitle({ did }: { did: string }): ReactElement {
const { title } = useMetadata(did)
@@ -91,17 +88,5 @@ export default function PoolTransactions(): ReactElement {
getLogs()
}, [ocean, accountId])
- return isLoading ? (
-
- ) : (
- = 9}
- paginationPerPage={10}
- noDataComponent={}
- />
- )
+ return
}