Skip to content

Commit

Permalink
discovery changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Yesmunt committed Jun 10, 2019
1 parent b672590 commit c60b170
Show file tree
Hide file tree
Showing 140 changed files with 2,071 additions and 3,285 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@exponent/electron-cookies": "^2.0.0",
"@hot-loader/react-dom": "16.8",
"@lbry/color": "^1.0.2",
"@lbry/components": "^2.7.0",
"@lbry/components": "^2.7.2",
"@reach/rect": "^0.2.1",
"@reach/tabs": "^0.1.5",
"@types/three": "^0.93.1",
Expand Down Expand Up @@ -119,7 +119,7 @@
"jsmediatags": "^3.8.1",
"json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#02f6918238110726c0b3b4248c61a84ac0b969e3",
"lbry-redux": "lbryio/lbry-redux#7ed316ba48f16246e4d3b99467fa5c3ffdeffa52",
"lbryinc": "lbryio/lbryinc#43d382d9b74d396a581a74d87e4c53105e04f845",
"lint-staged": "^7.0.2",
"localforage": "^1.7.1",
Expand Down Expand Up @@ -153,6 +153,7 @@
"react-router": "^5.0.0",
"react-router-dom": "^5.0.0",
"react-simplemde-editor": "^4.0.0",
"react-spring": "^8.0.20",
"react-toggle": "^4.0.2",
"redux": "^3.6.0",
"redux-persist": "^4.8.0",
Expand Down Expand Up @@ -191,7 +192,7 @@
"yarn": "^1.3"
},
"lbrySettings": {
"lbrynetDaemonVersion": "0.37.2",
"lbrynetDaemonVersion": "0.38.0rc6",
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip",
"lbrynetDaemonDir": "static/daemon",
"lbrynetDaemonFileName": "lbrynet"
Expand Down
13 changes: 0 additions & 13 deletions src/platforms/electron/createWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,6 @@ export default appState => {
window.loadURL(rendererURL + deepLinkingURI);
setupBarMenu();

// Windows back/forward mouse navigation
window.on('app-command', (e, cmd) => {
switch (cmd) {
case 'browser-backward':
window.webContents.send('navigate-backward', null);
break;
case 'browser-forward':
window.webContents.send('navigate-forward', null);
break;
default: // Do nothing
}
});

window.on('close', event => {
if (!appState.isQuitting && !appState.autoUpdateAccepted) {
event.preventDefault();
Expand Down
8 changes: 3 additions & 5 deletions src/ui/component/app/index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import { hot } from 'react-hot-loader/root';
import { connect } from 'react-redux';
import { doUpdateBlockHeight, doError } from 'lbry-redux';
import { doToggleEnhancedLayout } from 'redux/actions/app';
import { selectUser } from 'lbryinc';
import { selectUser, doRewardList, doFetchRewardedContent } from 'lbryinc';
import { selectThemePath } from 'redux/selectors/settings';
import { selectEnhancedLayout } from 'redux/selectors/app';
import App from './view';

const select = state => ({
user: selectUser(state),
theme: selectThemePath(state),
enhancedLayout: selectEnhancedLayout(state),
});

const perform = dispatch => ({
alertError: errorList => dispatch(doError(errorList)),
updateBlockHeight: () => dispatch(doUpdateBlockHeight()),
toggleEnhancedLayout: () => dispatch(doToggleEnhancedLayout()),
fetchRewards: () => dispatch(doRewardList()),
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
});

export default hot(
Expand Down
84 changes: 26 additions & 58 deletions src/ui/component/app/view.jsx
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;
2 changes: 1 addition & 1 deletion src/ui/component/button/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class Button extends React.PureComponent<Props> {
'button--primary': button === 'primary',
'button--secondary': button === 'secondary',
'button--alt': button === 'alt',
'button--danger': button === 'danger',
'button--inverse': button === 'inverse',
'button--close': button === 'close',
'button--disabled': disabled,
'button--link': button === 'link',
'button--constrict': constrict,
Expand Down
22 changes: 0 additions & 22 deletions src/ui/component/categoryList/index.js

This file was deleted.

Loading

0 comments on commit c60b170

Please sign in to comment.