fix: channel tile

This commit is contained in:
Sean Yesmunt 2019-03-19 11:59:29 -04:00
parent b08f0cb373
commit 483a97a694
7 changed files with 21 additions and 39 deletions

View file

@ -35,6 +35,7 @@
"standard/no-callback-literal": 0,
"comma-dangle": ["error", "always-multiline"],
"space-before-function-paren": ["error", "never"],
"jsx-quotes": ["error", "prefer-double"],
"semi": [
"error",
"always",

View file

@ -1,7 +1,5 @@
import express from 'express';
import unpackByOutpoint from './unpackByOutpoint';
import net from 'net';
import chalk from 'chalk';
// Polyfills and `lbry-redux`
global.fetch = require('node-fetch');

View file

@ -1,7 +1,11 @@
import { connect } from 'react-redux';
import { doResolveUri, makeSelectClaimForUri, makeSelectIsUriResolving } from 'lbry-redux';
import {
doResolveUri,
makeSelectClaimForUri,
makeSelectIsUriResolving,
makeSelectTotalItemsForChannel,
} from 'lbry-redux';
import { doNavigate } from 'redux/actions/navigation';
import { makeSelectTotalItemsForChannel } from 'redux/selectors/content';
import ChannelTile from './view';
const select = (state, props) => ({

View file

@ -68,7 +68,6 @@ export const RESOLVE_URIS_COMPLETED = 'RESOLVE_URIS_COMPLETED';
export const FETCH_CHANNEL_CLAIMS_STARTED = 'FETCH_CHANNEL_CLAIMS_STARTED';
export const FETCH_CHANNEL_CLAIMS_COMPLETED = 'FETCH_CHANNEL_CLAIMS_COMPLETED';
export const FETCH_CHANNEL_CLAIM_COUNT_STARTED = 'FETCH_CHANNEL_CLAIM_COUNT_STARTED';
export const FETCH_CHANNEL_CLAIM_COUNT_COMPLETED = 'FETCH_CHANNEL_CLAIM_COUNT_COMPLETED';
export const FETCH_CLAIM_LIST_MINE_STARTED = 'FETCH_CLAIM_LIST_MINE_STARTED';
export const FETCH_CLAIM_LIST_MINE_COMPLETED = 'FETCH_CLAIM_LIST_MINE_COMPLETED';
export const ABANDON_CLAIM_STARTED = 'ABANDON_CLAIM_STARTED';

View file

@ -226,7 +226,7 @@ class FilePage extends React.Component<Props> {
<div className="media__actions media__actions--between">
<div className="media__action-group--large">
{claimIsMine ? (
{claimIsMine && (
<Button
button="primary"
icon={icons.EDIT}
@ -236,16 +236,18 @@ class FilePage extends React.Component<Props> {
navigate('/publish');
}}
/>
) : (
<SubscribeButton uri={channelUri} channelName={channelName} />
)}
{!claimIsMine && (
<Button
button="alt"
icon={icons.TIP}
label={__('Send a tip')}
onClick={() => openModal(MODALS.SEND_TIP, { uri })}
/>
<React.Fragment>
{channelUri && <SubscribeButton uri={channelUri} channelName={channelName} />}
<Button
button="alt"
icon={icons.TIP}
label={__('Send a tip')}
onClick={() => openModal(MODALS.SEND_TIP, { uri })}
/>
</React.Fragment>
)}
<Button
button="alt"

View file

@ -13,17 +13,6 @@ reducers[ACTIONS.SET_PLAYING_URI] = (state, action) =>
playingUri: action.data.uri,
});
reducers[ACTIONS.FETCH_CHANNEL_CLAIM_COUNT_COMPLETED] = (state, action) => {
const channelClaimCounts = Object.assign({}, state.channelClaimCounts);
const { uri, totalClaims } = action.data;
channelClaimCounts[uri] = totalClaims;
return Object.assign({}, state, {
channelClaimCounts,
});
};
reducers[ACTIONS.SET_CONTENT_POSITION] = (state, action) => {
const { claimId, outpoint, position } = action.data;
return {
@ -57,9 +46,9 @@ reducers[ACTIONS.CLEAR_CONTENT_HISTORY_URI] = (state, action) => {
return index === -1
? state
: {
...state,
history: history.slice(0, index).concat(history.slice(index + 1)),
};
...state,
history: history.slice(0, index).concat(history.slice(index + 1)),
};
};
reducers[ACTIONS.CLEAR_CONTENT_HISTORY_ALL] = state => ({ ...state, history: [] });

View file

@ -14,17 +14,6 @@ export const selectPlayingUri = createSelector(
state => state.playingUri
);
export const selectChannelClaimCounts = createSelector(
selectState,
state => state.channelClaimCounts || {}
);
export const makeSelectTotalItemsForChannel = (uri: string) =>
createSelector(
selectChannelClaimCounts,
byUri => byUri && byUri[uri]
);
export const selectRewardContentClaimIds = createSelector(
selectState,
state => state.rewardedContentClaimIds