From dcafe9ab9e8850a09c24b51efa370e402c6f5487 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 3 Apr 2019 00:17:00 -0400 Subject: [PATCH] replace insufficient credits modal with inline ui elements --- flow-typed/web.js | 3 + src/ui/component/common/lbc-symbol.jsx | 2 +- .../component/fileViewer/internal/player.jsx | 4 +- src/ui/component/fileViewer/view.jsx | 13 +- src/ui/component/header/view.jsx | 4 +- src/ui/component/publishForm/view.jsx | 3 +- src/ui/component/router/view.jsx | 1 + src/ui/component/yrbl/index.jsx | 8 +- src/ui/constants/modal_types.js | 1 - src/ui/modal/modalCreditIntro/index.js | 31 --- src/ui/modal/modalCreditIntro/view.jsx | 56 ----- src/ui/modal/modalRouter/index.js | 15 +- src/ui/modal/modalRouter/view.jsx | 209 +++++------------- src/ui/page/file/index.js | 2 + src/ui/page/file/view.jsx | 28 ++- src/ui/page/publish/index.js | 2 + src/ui/page/publish/view.jsx | 52 ++++- src/ui/redux/actions/content.js | 1 - src/ui/scss/component/_card.scss | 15 +- src/ui/scss/component/_content.scss | 5 + src/ui/scss/component/_header.scss | 8 + src/ui/scss/component/_media.scss | 4 + src/ui/scss/component/_yrbl.scss | 8 +- src/ui/scss/init/_gui.scss | 2 +- src/ui/scss/init/_vars.scss | 1 + 25 files changed, 202 insertions(+), 276 deletions(-) create mode 100644 flow-typed/web.js delete mode 100644 src/ui/modal/modalCreditIntro/index.js delete mode 100644 src/ui/modal/modalCreditIntro/view.jsx diff --git a/flow-typed/web.js b/flow-typed/web.js new file mode 100644 index 000000000..69b1914e0 --- /dev/null +++ b/flow-typed/web.js @@ -0,0 +1,3 @@ +// @flow + +declare var IS_WEB: boolean; diff --git a/src/ui/component/common/lbc-symbol.jsx b/src/ui/component/common/lbc-symbol.jsx index 612247836..0fb91fe46 100644 --- a/src/ui/component/common/lbc-symbol.jsx +++ b/src/ui/component/common/lbc-symbol.jsx @@ -1,6 +1,6 @@ // @flow import React from 'react'; -const LbcSymbol = () => LBC; // ℄ +const LbcSymbol = () => LBC; // ℄ export default LbcSymbol; diff --git a/src/ui/component/fileViewer/internal/player.jsx b/src/ui/component/fileViewer/internal/player.jsx index 0cb98774a..cc602c63e 100644 --- a/src/ui/component/fileViewer/internal/player.jsx +++ b/src/ui/component/fileViewer/internal/player.jsx @@ -202,8 +202,8 @@ class MediaPlayer extends React.PureComponent { } // @if TARGET='app' - sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); + sleep(ms: number) { + return new Promise(resolve => setTimeout(resolve, ms)); } refreshMetadata() { diff --git a/src/ui/component/fileViewer/view.jsx b/src/ui/component/fileViewer/view.jsx index 914d8ceef..34336951c 100644 --- a/src/ui/component/fileViewer/view.jsx +++ b/src/ui/component/fileViewer/view.jsx @@ -47,6 +47,7 @@ type Props = { nextFileToPlay: ?string, navigate: (string, {}) => void, costInfo: ?{ cost: number }, + insufficientCredits: boolean, }; class FileViewer extends React.PureComponent { @@ -150,7 +151,11 @@ class FileViewer extends React.PureComponent { } playContent() { - const { play, uri, fileInfo, isDownloading, isLoading } = this.props; + const { play, uri, fileInfo, isDownloading, isLoading, insufficientCredits } = this.props; + + if (insufficientCredits) { + return; + } // @if TARGET='app' if (fileInfo || isDownloading || isLoading) { @@ -220,6 +225,7 @@ class FileViewer extends React.PureComponent { className, obscureNsfw, mediaType, + insufficientCredits, } = this.props; const isPlaying = playingUri === uri; @@ -246,7 +252,10 @@ class FileViewer extends React.PureComponent { } const poster = metadata && metadata.thumbnail; - const layoverClass = classnames('content__cover', { 'card__media--nsfw': shouldObscureNsfw }); + const layoverClass = classnames('content__cover', { + 'card__media--nsfw': shouldObscureNsfw, + 'card__media--disabled': insufficientCredits, + }); const layoverStyle = !shouldObscureNsfw && poster ? { backgroundImage: `url("${poster}")` } : {}; diff --git a/src/ui/component/header/view.jsx b/src/ui/component/header/view.jsx index 75d923e62..769571697 100644 --- a/src/ui/component/header/view.jsx +++ b/src/ui/component/header/view.jsx @@ -85,8 +85,7 @@ const Header = (props: Props) => { title={`Your balance is ${balance} LBRY Credits`} label={ - {roundedBalance} - + {roundedBalance} } navigate="/$/wallet" @@ -94,6 +93,7 @@ const Header = (props: Props) => {