From d58954aa6f4261f7385295998292bfd706f5387f Mon Sep 17 00:00:00 2001 From: Agustin Pane Date: Tue, 17 Dec 2019 10:43:23 -0300 Subject: [PATCH] Feature #190: Sidebar improvements (#347) * Change icons Adds checked icon * Adds safeParamAddressFromStateSelector for get current safe selected Implements check icon on sidebar * Remove overflow on sidebar Start alignments * Removes headerPlaceholder * Improves header * Improves header * Fix header style --- src/assets/icons/check.svg | 3 +++ src/assets/icons/shape.svg | 3 +++ .../components/SafeListHeader/index.jsx | 1 - .../Sidebar/SafeList/DefaultBadge.jsx | 19 +++++++------ src/components/Sidebar/SafeList/index.jsx | 27 ++++++++++++++----- src/components/Sidebar/index.jsx | 13 +++++---- src/components/Sidebar/style.js | 13 ++++++++- src/routes/safe/store/selectors/index.js | 9 +++++++ src/theme/variables.js | 2 ++ 9 files changed, 69 insertions(+), 21 deletions(-) create mode 100644 src/assets/icons/check.svg create mode 100644 src/assets/icons/shape.svg diff --git a/src/assets/icons/check.svg b/src/assets/icons/check.svg new file mode 100644 index 00000000..e6440050 --- /dev/null +++ b/src/assets/icons/check.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icons/shape.svg b/src/assets/icons/shape.svg new file mode 100644 index 00000000..318ccaba --- /dev/null +++ b/src/assets/icons/shape.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/components/Header/components/SafeListHeader/index.jsx b/src/components/Header/components/SafeListHeader/index.jsx index dafbf3da..46116b2b 100644 --- a/src/components/Header/components/SafeListHeader/index.jsx +++ b/src/components/Header/components/SafeListHeader/index.jsx @@ -45,7 +45,6 @@ const SafeListHeader = ({ safesCount }: Props) => { return ( Safes - {' '} {safesCount} diff --git a/src/components/Sidebar/SafeList/DefaultBadge.jsx b/src/components/Sidebar/SafeList/DefaultBadge.jsx index a0c441a5..76e31cb2 100644 --- a/src/components/Sidebar/SafeList/DefaultBadge.jsx +++ b/src/components/Sidebar/SafeList/DefaultBadge.jsx @@ -4,20 +4,23 @@ 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' +import { primary, secondaryBackground, md } from '~/theme/variables' +import HomeIcon from '~/assets/icons/shape.svg' const useStyles = makeStyles({ container: { - background: primary, + background: secondaryBackground, padding: '5px', boxSizing: 'border-box', - width: '73px', + width: '76px', justifyContent: 'space-around', - marginLeft: sm, + marginLeft: md, color: '#fff', borderRadius: '3px', }, + defaultText: { + color: primary, + }, }) const DefaultBadge = () => { @@ -25,9 +28,9 @@ const DefaultBadge = () => { return ( - Star Icon - - default + Home Icon + + Default ) diff --git a/src/components/Sidebar/SafeList/index.jsx b/src/components/Sidebar/SafeList/index.jsx index 6f0dabd7..7fa92edf 100644 --- a/src/components/Sidebar/SafeList/index.jsx +++ b/src/components/Sidebar/SafeList/index.jsx @@ -12,18 +12,21 @@ import Paragraph from '~/components/layout/Paragraph' import ButtonLink from '~/components/layout/ButtonLink' import Identicon from '~/components/Identicon' import { - mediumFontSize, sm, secondary, primary, + mediumFontSize, sm, primary, disabled, md, } from '~/theme/variables' import { formatAmount } from '~/logic/tokens/utils/formatAmount' import { shortVersionOf, sameAddress } from '~/logic/wallets/ethAddresses' import { type Safe } from '~/routes/safe/store/models/safe' import { SAFELIST_ADDRESS } from '~/routes/routes' import DefaultBadge from './DefaultBadge' +import Img from '~/components/layout/Img' +import check from '~/assets/icons/check.svg' export const SIDEBAR_SAFELIST_ROW_TESTID = 'SIDEBAR_SAFELIST_ROW_TESTID' type SafeListProps = { safes: List, + currentSafe: string, onSafeClick: Function, setDefaultSafe: Function, defaultSafe: string, @@ -33,9 +36,12 @@ const useStyles = makeStyles({ icon: { marginRight: sm, }, + checkIcon: { + marginRight: '10px', + }, list: { overflow: 'hidden', - overflowY: 'scroll', + overflowY: 'hidden', padding: 0, height: '100%', }, @@ -50,21 +56,25 @@ const useStyles = makeStyles({ }, }, safeName: { - color: secondary, + color: primary, }, safeAddress: { - color: primary, + color: disabled, fontSize: mediumFontSize, }, makeDefaultBtn: { padding: 0, - marginLeft: sm, + marginLeft: md, visibility: 'hidden', }, + noIcon: { + visibility: 'hidden', + width: '28px', + }, }) const SafeList = ({ - safes, onSafeClick, setDefaultSafe, defaultSafe, + safes, onSafeClick, setDefaultSafe, defaultSafe, currentSafe, }: SafeListProps) => { const classes = useStyles() @@ -78,6 +88,11 @@ const SafeList = ({ data-testid={SIDEBAR_SAFELIST_ROW_TESTID} > + { sameAddress(currentSafe, safe.address) ? ( + + check + + ) :
placeholder
} diff --git a/src/components/Sidebar/index.jsx b/src/components/Sidebar/index.jsx index 0ecfe17d..9ae7d2a2 100644 --- a/src/components/Sidebar/index.jsx +++ b/src/components/Sidebar/index.jsx @@ -14,7 +14,10 @@ import Hairline from '~/components/layout/Hairline' import Row from '~/components/layout/Row' import { WELCOME_ADDRESS } from '~/routes/routes' import { type Safe } from '~/routes/safe/store/models/safe' -import { defaultSafeSelector } from '~/routes/safe/store/selectors' +import { + defaultSafeSelector, + safeParamAddressFromStateSelector, +} from '~/routes/safe/store/selectors' import setDefaultSafe from '~/routes/safe/store/actions/setDefaultSafe' import { sortedSafeListSelector } from './selectors' import SafeList from './SafeList' @@ -39,6 +42,7 @@ type SidebarProps = { safes: List, setDefaultSafeAction: Function, defaultSafe: string, + currentSafe: string, } const filterBy = (filter: string, safes: List): List => safes.filter( @@ -48,7 +52,7 @@ const filterBy = (filter: string, safes: List): List => safes.filter ) const Sidebar = ({ - children, safes, setDefaultSafeAction, defaultSafe, + children, safes, setDefaultSafeAction, defaultSafe, currentSafe, }: SidebarProps) => { const [isOpen, setIsOpen] = useState(false) const [filter, setFilter] = useState('') @@ -97,7 +101,6 @@ const Sidebar = ({ classes={{ paper: classes.sidebarPaper }} ModalProps={{ onBackdropClick: toggleSidebar }} > -
-