Start using claims instead of file info for published files

This commit is contained in:
6ea86b96 2017-07-05 13:38:17 +07:00
parent 253932113f
commit 5012d44384
3 changed files with 15 additions and 13 deletions

View file

@ -67,7 +67,9 @@ class FileList extends React.PureComponent {
const content = [];
this._sortFunctions[sortBy](fileInfos).forEach(fileInfo => {
let uriParams = {};
let uriParams = {
claimId: fileInfo.claim_id,
};
if (fileInfo.channel_name) {
uriParams.channelName = fileInfo.channel_name;
uriParams.contentName = fileInfo.name;

View file

@ -1,24 +1,24 @@
import React from "react";
import rewards from "rewards";
import { connect } from "react-redux";
import { doFetchFileInfosAndPublishedClaims } from "actions/file_info";
import { doFetchClaimListMine } from "actions/content";
import {
selectFileInfosPublished,
selectIsFetchingFileListDownloadedOrPublished,
} from "selectors/file_info";
selectMyClaims,
selectIsFetchingClaimListMine,
} from "selectors/claims";
import { doClaimRewardType } from "actions/rewards";
import { doNavigate } from "actions/app";
import { doCancelAllResolvingUris } from "actions/content";
import FileListPublished from "./view";
const select = state => ({
fileInfos: selectFileInfosPublished(state),
isFetching: selectIsFetchingFileListDownloadedOrPublished(state),
claims: selectMyClaims(state),
isFetching: selectIsFetchingClaimListMine(state),
});
const perform = dispatch => ({
navigate: path => dispatch(doNavigate(path)),
fetchFileListPublished: () => dispatch(doFetchFileInfosAndPublishedClaims()),
fetchClaims: () => dispatch(doFetchClaimListMine()),
claimFirstPublishReward: () =>
dispatch(doClaimRewardType(rewards.TYPE_FIRST_PUBLISH)),
cancelResolvingUris: () => dispatch(doCancelAllResolvingUris()),

View file

@ -12,11 +12,11 @@ import SubHeader from "component/subHeader";
class FileListPublished extends React.PureComponent {
componentWillMount() {
if (!this.props.isFetching) this.props.fetchFileListPublished();
if (!this.props.isFetching) this.props.fetchClaims();
}
componentDidUpdate() {
if (this.props.fileInfos.length > 0) this.props.claimFirstPublishReward();
// if (this.props.claims.length > 0) this.props.fetchClaims();
}
componentWillUnmount() {
@ -24,14 +24,14 @@ class FileListPublished extends React.PureComponent {
}
render() {
const { fileInfos, isFetching, navigate } = this.props;
const { claims, isFetching, navigate } = this.props;
let content;
if (fileInfos && fileInfos.length > 0) {
if (claims && claims.length > 0) {
content = (
<FileList
fileInfos={fileInfos}
fileInfos={claims}
fetching={isFetching}
fileTileShowEmpty={FileTile.SHOW_EMPTY_PENDING}
/>