From 4aab7127e19139d81067f3e04ab19b6a00393110 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Mon, 18 Mar 2019 21:04:53 -0400 Subject: [PATCH 1/7] fix: wallet balance background --- src/ui/component/walletBalance/view.jsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ui/component/walletBalance/view.jsx b/src/ui/component/walletBalance/view.jsx index 48ba9091e..fc536d87f 100644 --- a/src/ui/component/walletBalance/view.jsx +++ b/src/ui/component/walletBalance/view.jsx @@ -10,13 +10,15 @@ type Props = { const WalletBalance = (props: Props) => { const { balance } = props; return ( -
-
-

{__('Balance')}

-

{__('You currently have')}

+
+
+

{__('Balance')}

+

{__('You currently have')}

- -
+
{(balance || balance === 0) && ( )} -- 2.45.2 From b2ef6912d9581e303b74e55180f7edd9fca6ed48 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Mon, 18 Mar 2019 21:44:49 -0400 Subject: [PATCH 2/7] fix: daemon download path --- package.json | 2 +- src/platforms/electron/Daemon.js | 8 +++--- src/platforms/electron/index.js | 44 +++++++++++++++++--------------- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 6a72cd3c3..1d2b40e7e 100644 --- a/package.json +++ b/package.json @@ -171,7 +171,7 @@ "lbrySettings": { "lbrynetDaemonVersion": "0.32.4", "lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip", - "lbrynetDaemonDir": "static", + "lbrynetDaemonDir": "static/daemon", "lbrynetDaemonFileName": "lbrynet" } } diff --git a/src/platforms/electron/Daemon.js b/src/platforms/electron/Daemon.js index 50e20395f..c5cff1068 100644 --- a/src/platforms/electron/Daemon.js +++ b/src/platforms/electron/Daemon.js @@ -3,9 +3,11 @@ import { spawn, execSync } from 'child_process'; import { Lbry } from 'lbry-redux'; export default class Daemon { - static path = process.env.LBRY_DAEMON || ( - process.env.NODE_ENV === 'production' ? path.join(process.resourcesPath, 'static', 'lbrynet') : path.join(__static, 'lbrynet') - ); + static path = + process.env.LBRY_DAEMON || + (process.env.NODE_ENV === 'production' + ? path.join(process.resourcesPath, 'static/daemon', 'lbrynet') + : path.join(__static, 'daemon/lbrynet')); subprocess; handlers; diff --git a/src/platforms/electron/index.js b/src/platforms/electron/index.js index b84e397b2..e8bc76faa 100644 --- a/src/platforms/electron/index.js +++ b/src/platforms/electron/index.js @@ -34,7 +34,7 @@ let daemon; const appState = {}; -const installExtensions = async() => { +const installExtensions = async () => { const devtronExtension = require('devtron'); return await devtronExtension.install(); }; @@ -53,7 +53,7 @@ if (isDev) { process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = true; } -app.on('ready', async() => { +app.on('ready', async () => { let isDaemonRunning = false; await Lbry.status() .then(() => { @@ -90,20 +90,21 @@ app.on('ready', async() => { const { default: installExtension, REACT_DEVELOPER_TOOLS, - REDUX_DEVTOOLS, REACT_PERF, + REDUX_DEVTOOLS, + REACT_PERF, } = require('electron-devtools-installer'); await installExtension(REACT_DEVELOPER_TOOLS) - .then((name) => console.log(`Added Extension: ${name}`)) - .catch((err) => console.log('An error occurred: ', err)); + .then(name => console.log(`Added Extension: ${name}`)) + .catch(err => console.log('An error occurred: ', err)); await installExtension(REDUX_DEVTOOLS) - .then((name) => console.log(`Added Extension: ${name}`)) - .catch((err) => console.log('An error occurred: ', err)); + .then(name => console.log(`Added Extension: ${name}`)) + .catch(err => console.log('An error occurred: ', err)); await installExtension(REACT_PERF) - .then((name) => console.log(`Added Extension: ${name}`)) - .catch((err) => console.log('An error occurred: ', err)); + .then(name => console.log(`Added Extension: ${name}`)) + .catch(err => console.log('An error occurred: ', err)); } rendererWindow = createWindow(appState); @@ -235,7 +236,7 @@ ipcMain.on('version-info-requested', () => { let json; try { json = JSON.parse(result); - } catch(e) { + } catch (e) { return; } const tagName = json.tag_name; @@ -262,17 +263,20 @@ ipcMain.on('version-info-requested', () => { }; const requestLatestRelease = (alreadyRedirected = false) => { - const req = https.get({ - hostname: 'api.github.com', - path: '/repos/lbryio/lbry-desktop/releases/latest', - headers: { 'user-agent': `LBRY/${localVersion}` }, - }, res => { - if (res.statusCode === 301 || res.statusCode === 302) { - requestLatestRelease(res.headers.location, true); - } else { - onSuccess(res); + const req = https.get( + { + hostname: 'api.github.com', + path: '/repos/lbryio/lbry-desktop/releases/latest', + headers: { 'user-agent': `LBRY/${localVersion}` }, + }, + res => { + if (res.statusCode === 301 || res.statusCode === 302) { + requestLatestRelease(res.headers.location, true); + } else { + onSuccess(res); + } } - }); + ); if (alreadyRedirected) return; req.on('error', err => { -- 2.45.2 From 78b7ae58bd329286eae97bdc3f7872b3360f5791 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 19 Mar 2019 00:01:59 -0400 Subject: [PATCH 3/7] fix: check if games server is already running --- src/platforms/electron/startSandbox.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/platforms/electron/startSandbox.js b/src/platforms/electron/startSandbox.js index a85039553..058b7fb64 100644 --- a/src/platforms/electron/startSandbox.js +++ b/src/platforms/electron/startSandbox.js @@ -1,5 +1,7 @@ import express from 'express'; import unpackByOutpoint from './unpackByOutpoint'; +import net from 'net'; +import chalk from 'chalk'; // Polyfills and `lbry-redux` global.fetch = require('node-fetch'); @@ -13,8 +15,8 @@ const { Lbry } = require('lbry-redux'); delete global.window; export default async function startSandbox() { - const sandbox = express(); const port = 5278; + const sandbox = express(); sandbox.get('/set/:outpoint', async(req, res) => { const { outpoint } = req.params; @@ -26,5 +28,13 @@ export default async function startSandbox() { res.send(`/sandbox/${outpoint}/`); }); - sandbox.listen(port, 'localhost', () => console.log(`Sandbox listening on port ${port}.`)); + sandbox + .listen(port, 'localhost', () => console.log(`Sandbox listening on port ${port}.`)) + .on('error', err => { + if (err.code === 'EADDRINUSE') { + console.log( + 'Server already listening at localhost://5278: This is probably another LBRY app running. If not, games in the app will not work.' + ); + } + }); } -- 2.45.2 From c74440692d5ba885c12f64a227a04d9ded2e05e2 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 19 Mar 2019 00:15:42 -0400 Subject: [PATCH 4/7] fix: channel navigation from search page --- src/ui/component/channelTile/view.jsx | 16 +++++----- src/ui/page/channel/view.jsx | 46 +++++++++++++-------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/ui/component/channelTile/view.jsx b/src/ui/component/channelTile/view.jsx index f82615989..14c616f2d 100644 --- a/src/ui/component/channelTile/view.jsx +++ b/src/ui/component/channelTile/view.jsx @@ -45,26 +45,26 @@ class ChannelTile extends React.PureComponent { subscriptionUri = `lbry://${claim.permanent_url}`; } - const onClick = () => navigate('/show', { uri }); + const onClick = () => navigate('/show', { uri, page: 1 }); return (
-
- {isResolvingUri &&
{__('Loading...')}
} +
+ {isResolvingUri &&
{__('Loading...')}
} {!isResolvingUri && ( -
+
-
+
{totalItems > 0 && ( {totalItems} {totalItems === 1 ? 'publish' : 'publishes'} @@ -75,8 +75,8 @@ class ChannelTile extends React.PureComponent { )} {subscriptionUri && ( -
- +
+
)}
diff --git a/src/ui/page/channel/view.jsx b/src/ui/page/channel/view.jsx index ff348eefb..004e718cc 100644 --- a/src/ui/page/channel/view.jsx +++ b/src/ui/page/channel/view.jsx @@ -32,11 +32,11 @@ class ChannelPage extends React.PureComponent { fetchClaims(uri, page || 1); } - componentWillReceiveProps(nextProps: Props) { - const { page, fetchClaims } = this.props; + componentDidUpdate(prevProps: Props) { + const { page, fetchClaims, uri } = this.props; - if (nextProps.page && page !== nextProps.page) { - fetchClaims(nextProps.uri, nextProps.page); + if (prevProps.page && prevProps.page && page !== prevProps.page) { + fetchClaims(uri, page); } } @@ -80,21 +80,21 @@ class ChannelPage extends React.PureComponent { claimsInChannel && claimsInChannel.length ? ( ) : ( - !fetching && {__('No content found.')} + !fetching && {__('No content found.')} ); return ( -
-

+
+

{name} {fetching && }

-
+
-
{contentList}
+
{contentList}
{(!fetching || (claimsInChannel && claimsInChannel.length)) && totalPages > 1 && (
- + this.changePage(e.selected + 1)} forcePage={currentPage} initialPage={currentPage} - containerClassName="pagination" + containerClassName='pagination' /> this.paginate(e, totalPages)} label={__('Go to page:')} - type="text" - name="paginate-file" + type='text' + name='paginate-file' /> )} - {!channelIsMine && } + {!channelIsMine && } ); } -- 2.45.2 From b08f0cb373c952d4a7895c32b34ab2e3f4ef4253 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 19 Mar 2019 11:59:16 -0400 Subject: [PATCH 5/7] fix: badge spacing on file page --- src/ui/scss/component/_media.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/scss/component/_media.scss b/src/ui/scss/component/_media.scss index 88e65a600..ff8a64225 100644 --- a/src/ui/scss/component/_media.scss +++ b/src/ui/scss/component/_media.scss @@ -136,6 +136,7 @@ display: inline; font-size: 2rem; line-height: 1.33; + margin-right: var(--spacing-vertical-small); } // M E D I A @@ -299,11 +300,10 @@ &:not(:empty) { height: 2.55rem; - margin-top: -1px; + margin-top: 0px; margin-bottom: var(--spacing-vertical-small); padding-top: var(--spacing-vertical-small); - padding-left: var(--spacing-vertical-small); } .badge { -- 2.45.2 From 483a97a694fdf8765a7e37d85b9c60bee445017e Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 19 Mar 2019 11:59:29 -0400 Subject: [PATCH 6/7] fix: channel tile --- .eslintrc.json | 1 + src/platforms/electron/startSandbox.js | 2 -- src/ui/component/channelTile/index.js | 8 ++++++-- src/ui/constants/action_types.js | 1 - src/ui/page/file/view.jsx | 20 +++++++++++--------- src/ui/redux/reducers/content.js | 17 +++-------------- src/ui/redux/selectors/content.js | 11 ----------- 7 files changed, 21 insertions(+), 39 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 8b289560f..746822b3d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -35,6 +35,7 @@ "standard/no-callback-literal": 0, "comma-dangle": ["error", "always-multiline"], "space-before-function-paren": ["error", "never"], + "jsx-quotes": ["error", "prefer-double"], "semi": [ "error", "always", diff --git a/src/platforms/electron/startSandbox.js b/src/platforms/electron/startSandbox.js index 058b7fb64..4af568da8 100644 --- a/src/platforms/electron/startSandbox.js +++ b/src/platforms/electron/startSandbox.js @@ -1,7 +1,5 @@ import express from 'express'; import unpackByOutpoint from './unpackByOutpoint'; -import net from 'net'; -import chalk from 'chalk'; // Polyfills and `lbry-redux` global.fetch = require('node-fetch'); diff --git a/src/ui/component/channelTile/index.js b/src/ui/component/channelTile/index.js index 004816016..347697f35 100644 --- a/src/ui/component/channelTile/index.js +++ b/src/ui/component/channelTile/index.js @@ -1,7 +1,11 @@ import { connect } from 'react-redux'; -import { doResolveUri, makeSelectClaimForUri, makeSelectIsUriResolving } from 'lbry-redux'; +import { + doResolveUri, + makeSelectClaimForUri, + makeSelectIsUriResolving, + makeSelectTotalItemsForChannel, +} from 'lbry-redux'; import { doNavigate } from 'redux/actions/navigation'; -import { makeSelectTotalItemsForChannel } from 'redux/selectors/content'; import ChannelTile from './view'; const select = (state, props) => ({ diff --git a/src/ui/constants/action_types.js b/src/ui/constants/action_types.js index 10248feae..f782a9272 100644 --- a/src/ui/constants/action_types.js +++ b/src/ui/constants/action_types.js @@ -68,7 +68,6 @@ export const RESOLVE_URIS_COMPLETED = 'RESOLVE_URIS_COMPLETED'; export const FETCH_CHANNEL_CLAIMS_STARTED = 'FETCH_CHANNEL_CLAIMS_STARTED'; export const FETCH_CHANNEL_CLAIMS_COMPLETED = 'FETCH_CHANNEL_CLAIMS_COMPLETED'; export const FETCH_CHANNEL_CLAIM_COUNT_STARTED = 'FETCH_CHANNEL_CLAIM_COUNT_STARTED'; -export const FETCH_CHANNEL_CLAIM_COUNT_COMPLETED = 'FETCH_CHANNEL_CLAIM_COUNT_COMPLETED'; export const FETCH_CLAIM_LIST_MINE_STARTED = 'FETCH_CLAIM_LIST_MINE_STARTED'; export const FETCH_CLAIM_LIST_MINE_COMPLETED = 'FETCH_CLAIM_LIST_MINE_COMPLETED'; export const ABANDON_CLAIM_STARTED = 'ABANDON_CLAIM_STARTED'; diff --git a/src/ui/page/file/view.jsx b/src/ui/page/file/view.jsx index c871253f7..749a5ca1a 100644 --- a/src/ui/page/file/view.jsx +++ b/src/ui/page/file/view.jsx @@ -226,7 +226,7 @@ class FilePage extends React.Component {
- {claimIsMine ? ( + {claimIsMine && (

-
{contentList}
+
{contentList}
{(!fetching || (claimsInChannel && claimsInChannel.length)) && totalPages > 1 && (
- + this.changePage(e.selected + 1)} forcePage={currentPage} initialPage={currentPage} - containerClassName='pagination' + containerClassName="pagination" /> this.paginate(e, totalPages)} label={__('Go to page:')} - type='text' - name='paginate-file' + type="text" + name="paginate-file" /> )} - {!channelIsMine && } + {!channelIsMine && }
); } -- 2.45.2