Skip to content

Commit

Permalink
Merge pull request #23 from Propy/dev
Browse files Browse the repository at this point in the history
dev -> main
  • Loading branch information
JayWelsh authored Oct 31, 2023
2 parents 6b1e6e6 + b2dc14f commit 9e8f2f1
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import '../styles/App.scss';
import { PropsFromRedux } from '../containers/AppContainer';

import BlockNumberIndicator from './BlockNumberIndicator';
import PageContainer from './PageContainer';
import PageContainerContainer from '../containers/PageContainerContainer';

import { useWindowSize } from '../hooks';

Expand Down Expand Up @@ -114,7 +114,7 @@ const App = (props: PropsFromRedux) => {
<ThemeProvider theme={theme}>
<CssBaseline/>
<Toaster richColors position="bottom-right" />
<PageContainer/>
<PageContainerContainer/>
<BlockNumberIndicator/>
</ThemeProvider>
</StyledEngineProvider>
Expand Down
7 changes: 6 additions & 1 deletion src/components/DappProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { ChainId, DAppProvider } from '@usedapp/core'
import { ChainId, DAppProvider, MetamaskConnector, CoinbaseWalletConnector } from '@usedapp/core'

import DappReactiveConfigContainer from '../containers/DappReactiveConfigContainer';

Expand Down Expand Up @@ -43,6 +43,11 @@ const DappProvider = (props: PropsFromRedux) => {
[ChainId.Arbitrum]: arbitrumReadOnlyUrl(),
},
autoConnect: true,
// noMetamaskDeactivate: true,
connectors: {
metamask: new MetamaskConnector(),
coinbase: new CoinbaseWalletConnector(),
},
}

return (
Expand Down
7 changes: 6 additions & 1 deletion src/components/DappReactiveConfig.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect } from 'react';
import { ChainId, useEthers, useUpdateConfig } from '@usedapp/core'
import { ChainId, useEthers, useUpdateConfig, MetamaskConnector, CoinbaseWalletConnector } from '@usedapp/core'

import AppContainer from '../containers/AppContainer';

Expand Down Expand Up @@ -69,6 +69,11 @@ const DappReactiveConfig = (props: PropsFromRedux) => {
[ChainId.Arbitrum]: arbitrumReadOnlyUrl(),
},
autoConnect: true,
// noMetamaskDeactivate: true,
connectors: {
metamask: new MetamaskConnector(),
coinbase: new CoinbaseWalletConnector(),
},
});
} else {
handleConnectedAccountNetworkSwitch(activeNetwork);
Expand Down
13 changes: 11 additions & 2 deletions src/components/PageContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,24 @@ import CollectionsPage from '../pages/CollectionsPage';

import useWindowSize from '../hooks/useWindowSize';

import { PropsFromRedux } from '../containers/PageContainerContainer';

const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
display: 'flex',
},
rootMobile: {
marginBottom: 50,
}
}),
);

const PageContainer = () => {
const PageContainer = (props: PropsFromRedux) => {

const {
isConsideredMobile,
} = props;

const classes = useStyles();

Expand All @@ -44,7 +53,7 @@ const PageContainer = () => {

return (
<Navigation>
<div className={classes.root}>
<div className={[classes.root, isConsideredMobile ? classes.rootMobile : ""].join(" ")}>
{showDesktopMenu && <NavigationLeftSideBarDesktopContainer/>}
<Routes>
<Route path="/" element={<HomePage/>} />
Expand Down
19 changes: 19 additions & 0 deletions src/containers/PageContainerContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { connect, ConnectedProps } from 'react-redux';

import PageContainer from '../components/PageContainer';

interface RootState {
isConsideredMobile: boolean
isConsideredMedium: boolean
}

const mapStateToProps = (state: RootState) => ({
isConsideredMobile: state.isConsideredMobile,
isConsideredMedium: state.isConsideredMedium,
})

const connector = connect(mapStateToProps, {})

export type PropsFromRedux = ConnectedProps<typeof connector>

export default connector(PageContainer)

0 comments on commit 9e8f2f1

Please sign in to comment.