1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-06-28 00:27:49 +02:00
market/src/components/organisms/AssetActionHistoryTable.tsx
Norbi c5eaaf8d45
Show compute jobs history in asset detail page (#735)
* displayed compute jobs on asset detail page

* filter compute jobs by datatoken address

* lint error fix

* changed query name for selecting compute orders by datatoken

* renamed Transactions component and moved it outside Pool directory

* style compose path fix

* query just one subgraph based on ddo chainId

* fixed displayed columns, added Finished column, table scroll fix

* changed AssetActionsHistoryTable titles

* made tabel cell width smaller
2021-08-04 15:26:03 +03:00

37 lines
982 B
TypeScript

import React, { ReactElement, useState } from 'react'
import Button from '../atoms/Button'
import styles from './AssetActionHistoryTable.module.css'
import { ReactComponent as Caret } from '../../images/caret.svg'
import { ReactNode } from 'react-markdown'
export default function AssetActionHistoryTable({
title,
children
}: {
title: string
children: ReactNode
}): ReactElement {
const [open, setOpen] = useState(false)
function handleClick() {
setOpen(!open)
}
return (
<div className={`${styles.actions} ${open === true ? styles.open : ''}`}>
{/* TODO: onClick on h3 is nasty but we're in a hurry */}
<h3 className={styles.title} onClick={handleClick}>
{`${title} `}
<Button
style="text"
size="small"
onClick={handleClick}
className={styles.toggle}
>
{open ? 'Hide' : 'Show'} <Caret />
</Button>
</h3>
{open === true && children}
</div>
)
}