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
ui/js
component/fileList
page/fileListPublished

View file

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

View file

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

View file

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