update lbry-redux and add loading spinner for comments

This commit is contained in:
Sean Yesmunt 2020-05-25 14:45:43 -04:00
parent cbec0d15df
commit b914590a77
4 changed files with 21 additions and 6 deletions

View file

@ -132,7 +132,7 @@
"imagesloaded": "^4.1.4",
"json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#aa2cfa789670e899824d3d3ac1ae677172a7ad4e",
"lbry-redux": "lbryio/lbry-redux#d2079111b3372eb926d2753991bed860e57a970a",
"lbryinc": "lbryio/lbryinc#6a52f8026cdc7cd56d200fb5c46f852e0139bbeb",
"lint-staged": "^7.0.2",
"localforage": "^1.7.1",

View file

@ -1,11 +1,18 @@
import { connect } from 'react-redux';
import { makeSelectCommentsForUri, doCommentList, makeSelectClaimIsMine, selectMyChannelClaims } from 'lbry-redux';
import {
makeSelectCommentsForUri,
doCommentList,
makeSelectClaimIsMine,
selectMyChannelClaims,
selectIsFetchingComments,
} from 'lbry-redux';
import CommentsList from './view';
const select = (state, props) => ({
myChannels: selectMyChannelClaims(state),
comments: makeSelectCommentsForUri(props.uri)(state),
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
isFetchingComments: selectIsFetchingComments(state),
});
const perform = dispatch => ({

View file

@ -1,6 +1,7 @@
// @flow
import React, { useEffect } from 'react';
import Comment from 'component/comment';
import Spinner from 'component/spinner';
type Props = {
comments: Array<any>,
@ -8,10 +9,11 @@ type Props = {
uri: string,
claimIsMine: boolean,
myChannels: ?Array<ChannelClaim>,
isFetchingComments: boolean,
};
function CommentList(props: Props) {
const { fetchComments, uri, comments, claimIsMine, myChannels } = props;
const { fetchComments, uri, comments, claimIsMine, myChannels, isFetchingComments } = props;
// todo: implement comment_list --mine in SDK so redux can grab with selectCommentIsMine
const isMyComment = (channelId: string) => {
@ -49,7 +51,13 @@ function CommentList(props: Props) {
return (
<ul className="comments">
{comments &&
{isFetchingComments && (
<div className="main--empty">
<Spinner />
</div>
)}
{!isFetchingComments &&
comments &&
sortByParent(comments).map(comment => {
return (
<Comment

View file

@ -6178,9 +6178,9 @@ lazy-val@^1.0.4:
yargs "^13.2.2"
zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#aa2cfa789670e899824d3d3ac1ae677172a7ad4e:
lbry-redux@lbryio/lbry-redux#d2079111b3372eb926d2753991bed860e57a970a:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/aa2cfa789670e899824d3d3ac1ae677172a7ad4e"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/d2079111b3372eb926d2753991bed860e57a970a"
dependencies:
proxy-polyfill "0.1.6"
reselect "^3.0.0"