mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
collapse contracts by default
This commit is contained in:
parent
15ebb34931
commit
838757f5e8
9
client/package-lock.json
generated
9
client/package-lock.json
generated
@ -12982,6 +12982,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"react-collapsed": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-collapsed/-/react-collapsed-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-ullymRST/C5iy0szhxpYmIaLUhi+IC8EpFySmUjttoc+ErotaKAx+z1ff0d2PCJF7ksW8crTiOrIwGtFqYw3Tg==",
|
||||||
|
"requires": {
|
||||||
|
"@babel/runtime": "^7.3.1",
|
||||||
|
"raf": "^3.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"react-datepicker": {
|
"react-datepicker": {
|
||||||
"version": "2.6.0",
|
"version": "2.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-datepicker/-/react-datepicker-2.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-datepicker/-/react-datepicker-2.6.0.tgz",
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
"moment": "^2.24.0",
|
"moment": "^2.24.0",
|
||||||
"query-string": "^6.5.0",
|
"query-string": "^6.5.0",
|
||||||
"react": "^16.8.6",
|
"react": "^16.8.6",
|
||||||
|
"react-collapsed": "^2.0.1",
|
||||||
"react-datepicker": "^2.5.0",
|
"react-datepicker": "^2.5.0",
|
||||||
"react-dom": "^16.8.6",
|
"react-dom": "^16.8.6",
|
||||||
"react-dotdotdot": "^1.3.0",
|
"react-dotdotdot": "^1.3.0",
|
||||||
|
1
client/src/@types/react-collapsed/index.d.ts
vendored
Normal file
1
client/src/@types/react-collapsed/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
declare module 'react-collapsed'
|
@ -10,6 +10,10 @@
|
|||||||
display: table;
|
display: table;
|
||||||
border-top: 1px solid $brand-grey-lighter;
|
border-top: 1px solid $brand-grey-lighter;
|
||||||
|
|
||||||
|
tr {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
table {
|
table {
|
||||||
display: table;
|
display: table;
|
||||||
margin-left: $spacer;
|
margin-left: $spacer;
|
||||||
@ -57,3 +61,16 @@
|
|||||||
composes: spinner, small from '../../atoms/Spinner.module.scss';
|
composes: spinner, small from '../../atoms/Spinner.module.scss';
|
||||||
margin-right: $spacer;
|
margin-right: $spacer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.handle {
|
||||||
|
display: inline-block;
|
||||||
|
border: 0;
|
||||||
|
background: none;
|
||||||
|
box-shadow: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
margin-left: -1rem;
|
||||||
|
padding-right: .5rem;
|
||||||
|
cursor: pointer;
|
||||||
|
color: $brand-grey-light;
|
||||||
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import React, { Fragment } from 'react'
|
import React, { Fragment, useState } from 'react'
|
||||||
import { OceanPlatformTechStatus } from '@oceanprotocol/squid'
|
import { OceanPlatformTechStatus } from '@oceanprotocol/squid'
|
||||||
|
import slugify from '@sindresorhus/slugify'
|
||||||
|
import useCollapse from 'react-collapsed'
|
||||||
import { VersionNumbersState } from '.'
|
import { VersionNumbersState } from '.'
|
||||||
import styles from './VersionTable.module.scss'
|
import styles from './VersionTable.module.scss'
|
||||||
import slugify from '@sindresorhus/slugify'
|
|
||||||
|
|
||||||
const VersionTableContracts = ({
|
const VersionTableContracts = ({
|
||||||
contracts,
|
contracts,
|
||||||
@ -71,16 +72,33 @@ const VersionNumber = ({
|
|||||||
<span>{status || 'Could not get version'}</span>
|
<span>{status || 'Could not get version'}</span>
|
||||||
)
|
)
|
||||||
|
|
||||||
const VersionTable = ({ data }: { data: VersionNumbersState }) => (
|
const VersionRow = ({ value }: { value: any }) => {
|
||||||
<div className={styles.tableWrap}>
|
const collapseStyles = {
|
||||||
<table className={styles.table}>
|
transitionDuration: '0.1s'
|
||||||
<tbody>
|
}
|
||||||
{Object.entries(data)
|
|
||||||
.filter(([key, value]) => key !== 'status')
|
const expandStyles = {
|
||||||
.map(([key, value]) => (
|
transitionDuration: '0.1s'
|
||||||
<Fragment key={key}>
|
}
|
||||||
|
|
||||||
|
const { getCollapseProps, getToggleProps, isOpen } = useCollapse({
|
||||||
|
collapseStyles,
|
||||||
|
expandStyles
|
||||||
|
})
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
{value.contracts && (
|
||||||
|
<button className={styles.handle} {...getToggleProps()}>
|
||||||
|
{isOpen ? (
|
||||||
|
<span>▼</span>
|
||||||
|
) : (
|
||||||
|
<span>►</span>
|
||||||
|
)}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
<a
|
<a
|
||||||
href={`https://github.com/oceanprotocol/${slugify(
|
href={`https://github.com/oceanprotocol/${slugify(
|
||||||
value.name || value.software
|
value.name || value.software
|
||||||
@ -99,7 +117,7 @@ const VersionTable = ({ data }: { data: VersionNumbersState }) => (
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{value.contracts && (
|
{value.contracts && (
|
||||||
<tr>
|
<tr {...getCollapseProps()}>
|
||||||
<td colSpan={2}>
|
<td colSpan={2}>
|
||||||
<VersionTableContracts
|
<VersionTableContracts
|
||||||
contracts={value.contracts}
|
contracts={value.contracts}
|
||||||
@ -108,11 +126,24 @@ const VersionTable = ({ data }: { data: VersionNumbersState }) => (
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
)}
|
)}
|
||||||
</Fragment>
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const VersionTable = ({ data }: { data: VersionNumbersState }) => {
|
||||||
|
return (
|
||||||
|
<div className={styles.tableWrap}>
|
||||||
|
<table className={styles.table}>
|
||||||
|
<tbody>
|
||||||
|
{Object.entries(data)
|
||||||
|
.filter(([key, value]) => key !== 'status')
|
||||||
|
.map(([key, value]) => (
|
||||||
|
<VersionRow key={key} value={value} />
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
export default VersionTable
|
export default VersionTable
|
||||||
|
@ -120,20 +120,28 @@ export default class VersionNumbers extends PureComponent<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public render() {
|
private MinimalOutput = () => {
|
||||||
const { minimal } = this.props
|
|
||||||
const { commons, squid, brizo, aquarius } = this.state
|
const { commons, squid, brizo, aquarius } = this.state
|
||||||
|
|
||||||
const mimimalOutput = `${squid.name} v${squid.version}\n${
|
return (
|
||||||
brizo.name
|
|
||||||
} v${brizo.version}\n${aquarius.name} v${aquarius.version}`
|
|
||||||
|
|
||||||
return minimal ? (
|
|
||||||
<p className={styles.versionsMinimal}>
|
<p className={styles.versionsMinimal}>
|
||||||
<a title={mimimalOutput} href={'/about'}>
|
<a
|
||||||
v{commons.version} {brizo.network && `(${brizo.network})`}
|
title={`${squid.name} v${squid.version}\n${brizo.name} v${
|
||||||
|
brizo.version
|
||||||
|
}\n${aquarius.name} v${aquarius.version}`}
|
||||||
|
href={'/about'}
|
||||||
|
>
|
||||||
|
v{commons.version} {squid.network && `(${squid.network})`}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public render() {
|
||||||
|
const { minimal } = this.props
|
||||||
|
|
||||||
|
return minimal ? (
|
||||||
|
<this.MinimalOutput />
|
||||||
) : (
|
) : (
|
||||||
<div className={styles.versions} id="#oceanversions">
|
<div className={styles.versions} id="#oceanversions">
|
||||||
<h2 className={styles.versionsTitle}>
|
<h2 className={styles.versionsTitle}>
|
||||||
|
Loading…
Reference in New Issue
Block a user