diff --git a/ui/component/comment/view.jsx b/ui/component/comment/view.jsx index 814016b58..006da4d75 100644 --- a/ui/component/comment/view.jsx +++ b/ui/component/comment/view.jsx @@ -50,6 +50,7 @@ type Props = { activeChannelClaim: ?ChannelClaim, playingUri: ?PlayingUri, stakedLevel: number, + livestream?: boolean, }; const LENGTH_TO_COLLAPSE = 300; @@ -77,6 +78,7 @@ function Comment(props: Props) { othersReacts, playingUri, stakedLevel, + livestream, } = props; const { push, @@ -162,6 +164,7 @@ function Comment(props: Props) { className={classnames('comment', { 'comment--top-level': isTopLevel, 'comment--reply': !isTopLevel, + 'comment--livestream': livestream, })} id={commentId} onMouseOver={() => setMouseHover(true)} @@ -173,13 +176,20 @@ function Comment(props: Props) { 'comment--slimed': slimedToDeath && !displayDeadComment, })} > -
- {authorUri ? ( - - ) : ( - - )} -
+ {!livestream && ( +
+ {authorUri ? ( + + ) : ( + + )} +
+ )}
@@ -187,13 +197,15 @@ function Comment(props: Props) { {!author ? ( {__('Anonymous')} ) : ( - + + )} + {!livestream && ( +
-
- {threadDepth !== 0 && ( -
+ {!livestream && ( +
+ {threadDepth !== 0 && ( +
+ )} {isReplying && ( {comments.map((comment) => (
- {comment.channel_url ? ( -
))}
diff --git a/ui/component/uriIndicator/view.jsx b/ui/component/uriIndicator/view.jsx index 03484b0a0..411996bc9 100644 --- a/ui/component/uriIndicator/view.jsx +++ b/ui/component/uriIndicator/view.jsx @@ -17,6 +17,7 @@ type Props = { // to allow for other elements to be nested within the UriIndicator children: ?Node, inline: boolean, + external?: boolean, }; class UriIndicator extends React.PureComponent { @@ -37,7 +38,7 @@ class UriIndicator extends React.PureComponent { }; render() { - const { link, isResolvingUri, claim, children, inline, hideAnonymous = false } = this.props; + const { link, isResolvingUri, claim, children, inline, hideAnonymous = false, external = false } = this.props; if (!claim) { return {isResolvingUri ? 'Validating...' : 'Unused'}; @@ -74,10 +75,14 @@ class UriIndicator extends React.PureComponent { } if (children) { - return ; + return ( + + ); } else { return ( - ); diff --git a/ui/redux/actions/sync.js b/ui/redux/actions/sync.js index 57757cf29..ba312d8eb 100644 --- a/ui/redux/actions/sync.js +++ b/ui/redux/actions/sync.js @@ -13,13 +13,13 @@ const NO_WALLET_ERROR = 'no wallet found for this user'; const BAD_PASSWORD_ERROR_NAME = 'InvalidPasswordError'; export function doSetDefaultAccount(success, failure) { - return dispatch => { + return (dispatch) => { dispatch({ type: ACTIONS.SET_DEFAULT_ACCOUNT, }); Lbry.account_list() - .then(accountList => { + .then((accountList) => { const { lbc_mainnet: accounts } = accountList; let defaultId; for (let i = 0; i < accounts.length; ++i) { @@ -43,7 +43,7 @@ export function doSetDefaultAccount(success, failure) { success(); } }) - .catch(err => { + .catch((err) => { if (failure) { failure(err); } @@ -53,7 +53,7 @@ export function doSetDefaultAccount(success, failure) { failure('Could not set a default account'); // fail } }) - .catch(err => { + .catch((err) => { if (failure) { failure(err); } @@ -62,13 +62,13 @@ export function doSetDefaultAccount(success, failure) { } export function doSetSync(oldHash, newHash, data) { - return dispatch => { + return (dispatch) => { dispatch({ type: ACTIONS.SET_SYNC_STARTED, }); return Lbryio.call('sync', 'set', { old_hash: oldHash, new_hash: newHash, data }, 'post') - .then(response => { + .then((response) => { if (!response.hash) { throw Error('No hash returned for sync/set.'); } @@ -78,7 +78,7 @@ export function doSetSync(oldHash, newHash, data) { data: { syncHash: response.hash }, }); }) - .catch(error => { + .catch((error) => { dispatch({ type: ACTIONS.SET_SYNC_FAILED, data: { error }, @@ -94,7 +94,7 @@ export const doGetSyncDesktop = (cb?, password) => (dispatch, getState) => { const setSyncPending = selectSetSyncIsPending(state); const syncLocked = selectSyncIsLocked(state); - return getSavedPassword().then(savedPassword => { + return getSavedPassword().then((savedPassword) => { const passwordArgument = password || password === '' ? password : savedPassword === null ? '' : savedPassword; if (syncEnabled && !getSyncPending && !setSyncPending && !syncLocked) { @@ -128,7 +128,7 @@ export function doSyncLoop(noInterval) { } export function doSyncUnsubscribe() { - return dispatch => { + return (dispatch) => { if (syncTimer) { clearInterval(syncTimer); } @@ -148,7 +148,7 @@ export function doGetSync(passedPassword, callback) { } } - return dispatch => { + return (dispatch) => { dispatch({ type: ACTIONS.GET_SYNC_STARTED, }); @@ -156,7 +156,7 @@ export function doGetSync(passedPassword, callback) { const data = {}; Lbry.wallet_status() - .then(status => { + .then((status) => { if (status.is_locked) { return Lbry.wallet_unlock({ password }); } @@ -164,15 +164,15 @@ export function doGetSync(passedPassword, callback) { // Wallet is already unlocked return true; }) - .then(isUnlocked => { + .then((isUnlocked) => { if (isUnlocked) { return Lbry.sync_hash(); } data.unlockFailed = true; throw new Error(); }) - .then(hash => Lbryio.call('sync', 'get', { hash }, 'post')) - .then(response => { + .then((hash) => Lbryio.call('sync', 'get', { hash }, 'post')) + .then((response) => { const syncHash = response.hash; data.syncHash = syncHash; data.syncData = response.data; @@ -183,7 +183,7 @@ export function doGetSync(passedPassword, callback) { return Lbry.sync_apply({ password, data: response.data, blocking: true }); } }) - .then(response => { + .then((response) => { if (!response) { dispatch({ type: ACTIONS.GET_SYNC_COMPLETED, data }); handleCallback(null, data.changed); @@ -200,7 +200,7 @@ export function doGetSync(passedPassword, callback) { dispatch({ type: ACTIONS.GET_SYNC_COMPLETED, data }); handleCallback(null, data.changed); }) - .catch(syncAttemptError => { + .catch((syncAttemptError) => { const badPasswordError = syncAttemptError && syncAttemptError.data && syncAttemptError.data.name === BAD_PASSWORD_ERROR_NAME; @@ -248,7 +248,7 @@ export function doGetSync(passedPassword, callback) { dispatch(doSetSync('', walletHash, syncApplyData, password)); handleCallback(); }) - .catch(syncApplyError => { + .catch((syncApplyError) => { handleCallback(syncApplyError); }); } @@ -258,7 +258,7 @@ export function doGetSync(passedPassword, callback) { } export function doSyncApply(syncHash, syncData, password) { - return dispatch => { + return (dispatch) => { dispatch({ type: ACTIONS.SYNC_APPLY_STARTED, }); @@ -286,14 +286,14 @@ export function doSyncApply(syncHash, syncData, password) { } export function doCheckSync() { - return dispatch => { + return (dispatch) => { dispatch({ type: ACTIONS.GET_SYNC_STARTED, }); - Lbry.sync_hash().then(hash => { + Lbry.sync_hash().then((hash) => { Lbryio.call('sync', 'get', { hash }, 'post') - .then(response => { + .then((response) => { const data = { hasSyncedWallet: true, syncHash: response.hash, @@ -314,19 +314,19 @@ export function doCheckSync() { } export function doResetSync() { - return dispatch => - new Promise(resolve => { + return (dispatch) => + new Promise((resolve) => { dispatch({ type: ACTIONS.SYNC_RESET }); resolve(); }); } export function doSyncEncryptAndDecrypt(oldPassword, newPassword, encrypt) { - return dispatch => { + return (dispatch) => { const data = {}; return Lbry.sync_hash() - .then(hash => Lbryio.call('sync', 'get', { hash }, 'post')) - .then(syncGetResponse => { + .then((hash) => Lbryio.call('sync', 'get', { hash }, 'post')) + .then((syncGetResponse) => { data.oldHash = syncGetResponse.hash; return Lbry.sync_apply({ password: oldPassword, data: syncGetResponse.data }); @@ -339,7 +339,7 @@ export function doSyncEncryptAndDecrypt(oldPassword, newPassword, encrypt) { } }) .then(() => Lbry.sync_apply({ password: newPassword })) - .then(syncApplyResponse => { + .then((syncApplyResponse) => { if (syncApplyResponse.hash !== data.oldHash) { return dispatch(doSetSync(data.oldHash, syncApplyResponse.hash, syncApplyResponse.data)); } diff --git a/ui/redux/selectors/comments.js b/ui/redux/selectors/comments.js index caaea1344..c7d6f25d3 100644 --- a/ui/redux/selectors/comments.js +++ b/ui/redux/selectors/comments.js @@ -105,12 +105,20 @@ export const makeSelectCommentIdsForUri = (uri: string) => export const makeSelectMyReactionsForComment = (commentId: string) => createSelector(selectState, (state) => { + if (!state.myReactsByCommentId) { + return []; + } + return state.myReactsByCommentId[commentId] || []; }); export const makeSelectOthersReactionsForComment = (commentId: string) => createSelector(selectState, (state) => { - return state.othersReactsByCommentId[commentId]; + if (!state.othersReactsByCommentId) { + return {}; + } + + return state.othersReactsByCommentId[commentId] || {}; }); export const selectPendingCommentReacts = createSelector(selectState, (state) => state.pendingCommentReactions); diff --git a/ui/scss/component/_comments.scss b/ui/scss/component/_comments.scss index acfc3ba02..b45f8b2b0 100644 --- a/ui/scss/component/_comments.scss +++ b/ui/scss/component/_comments.scss @@ -34,6 +34,7 @@ $thumbnailWidthSmall: 1rem; } .comment { + width: 100%; display: flex; flex-direction: column; font-size: var(--font-small); @@ -101,6 +102,10 @@ $thumbnailWidthSmall: 1rem; } } +.comment--livestream { + margin-right: 0; +} + .comment--slimed { opacity: 0.6; } diff --git a/ui/scss/component/_livestream.scss b/ui/scss/component/_livestream.scss index d7d1c22f7..99cdcf3b9 100644 --- a/ui/scss/component/_livestream.scss +++ b/ui/scss/component/_livestream.scss @@ -48,10 +48,6 @@ margin-top: var(--spacing-s); display: flex; flex-wrap: wrap; - - > :first-child { - margin-right: var(--spacing-s); - } } .livestream__comment-author {