Skip to content

Commit

Permalink
simplify MobileNav
Browse files Browse the repository at this point in the history
  • Loading branch information
levity committed Jun 28, 2019
1 parent 8433b43 commit 373e4a1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
21 changes: 8 additions & 13 deletions src/components/MobileNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import {
import useStore from 'hooks/useStore';

import RatioDisplay from './RatioDisplay';
import Sidebar from 'components/SidebarBase';
import { getCdp, getCollateralizationRatio } from 'reducers/cdps';
import { ReactComponent as MakerLogo } from 'images/maker-logo.svg';
import SidebarGlobal from './Sidebars/Global';
import AccountBox from './AccountBox';

import {
Dropdown,
Expand Down Expand Up @@ -131,11 +132,7 @@ const DrawerBg = styled.div`
`}
`;

const SidebarDrawer = ({
sidebarDrawerOpen,
setSidebarDrawerOpen,
children
}) => {
const SidebarDrawer = ({ sidebarDrawerOpen, children }) => {
return (
<DrawerBg sidebarDrawerOpen={sidebarDrawerOpen}>
<Box
Expand All @@ -150,7 +147,7 @@ const SidebarDrawer = ({
</DrawerBg>
);
};
const MobileNav = ({ networkId, viewedAddress, cdpId }) => {
const MobileNav = ({ viewedAddress, cdpId }) => {
const ref = useRef();
const [sidebarDrawerOpen, setSidebarDrawerOpen] = useState(false);
const { account } = useMaker();
Expand Down Expand Up @@ -214,12 +211,10 @@ const MobileNav = ({ networkId, viewedAddress, cdpId }) => {
<div ref={ref}>
<SidebarDrawer {...{ sidebarDrawerOpen, setSidebarDrawerOpen }}>
<Box mr="s">
<Sidebar
{...{
networkId,
connectedAddress: account ? account.address : null
}}
/>
<Box my="s">
<AccountBox currentAccount={account} />
</Box>
<SidebarGlobal />
</Box>
</SidebarDrawer>
</div>
Expand Down
2 changes: 0 additions & 2 deletions src/reducers/feeds.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import produce from 'immer';
import ilkList from 'references/ilkList';
import uniqBy from 'lodash/uniqBy';
import round from 'lodash/round';
import { multiply } from 'utils/bignumber';
import BigNumber from 'bignumber.js';
import { fromWei, fromRay, fromRad, sub, mul, RAY } from 'utils/units';

Expand Down
8 changes: 1 addition & 7 deletions src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import MakerProvider from 'providers/MakerProvider';

import config from 'references/config';
import MobileNav from 'components/MobileNav';
import { networkNameToId } from 'utils/network';
import { userSnapInit } from 'utils/analytics';
import useMaker from 'hooks/useMaker';
import useStore from 'hooks/useStore';
Expand All @@ -30,7 +29,6 @@ const withDefaultLayout = route =>
const { network, testchainId, backendEnv } = request.query;
const { viewedAddress, cdpId } = request.params;

const networkId = networkNameToId(network);
return (
<MakerProvider
network={network}
Expand All @@ -43,11 +41,7 @@ const withDefaultLayout = route =>
<SidebarProvider sidebars={sidebars}>
<PageLayout
mobileNav={
<MobileNav
networkId={networkId}
viewedAddress={viewedAddress}
cdpId={cdpId}
/>
<MobileNav viewedAddress={viewedAddress} cdpId={cdpId} />
}
navbar={<Navbar viewedAddress={viewedAddress} />}
>
Expand Down

0 comments on commit 373e4a1

Please sign in to comment.