From 32d110cb1fd1e5971f7e9a7b1d134bfbffcb65c8 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 31 Oct 2018 12:57:22 -0400 Subject: [PATCH 1/4] add subscribed icon to files on homepage --- .eslintrc.json | 3 ++- src/renderer/component/categoryList/view.jsx | 11 +++++++++-- src/renderer/component/common/tooltip.jsx | 8 +++++++- src/renderer/scss/component/_nav.scss | 4 ++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 19f686074..6a992f8bf 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -42,6 +42,7 @@ "jsx-a11y/no-noninteractive-element-to-interactive-role": 0, "class-methods-use-this": 0, "jsx-a11y/interactive-supports-focus": 0, - "jsx-a11y/click-events-have-key-events": 0 + "jsx-a11y/click-events-have-key-events": 0, + "consistent-return": 0 } } diff --git a/src/renderer/component/categoryList/view.jsx b/src/renderer/component/categoryList/view.jsx index 544b11f9b..cf39c06af 100644 --- a/src/renderer/component/categoryList/view.jsx +++ b/src/renderer/component/categoryList/view.jsx @@ -262,12 +262,19 @@ class CategoryList extends React.PureComponent { this.rowItems = ref; }} > - {names && names.map(name => )} + {names && + names.map(name => ( + + ))} {channelClaims && channelClaims.length && channelClaims.map(claim => ( - + ))} )} diff --git a/src/renderer/component/common/tooltip.jsx b/src/renderer/component/common/tooltip.jsx index 181c792c7..d77d8dd27 100644 --- a/src/renderer/component/common/tooltip.jsx +++ b/src/renderer/component/common/tooltip.jsx @@ -20,7 +20,7 @@ class ToolTip extends React.PureComponent { direction: 'bottom', }; - constructor(props) { + constructor(props: Props) { super(props); this.tooltip = React.createRef(); this.state = { @@ -33,6 +33,10 @@ class ToolTip extends React.PureComponent { } getVisibility = () => { + if (!this.tooltip.current) { + return; + } + const node = this.tooltip.current; const rect = node.getBoundingClientRect(); @@ -81,6 +85,8 @@ class ToolTip extends React.PureComponent { } }; + tooltip: { current: null | HTMLSpanElement }; + render() { const { direction } = this.state; const { children, label, body, icon, onComponent } = this.props; diff --git a/src/renderer/scss/component/_nav.scss b/src/renderer/scss/component/_nav.scss index b334512b7..1befaef54 100644 --- a/src/renderer/scss/component/_nav.scss +++ b/src/renderer/scss/component/_nav.scss @@ -12,11 +12,11 @@ @media (min-width: $medium-breakpoint) { padding-left: $spacing-width; - width: calc(var(--side-nav-width) * 1.4); + min-width: calc(var(--side-nav-width) * 1.4); } @media (min-width: $large-breakpoint) { - width: calc(var(--side-nav-width) * 1.6); + min-width: calc(var(--side-nav-width) * 1.6); } } From 639f99555feb0375586d9466805655ab6e34055d Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 31 Oct 2018 13:08:30 -0400 Subject: [PATCH 2/4] fix subscribe uri on channel pages --- src/renderer/page/channel/view.jsx | 2 +- src/renderer/redux/actions/subscriptions.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/renderer/page/channel/view.jsx b/src/renderer/page/channel/view.jsx index c70b4de6c..5638c4172 100644 --- a/src/renderer/page/channel/view.jsx +++ b/src/renderer/page/channel/view.jsx @@ -87,7 +87,7 @@ class ChannelPage extends React.PureComponent {
- +
{contentList}
diff --git a/src/renderer/redux/actions/subscriptions.js b/src/renderer/redux/actions/subscriptions.js index 465b0faa2..2149db924 100644 --- a/src/renderer/redux/actions/subscriptions.js +++ b/src/renderer/redux/actions/subscriptions.js @@ -315,6 +315,13 @@ export const doChannelSubscribe = (subscription: Subscription) => ( } = getState(); const { share_usage_data: isSharingData } = daemonSettings; + const subscriptionUri = subscription.uri; + if (!subscriptionUri.startsWith('lbry://')) { + throw Error( + `Subscription uris must inclue the "lbry://" prefix.\nTried to subscribe to ${subscriptionUri}` + ); + } + dispatch({ type: ACTIONS.CHANNEL_SUBSCRIBE, data: subscription, From 1837cef751bfcc36e5bcc1d8abe22c8590c221bb Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 31 Oct 2018 13:11:32 -0400 Subject: [PATCH 3/4] use string for channel bid amount --- src/renderer/redux/actions/content.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/renderer/redux/actions/content.js b/src/renderer/redux/actions/content.js index 81fdcecda..94d7c680d 100644 --- a/src/renderer/redux/actions/content.js +++ b/src/renderer/redux/actions/content.js @@ -23,6 +23,7 @@ import { doNotify, makeSelectChannelForClaimUri, parseURI, + creditsToString, } from 'lbry-redux'; import { makeSelectClientSetting, selectosNotificationsEnabled } from 'redux/selectors/settings'; import setBadge from 'util/setBadge'; @@ -373,7 +374,7 @@ export function doFetchChannelListMine() { }; } -export function doCreateChannel(name, amount) { +export function doCreateChannel(name: string, amount: number) { return dispatch => { dispatch({ type: ACTIONS.CREATE_CHANNEL_STARTED, @@ -382,7 +383,7 @@ export function doCreateChannel(name, amount) { return new Promise((resolve, reject) => { Lbry.channel_new({ channel_name: name, - amount: parseFloat(amount), + amount: creditsToString(amount), }).then( newChannelClaim => { const channelClaim = newChannelClaim; From a7c2fdad1ba41b60f7c2030063e781492bd54f27 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 31 Oct 2018 14:51:48 -0400 Subject: [PATCH 4/4] fix markdown editor styles on dark mode --- .../scss/component/_markdown-editor.scss | 12 +----- src/renderer/scss/themes/_dark.scss | 43 +++++++++++++++++++ 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/src/renderer/scss/component/_markdown-editor.scss b/src/renderer/scss/component/_markdown-editor.scss index b6132a137..f2b9f9c61 100644 --- a/src/renderer/scss/component/_markdown-editor.scss +++ b/src/renderer/scss/component/_markdown-editor.scss @@ -16,16 +16,14 @@ } .CodeMirror-selected { - background-color: transparent; + // background-color: transparent; } .CodeMirror-selectedtext { - background-color: $lbry-teal-5; color: $lbry-white; } .cm-spell-error:not(.cm-url):not(.cm-comment):not(.cm-tag):not(.cm-word) { - background: none; text-decoration: underline; text-decoration-color: $lbry-red-3; text-decoration-style: dotted; @@ -65,7 +63,7 @@ } a { - color: $lbry-black !important; + color: $lbry-black; transition: opacity 0.3s ease; &:not(.active), @@ -85,12 +83,6 @@ } } -.editor-preview { - background-color: rgba($lbry-gray-1, 0.5); - border: none; - font-size: calc(var(--font-size-subtext-multiple) * 1em); -} - .editor-statusbar { color: rgba($lbry-black, 0.5); } diff --git a/src/renderer/scss/themes/_dark.scss b/src/renderer/scss/themes/_dark.scss index 4eb043ec1..41b62c0b0 100644 --- a/src/renderer/scss/themes/_dark.scss +++ b/src/renderer/scss/themes/_dark.scss @@ -130,4 +130,47 @@ html[data-theme='dark'] { border: 1px solid rgba($lbry-gray-1, 0.1); color: $lbry-gray-3; } + + // Markdown editor on publish page + .form-field--SimpleMDE { + .editor-toolbar { + background-color: rgba($lbry-white, 0.2); + + a { + color: $lbry-white !important; // We need to use !important to override the CodeMirror styles + + &:hover { + color: $lbry-black !important; + } + } + + &.disabled-for-preview { + a:not(.no-disable) { + background-color: transparent; + } + + // The markdown preview button is highlighted during preview when the other buttons are disabled + a.no-disable { + background-color: rgba($lbry-white, 0.3); + } + } + } + + .CodeMirror { + border-left: 1px solid rgba($lbry-white, 0.2); + border-right: 1px solid rgba($lbry-white, 0.2); + border-bottom: 1px solid rgba($lbry-white, 0.2); + background-color: rgba($lbry-white, 0.1); + color: $lbry-white; + + .CodeMirror-selectedtext { + color: $lbry-black; + } + + .editor-preview.editor-preview-active { + background-color: $lbry-gray-5; + color: $lbry-black; + } + } + } }