Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #179 from gnosis/74-safe-list-sidebar
Browse files Browse the repository at this point in the history
Feature #74: Safe list sidebar
  • Loading branch information
mmv08 authored Sep 24, 2019
2 parents ddbc643 + 16703e9 commit baae350
Show file tree
Hide file tree
Showing 56 changed files with 1,362 additions and 1,007 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
],
"react/require-default-props": 0,
"react/no-array-index-key": 0,
"react/jsx-props-no-spreading": 0
"react/jsx-props-no-spreading": 0,
"react/state-in-constructor": 0
},
"env": {
"jest/globals": true,
Expand Down
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@
],
"dependencies": {
"@gnosis.pm/safe-contracts": "^1.0.0",
"@gnosis.pm/util-contracts": "2.0.1",
"@material-ui/core": "4.4.2",
"@material-ui/icons": "4.4.1",
"@gnosis.pm/util-contracts": "2.0.4",
"@material-ui/core": "4.4.3",
"@material-ui/icons": "4.4.3",
"@testing-library/jest-dom": "4.1.0",
"@welldone-software/why-did-you-render": "3.3.3",
"@welldone-software/why-did-you-render": "3.3.5",
"axios": "0.19.0",
"bignumber.js": "9.0.0",
"connected-react-router": "6.5.2",
"date-fns": "2.1.0",
"date-fns": "2.2.1",
"ethereum-ens": "0.7.8",
"final-form": "4.18.5",
"history": "4.10.0",
"history": "4.10.1",
"immortal-db": "^1.0.2",
"immutable": "^4.0.0-rc.9",
"material-ui-search-bar": "^1.0.0-beta.13",
Expand All @@ -51,7 +51,7 @@
"react-dom": "16.9.0",
"react-final-form": "6.3.0",
"react-final-form-listeners": "^1.0.2",
"react-hot-loader": "4.12.13",
"react-hot-loader": "4.12.14",
"react-infinite-scroll-component": "4.5.3",
"react-qr-reader": "^2.2.1",
"react-redux": "7.1.1",
Expand Down Expand Up @@ -89,10 +89,10 @@
"@babel/preset-flow": "^7.0.0-beta.40",
"@babel/preset-react": "^7.0.0-beta.40",
"@sambego/storybook-state": "^1.0.7",
"@storybook/addon-actions": "5.1.11",
"@storybook/addon-knobs": "5.1.11",
"@storybook/addon-links": "5.1.11",
"@storybook/react": "5.1.11",
"@storybook/addon-actions": "5.2.1",
"@storybook/addon-knobs": "5.2.1",
"@storybook/addon-links": "5.2.1",
"@storybook/react": "5.2.1",
"@testing-library/react": "9.1.4",
"autoprefixer": "9.6.1",
"babel-core": "^7.0.0-bridge.0",
Expand All @@ -115,7 +115,7 @@
"ethereumjs-abi": "0.6.8",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"file-loader": "4.2.0",
"flow-bin": "0.107.0",
"flow-bin": "0.108.0",
"fs-extra": "8.1.0",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.0.4",
Expand All @@ -132,15 +132,15 @@
"storybook-host": "5.1.0",
"storybook-router": "^0.3.3",
"style-loader": "1.0.0",
"truffle": "5.0.35",
"truffle": "5.0.37",
"truffle-contract": "4.0.31",
"truffle-solidity-loader": "0.1.32",
"uglifyjs-webpack-plugin": "2.2.0",
"url-loader": "^2.1.0",
"webpack": "4.39.3",
"webpack-bundle-analyzer": "3.4.1",
"webpack-cli": "3.3.8",
"webpack-dev-server": "3.8.0",
"webpack": "4.40.2",
"webpack-bundle-analyzer": "3.5.1",
"webpack-cli": "3.3.9",
"webpack-dev-server": "3.8.1",
"webpack-manifest-plugin": "^2.0.0-rc.2"
}
}
1 change: 1 addition & 0 deletions scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require('dotenv').config({ silent: true })
const jest = require('jest')

const argv = process.argv.slice(2)
argv.push('--runInBand')

// Watch unless on CI or in coverage mode
if (!process.env.CI && argv.indexOf('--coverage') < 0) {
Expand Down
20 changes: 0 additions & 20 deletions src/components/Footer/index.jsx

This file was deleted.

24 changes: 0 additions & 24 deletions src/components/Footer/index.scss

This file was deleted.

16 changes: 0 additions & 16 deletions src/components/Footer/index.stories.js

This file was deleted.

13 changes: 10 additions & 3 deletions src/components/Header/component/Layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ import Col from '~/components/layout/Col'
import Img from '~/components/layout/Img'
import Row from '~/components/layout/Row'
import Spacer from '~/components/Spacer'
import { border, sm, md } from '~/theme/variables'
import {
border, sm, md, headerHeight,
} from '~/theme/variables'
import Provider from './Provider'
import SafeListHeader from './SafeListHeader'

const logo = require('../assets/gnosis-safe-logo.svg')

Expand All @@ -32,10 +35,12 @@ const styles = () => ({
left: '4px',
},
summary: {
borderBottom: `solid 1px ${border}`,
borderBottom: `solid 2px ${border}`,
alignItems: 'center',
height: '53px',
height: headerHeight,
boxShadow: '0 2px 4px 0 rgba(212, 212, 211, 0.59)',
backgroundColor: 'white',
zIndex: 1301,
},
logo: {
padding: `${sm} ${md}`,
Expand All @@ -55,6 +60,8 @@ const Layout = openHoc(({
</Link>
</Col>
<Divider />
<SafeListHeader />
<Divider />
<Spacer />
<Divider />
<Provider open={open} toggle={toggle} info={providerInfo}>
Expand Down
68 changes: 68 additions & 0 deletions src/components/Header/component/SafeListHeader/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// @flow
import * as React from 'react'
import { connect } from 'react-redux'
import { makeStyles } from '@material-ui/core/styles'
import IconButton from '@material-ui/core/IconButton'
import ExpandMoreIcon from '@material-ui/icons/ExpandMore'
import ExpandLessIcon from '@material-ui/icons/ExpandLess'
import Paragraph from '~/components/layout/Paragraph'
import Col from '~/components/layout/Col'
import {
xs, sm, md, border,
} from '~/theme/variables'
import { safesCountSelector } from '~/routes/safe/store/selectors'
import { SidebarContext } from '~/components/Sidebar'

export const TOGGLE_SIDEBAR_BTN_TESTID = 'TOGGLE_SIDEBAR_BTN'

const useStyles = makeStyles({
container: {
flexGrow: 0,
padding: `0 ${md}`,
},
counter: {
background: border,
padding: xs,
borderRadius: '3px',
marginLeft: sm,
lineHeight: 'normal',
},
icon: {
marginLeft: sm,
},
})

type Props = {
safesCount: number,
}

const { useContext } = React

const SafeListHeader = ({ safesCount }: Props) => {
const classes = useStyles()
const { toggleSidebar, isOpen } = useContext(SidebarContext)

return (
<Col start="xs" middle="xs" className={classes.container}>
Safes
{' '}
<Paragraph size="xs" className={classes.counter}>
{safesCount}
</Paragraph>
<IconButton
onClick={toggleSidebar}
className={classes.icon}
aria-label="Expand Safe List"
data-testid={TOGGLE_SIDEBAR_BTN_TESTID}
>
{isOpen ? <ExpandLessIcon /> : <ExpandMoreIcon color="secondary" />}
</IconButton>
</Col>
)
}

export default connect<Object, Object, ?Function, ?Object>(
// $FlowFixMe
(state) => ({ safesCount: safesCountSelector(state) }),
null,
)(SafeListHeader)
36 changes: 36 additions & 0 deletions src/components/Sidebar/SafeList/DefaultBadge.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// @flow
import * as React from 'react'
import { makeStyles } from '@material-ui/core/styles'
import Img from '~/components/layout/Img'
import Block from '~/components/layout/Block'
import Paragraph from '~/components/layout/Paragraph'
import { primary, sm } from '~/theme/variables'
import StarIcon from './assets/star.svg'

const useStyles = makeStyles({
container: {
background: primary,
padding: '5px',
boxSizing: 'border-box',
width: '73px',
justifyContent: 'space-around',
marginLeft: sm,
color: '#fff',
borderRadius: '3px',
},
})

const DefaultBadge = () => {
const classes = useStyles()

return (
<Block align="left" className={classes.container}>
<Img src={StarIcon} alt="Star Icon" />
<Paragraph noMargin size="xs">
default
</Paragraph>
</Block>
)
}

export default DefaultBadge
3 changes: 3 additions & 0 deletions src/components/Sidebar/SafeList/assets/star.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit baae350

Please sign in to comment.