-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sean Yesmunt
committed
Jun 10, 2019
1 parent
b672590
commit c60b170
Showing
140 changed files
with
2,071 additions
and
3,285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,53 @@ | ||
// @flow | ||
import React from 'react'; | ||
import React, { useEffect, useRef } from 'react'; | ||
import Router from 'component/router/index'; | ||
import ModalRouter from 'modal/modalRouter'; | ||
import ReactModal from 'react-modal'; | ||
import SideBar from 'component/sideBar'; | ||
import Header from 'component/header'; | ||
import { openContextMenu } from 'util/context-menu'; | ||
import EnhancedLayoutListener from 'util/enhanced-layout'; | ||
// import useKonamiListener from 'util/enhanced-layout'; | ||
import Yrbl from 'component/yrbl'; | ||
|
||
const TWO_POINT_FIVE_MINUTES = 1000 * 60 * 2.5; | ||
|
||
type Props = { | ||
alertError: (string | {}) => void, | ||
pageTitle: ?string, | ||
theme: string, | ||
updateBlockHeight: () => void, | ||
toggleEnhancedLayout: () => void, | ||
enhancedLayout: boolean, | ||
fetchRewards: () => void, | ||
fetchRewardedContent: () => void, | ||
}; | ||
|
||
class App extends React.PureComponent<Props> { | ||
componentWillMount() { | ||
const { alertError, theme } = this.props; | ||
function App(props: Props) { | ||
const { theme, fetchRewards, fetchRewardedContent } = props; | ||
const appRef = useRef(); | ||
const isEnhancedLayout = useKonamiListener(); | ||
|
||
// TODO: create type for this object | ||
// it lives in jsonrpc.js | ||
document.addEventListener('unhandledError', (event: any) => { | ||
alertError(event.detail); | ||
}); | ||
useEffect(() => { | ||
ReactModal.setAppElement(appRef.current); | ||
fetchRewards(); | ||
fetchRewardedContent(); | ||
}, [fetchRewards, fetchRewardedContent]); | ||
|
||
useEffect(() => { | ||
// $FlowFixMe | ||
document.documentElement.setAttribute('data-mode', theme); | ||
} | ||
|
||
componentDidMount() { | ||
const { updateBlockHeight, toggleEnhancedLayout } = this.props; | ||
|
||
ReactModal.setAppElement('#window'); // fuck this | ||
|
||
this.enhance = new EnhancedLayoutListener(() => toggleEnhancedLayout()); | ||
|
||
updateBlockHeight(); | ||
setInterval(() => { | ||
updateBlockHeight(); | ||
}, TWO_POINT_FIVE_MINUTES); | ||
} | ||
|
||
componentDidUpdate(prevProps: Props) { | ||
const { theme: prevTheme } = prevProps; | ||
const { theme } = this.props; | ||
}, [theme]); | ||
|
||
if (prevTheme !== theme) { | ||
// $FlowFixMe | ||
document.documentElement.setAttribute('data-mode', theme); | ||
} | ||
} | ||
return ( | ||
<div ref={appRef} onContextMenu={e => openContextMenu(e)}> | ||
<Header /> | ||
|
||
componentWillUnmount() { | ||
this.enhance = null; | ||
} | ||
|
||
enhance: ?any; | ||
|
||
render() { | ||
const { enhancedLayout } = this.props; | ||
|
||
return ( | ||
<div id="window" onContextMenu={e => openContextMenu(e)}> | ||
<Header /> | ||
<SideBar /> | ||
|
||
<div className="main-wrapper"> | ||
<div className="main-wrapper"> | ||
<div className="main-wrapper-inner"> | ||
<Router /> | ||
<SideBar /> | ||
</div> | ||
|
||
<ModalRouter /> | ||
{enhancedLayout && <Yrbl className="yrbl--enhanced" />} | ||
</div> | ||
); | ||
} | ||
|
||
<ModalRouter /> | ||
{isEnhancedLayout && <Yrbl className="yrbl--enhanced" />} | ||
</div> | ||
); | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.