channel navigation fixes

This commit is contained in:
Jeremy Kauffman 2017-09-20 13:12:53 -04:00
parent a22a773633
commit 33c5158818
7 changed files with 15 additions and 15 deletions

View file

@ -20,7 +20,7 @@
"electron-rebuild": "^1.5.11"
},
"lbrySettings": {
"lbrynetDaemonVersion": "0.16.0",
"lbrynetDaemonVersion": "0.16.1rc1",
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-daemon-vDAEMONVER-OSNAME.zip"
},
"license": "MIT"

View file

@ -355,7 +355,7 @@ export function doFetchClaimsByChannel(uri, page) {
data: { uri, page },
});
lbry.claim_list_by_channel({ uri, page }).then(result => {
lbry.claim_list_by_channel({ uri, page: page || 1 }).then(result => {
const claimResult = result[uri],
claims = claimResult ? claimResult.claims_in_channel : [],
currentPage = claimResult ? claimResult.returned_page : undefined;

View file

@ -9,18 +9,19 @@ import {
makeSelectClaimsInChannelForCurrentPage,
makeSelectFetchingChannelClaims,
} from "selectors/claims";
import { selectCurrentParams } from "selectors/navigation";
import {
makeSelectCurrentParam,
selectCurrentParams,
} from "selectors/navigation";
import { doNavigate } from "actions/navigation";
import { makeSelectTotalPagesForChannel } from "selectors/content";
import ChannelPage from "./view";
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
claimsInChannel: makeSelectClaimsInChannelForCurrentPage(
props.uri,
props.page
)(state),
claimsInChannel: makeSelectClaimsInChannelForCurrentPage(props.uri)(state),
fetching: makeSelectFetchingChannelClaims(props.uri)(state),
page: makeSelectCurrentParam("page")(state),
params: selectCurrentParams(state),
totalPages: makeSelectTotalPagesForChannel(props.uri)(state),
});

View file

@ -2,7 +2,6 @@ import React from "react";
import lbryuri from "lbryuri";
import { BusyMessage } from "component/common";
import FileTile from "component/fileTile";
import Link from "component/link";
import ReactPaginate from "react-paginate";
class ChannelPage extends React.PureComponent {
@ -16,7 +15,7 @@ class ChannelPage extends React.PureComponent {
componentWillReceiveProps(nextProps) {
const { page, uri, fetching, fetchClaims, fetchClaimCount } = this.props;
if (fetching !== nextProps.page && page !== nextProps.page) {
if (nextProps.page && page !== nextProps.page) {
fetchClaims(nextProps.uri, nextProps.page);
}
if (nextProps.uri != uri) {
@ -42,10 +41,10 @@ class ChannelPage extends React.PureComponent {
} = this.props;
let contentList;
if (claimsInChannel === undefined) {
if (fetching) {
contentList = <BusyMessage message={__("Fetching content")} />;
} else if (claimsInChannel) {
contentList = claimsInChannel.length
} else {
contentList = claimsInChannel && claimsInChannel.length
? claimsInChannel.map(claim =>
<FileTile
key={claim.claim_id}

View file

@ -13,7 +13,7 @@ import {
import { makeSelectCostInfoForUri } from "selectors/cost_info";
import { selectShowNsfw } from "selectors/settings";
import FilePage from "./view";
import { makeSelectCurrentParam } from "../../selectors/navigation";
import { makeSelectCurrentParam } from "selectors/navigation";
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),

View file

@ -80,7 +80,7 @@ reducers[types.FETCH_CHANNEL_CLAIM_COUNT_COMPLETED] = function(state, action) {
const channelPages = Object.assign({}, state.channelPages);
const { uri, totalClaims } = action.data;
channelPages[uri] = totalClaims / 10;
channelPages[uri] = Math.ceil(totalClaims / 10);
return Object.assign({}, state, {
channelPages,

View file

@ -82,7 +82,7 @@ export const makeSelectClaimsInChannelForCurrentPage = uri => {
pageSelector,
(byId, allClaims, page) => {
const byChannel = allClaims[uri] || {};
const claimIds = byChannel[page];
const claimIds = byChannel[page || 1];
if (!claimIds) return claimIds;