fix: add empty table text
This commit is contained in:
parent
97ffb7bdf1
commit
00387e0862
7 changed files with 81 additions and 48 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { makeStyles } from '@material-ui/core/styles'
|
import { makeStyles, Box } from '@material-ui/core'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import * as R from 'ramda'
|
import * as R from 'ramda'
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
|
|
@ -17,6 +17,7 @@ import {
|
||||||
Td,
|
Td,
|
||||||
Th
|
Th
|
||||||
} from 'src/components/fake-table/Table'
|
} from 'src/components/fake-table/Table'
|
||||||
|
import { H4 } from 'src/components/typography'
|
||||||
import { ReactComponent as ExpandClosedIcon } from 'src/styling/icons/action/expand/closed.svg'
|
import { ReactComponent as ExpandClosedIcon } from 'src/styling/icons/action/expand/closed.svg'
|
||||||
import { ReactComponent as ExpandOpenIcon } from 'src/styling/icons/action/expand/open.svg'
|
import { ReactComponent as ExpandOpenIcon } from 'src/styling/icons/action/expand/open.svg'
|
||||||
|
|
||||||
|
|
@ -94,6 +95,8 @@ const DataTable = ({
|
||||||
expandable,
|
expandable,
|
||||||
shouldStartExpanded,
|
shouldStartExpanded,
|
||||||
onClick,
|
onClick,
|
||||||
|
loading,
|
||||||
|
emptyText,
|
||||||
...props
|
...props
|
||||||
}) => {
|
}) => {
|
||||||
const [expanded, setExpanded] = useState(null)
|
const [expanded, setExpanded] = useState(null)
|
||||||
|
|
@ -143,6 +146,7 @@ const DataTable = ({
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<Box display="flex" flex="1" flexDirection="column">
|
||||||
<Table className={classes.table}>
|
<Table className={classes.table}>
|
||||||
<THead>
|
<THead>
|
||||||
{elements.map(({ width, className, textAlign, header }, idx) => (
|
{elements.map(({ width, className, textAlign, header }, idx) => (
|
||||||
|
|
@ -157,6 +161,8 @@ const DataTable = ({
|
||||||
{expandable && <Th width={expWidth}></Th>}
|
{expandable && <Th width={expWidth}></Th>}
|
||||||
</THead>
|
</THead>
|
||||||
<TBody className={classes.body}>
|
<TBody className={classes.body}>
|
||||||
|
{loading && <H4>Loading...</H4>}
|
||||||
|
{!loading && R.isEmpty(data) && <H4>{emptyText}</H4>}
|
||||||
<AutoSizer disableWidth>
|
<AutoSizer disableWidth>
|
||||||
{({ height }) => (
|
{({ height }) => (
|
||||||
<List
|
<List
|
||||||
|
|
@ -175,6 +181,7 @@ const DataTable = ({
|
||||||
</AutoSizer>
|
</AutoSizer>
|
||||||
</TBody>
|
</TBody>
|
||||||
</Table>
|
</Table>
|
||||||
|
</Box>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ const CustomerProfile = memo(() => {
|
||||||
const history = useHistory()
|
const history = useHistory()
|
||||||
const { id: customerId } = useParams()
|
const { id: customerId } = useParams()
|
||||||
|
|
||||||
const { data: customerResponse, refetch: getCustomer } = useQuery(
|
const { data: customerResponse, refetch: getCustomer, loading } = useQuery(
|
||||||
GET_CUSTOMER,
|
GET_CUSTOMER,
|
||||||
{
|
{
|
||||||
variables: { customerId }
|
variables: { customerId }
|
||||||
|
|
@ -171,7 +171,7 @@ const CustomerProfile = memo(() => {
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</div>
|
</div>
|
||||||
<TransactionsList data={sortedTransactions} />
|
<TransactionsList data={sortedTransactions} loading={loading} />
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ const GET_CUSTOMERS = gql`
|
||||||
|
|
||||||
const Customers = () => {
|
const Customers = () => {
|
||||||
const history = useHistory()
|
const history = useHistory()
|
||||||
const { data: customersResponse } = useQuery(GET_CUSTOMERS)
|
const { data: customersResponse, loading } = useQuery(GET_CUSTOMERS)
|
||||||
|
|
||||||
const handleCustomerClicked = customer =>
|
const handleCustomerClicked = customer =>
|
||||||
history.push(`/compliance/customer/${customer.id}`)
|
history.push(`/compliance/customer/${customer.id}`)
|
||||||
|
|
@ -33,7 +33,13 @@ const Customers = () => {
|
||||||
R.path(['customers'])(customersResponse) ?? []
|
R.path(['customers'])(customersResponse) ?? []
|
||||||
)
|
)
|
||||||
|
|
||||||
return <CustomersList data={customersData} onClick={handleCustomerClicked} />
|
return (
|
||||||
|
<CustomersList
|
||||||
|
data={customersData}
|
||||||
|
onClick={handleCustomerClicked}
|
||||||
|
loading={loading}
|
||||||
|
/>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Customers
|
export default Customers
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import styles from './CustomersList.styles'
|
||||||
|
|
||||||
const useStyles = makeStyles(styles)
|
const useStyles = makeStyles(styles)
|
||||||
|
|
||||||
const CustomersList = ({ data, onClick }) => {
|
const CustomersList = ({ data, onClick, loading }) => {
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
|
|
||||||
const elements = [
|
const elements = [
|
||||||
|
|
@ -75,7 +75,13 @@ const CustomersList = ({ data, onClick }) => {
|
||||||
{ label: 'Cash-out', icon: <TxOutIcon /> }
|
{ label: 'Cash-out', icon: <TxOutIcon /> }
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<DataTable elements={elements} data={data} onClick={onClick} />
|
<DataTable
|
||||||
|
loading={loading}
|
||||||
|
emptyText="No customers so far"
|
||||||
|
elements={elements}
|
||||||
|
data={data}
|
||||||
|
onClick={onClick}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import mainStyles from '../CustomersList.styles'
|
||||||
|
|
||||||
const useStyles = makeStyles(mainStyles)
|
const useStyles = makeStyles(mainStyles)
|
||||||
|
|
||||||
const TransactionsList = ({ data }) => {
|
const TransactionsList = ({ data, loading }) => {
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
const hasData = !(R.isEmpty(data) || R.isNil(data))
|
const hasData = !(R.isEmpty(data) || R.isNil(data))
|
||||||
|
|
||||||
|
|
@ -82,7 +82,9 @@ const TransactionsList = ({ data }) => {
|
||||||
<div className={classes.titleWrapper}>
|
<div className={classes.titleWrapper}>
|
||||||
<div className={classes.titleAndButtonsContainer}>
|
<div className={classes.titleAndButtonsContainer}>
|
||||||
<H4>
|
<H4>
|
||||||
{hasData
|
{loading
|
||||||
|
? 'Loading'
|
||||||
|
: hasData
|
||||||
? 'All transactions from this customer'
|
? 'All transactions from this customer'
|
||||||
: 'No transactions so far'}
|
: 'No transactions so far'}
|
||||||
</H4>
|
</H4>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { useQuery } from '@apollo/react-hooks'
|
import { useQuery } from '@apollo/react-hooks'
|
||||||
import { makeStyles } from '@material-ui/core/styles'
|
import { makeStyles } from '@material-ui/core'
|
||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
|
|
@ -54,7 +54,7 @@ const GET_TRANSACTIONS = gql`
|
||||||
const Transactions = () => {
|
const Transactions = () => {
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
|
|
||||||
const { data: txResponse } = useQuery(GET_TRANSACTIONS, {
|
const { data: txResponse, loading } = useQuery(GET_TRANSACTIONS, {
|
||||||
variables: {
|
variables: {
|
||||||
limit: NUM_LOG_RESULTS
|
limit: NUM_LOG_RESULTS
|
||||||
}
|
}
|
||||||
|
|
@ -160,6 +160,8 @@ const Transactions = () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<DataTable
|
<DataTable
|
||||||
|
loading={loading}
|
||||||
|
emptyText="No transactions so far"
|
||||||
elements={elements}
|
elements={elements}
|
||||||
data={R.path(['transactions'])(txResponse)}
|
data={R.path(['transactions'])(txResponse)}
|
||||||
Details={DetailsRow}
|
Details={DetailsRow}
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,11 @@ import React, { useState } from 'react'
|
||||||
import { v4 } from 'uuid'
|
import { v4 } from 'uuid'
|
||||||
|
|
||||||
import Tooltip from 'src/components/Tooltip'
|
import Tooltip from 'src/components/Tooltip'
|
||||||
import { Link } from 'src/components/buttons'
|
import { Link, Button } from 'src/components/buttons'
|
||||||
import { Table as EditableTable } from 'src/components/editableTable'
|
import { Table as EditableTable } from 'src/components/editableTable'
|
||||||
import { Switch } from 'src/components/inputs'
|
import { Switch } from 'src/components/inputs'
|
||||||
import TitleSection from 'src/components/layout/TitleSection'
|
import TitleSection from 'src/components/layout/TitleSection'
|
||||||
import { P, Label2 } from 'src/components/typography'
|
import { P, Label2, H2 } from 'src/components/typography'
|
||||||
import { fromNamespace, toNamespace, namespaces } from 'src/utils/config'
|
import { fromNamespace, toNamespace, namespaces } from 'src/utils/config'
|
||||||
|
|
||||||
import styles from './Triggers.styles'
|
import styles from './Triggers.styles'
|
||||||
|
|
@ -36,7 +36,7 @@ const Triggers = () => {
|
||||||
const [wizard, setWizard] = useState(false)
|
const [wizard, setWizard] = useState(false)
|
||||||
const [error, setError] = useState(false)
|
const [error, setError] = useState(false)
|
||||||
|
|
||||||
const { data } = useQuery(GET_INFO)
|
const { data, loading } = useQuery(GET_INFO)
|
||||||
const triggers = fromServer(data?.config?.triggers ?? [])
|
const triggers = fromServer(data?.config?.triggers ?? [])
|
||||||
|
|
||||||
const complianceConfig =
|
const complianceConfig =
|
||||||
|
|
@ -108,9 +108,11 @@ const Triggers = () => {
|
||||||
className={classes.tableWidth}
|
className={classes.tableWidth}
|
||||||
display="flex"
|
display="flex"
|
||||||
justifyContent="end">
|
justifyContent="end">
|
||||||
|
{!loading && !R.isEmpty(triggers) && (
|
||||||
<Link color="primary" onClick={() => setWizard(true)}>
|
<Link color="primary" onClick={() => setWizard(true)}>
|
||||||
+ Add new trigger
|
+ Add new trigger
|
||||||
</Link>
|
</Link>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
<EditableTable
|
<EditableTable
|
||||||
data={triggers}
|
data={triggers}
|
||||||
|
|
@ -131,6 +133,14 @@ const Triggers = () => {
|
||||||
onClose={() => setWizard(null)}
|
onClose={() => setWizard(null)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{!loading && R.isEmpty(triggers) && (
|
||||||
|
<Box display="flex" alignItems="center" flexDirection="column" mt={15}>
|
||||||
|
<H2>
|
||||||
|
It seems there are no active compliance triggers on your network
|
||||||
|
</H2>
|
||||||
|
<Button onClick={() => setWizard(true)}>Add first trigger</Button>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue