diff --git a/client/package-lock.json b/client/package-lock.json index 92179ec..539084e 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -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": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/react-datepicker/-/react-datepicker-2.6.0.tgz", diff --git a/client/package.json b/client/package.json index 2186d8b..b093d2f 100644 --- a/client/package.json +++ b/client/package.json @@ -25,6 +25,7 @@ "moment": "^2.24.0", "query-string": "^6.5.0", "react": "^16.8.6", + "react-collapsed": "^2.0.1", "react-datepicker": "^2.5.0", "react-dom": "^16.8.6", "react-dotdotdot": "^1.3.0", diff --git a/client/src/@types/react-collapsed/index.d.ts b/client/src/@types/react-collapsed/index.d.ts new file mode 100644 index 0000000..cde8d94 --- /dev/null +++ b/client/src/@types/react-collapsed/index.d.ts @@ -0,0 +1 @@ +declare module 'react-collapsed' diff --git a/client/src/components/molecules/VersionNumbers/VersionTable.module.scss b/client/src/components/molecules/VersionNumbers/VersionTable.module.scss index 348288e..bbdb0c3 100644 --- a/client/src/components/molecules/VersionNumbers/VersionTable.module.scss +++ b/client/src/components/molecules/VersionNumbers/VersionTable.module.scss @@ -10,6 +10,10 @@ display: table; border-top: 1px solid $brand-grey-lighter; + tr { + position: relative; + } + table { display: table; margin-left: $spacer; @@ -57,3 +61,16 @@ composes: spinner, small from '../../atoms/Spinner.module.scss'; 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; +} diff --git a/client/src/components/molecules/VersionNumbers/VersionTable.tsx b/client/src/components/molecules/VersionNumbers/VersionTable.tsx index 495c2e7..9124a37 100644 --- a/client/src/components/molecules/VersionNumbers/VersionTable.tsx +++ b/client/src/components/molecules/VersionNumbers/VersionTable.tsx @@ -1,8 +1,9 @@ -import React, { Fragment } from 'react' +import React, { Fragment, useState } from 'react' import { OceanPlatformTechStatus } from '@oceanprotocol/squid' +import slugify from '@sindresorhus/slugify' +import useCollapse from 'react-collapsed' import { VersionNumbersState } from '.' import styles from './VersionTable.module.scss' -import slugify from '@sindresorhus/slugify' const VersionTableContracts = ({ contracts, @@ -71,48 +72,78 @@ const VersionNumber = ({ {status || 'Could not get version'} ) -const VersionTable = ({ data }: { data: VersionNumbersState }) => ( -
- - - {Object.entries(data) - .filter(([key, value]) => key !== 'status') - .map(([key, value]) => ( - - - - - - {value.contracts && ( - - - +const VersionRow = ({ value }: { value: any }) => { + const collapseStyles = { + transitionDuration: '0.1s' + } + + const expandStyles = { + transitionDuration: '0.1s' + } + + const { getCollapseProps, getToggleProps, isOpen } = useCollapse({ + collapseStyles, + expandStyles + }) + + return ( + <> + + -
- - {value.name} - - - -
- -
+ {value.contracts && ( +
-
-) + + )} + + {value.name} + + + + + + + {value.contracts && ( + + + + + + )} + + ) +} + +const VersionTable = ({ data }: { data: VersionNumbersState }) => { + return ( +
+ + + {Object.entries(data) + .filter(([key, value]) => key !== 'status') + .map(([key, value]) => ( + + ))} + +
+
+ ) +} export default VersionTable diff --git a/client/src/components/molecules/VersionNumbers/index.tsx b/client/src/components/molecules/VersionNumbers/index.tsx index 1529f16..6f48074 100644 --- a/client/src/components/molecules/VersionNumbers/index.tsx +++ b/client/src/components/molecules/VersionNumbers/index.tsx @@ -120,20 +120,28 @@ export default class VersionNumbers extends PureComponent< } } - public render() { - const { minimal } = this.props + private MinimalOutput = () => { const { commons, squid, brizo, aquarius } = this.state - const mimimalOutput = `${squid.name} v${squid.version}\n${ - brizo.name - } v${brizo.version}\n${aquarius.name} v${aquarius.version}` - - return minimal ? ( + return (

- - v{commons.version} {brizo.network && `(${brizo.network})`} + + v{commons.version} {squid.network && `(${squid.network})`}

+ ) + } + + public render() { + const { minimal } = this.props + + return minimal ? ( + ) : (