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, "standard/no-callback-literal": 0,
"comma-dangle": ["error", "always-multiline"], "comma-dangle": ["error", "always-multiline"],
"space-before-function-paren": ["error", "never"], "space-before-function-paren": ["error", "never"],
"jsx-quotes": ["error", "prefer-double"],
"semi": [ "semi": [
"error", "error",
"always", "always",

View file

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

View file

@ -1,7 +1,11 @@
import { connect } from 'react-redux'; 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 { doNavigate } from 'redux/actions/navigation';
import { makeSelectTotalItemsForChannel } from 'redux/selectors/content';
import ChannelTile from './view'; import ChannelTile from './view';
const select = (state, props) => ({ 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_STARTED = 'FETCH_CHANNEL_CLAIMS_STARTED';
export const FETCH_CHANNEL_CLAIMS_COMPLETED = 'FETCH_CHANNEL_CLAIMS_COMPLETED'; 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_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_STARTED = 'FETCH_CLAIM_LIST_MINE_STARTED';
export const FETCH_CLAIM_LIST_MINE_COMPLETED = 'FETCH_CLAIM_LIST_MINE_COMPLETED'; export const FETCH_CLAIM_LIST_MINE_COMPLETED = 'FETCH_CLAIM_LIST_MINE_COMPLETED';
export const ABANDON_CLAIM_STARTED = 'ABANDON_CLAIM_STARTED'; 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__actions media__actions--between">
<div className="media__action-group--large"> <div className="media__action-group--large">
{claimIsMine ? ( {claimIsMine && (
<Button <Button
button="primary" button="primary"
icon={icons.EDIT} icon={icons.EDIT}
@ -236,16 +236,18 @@ class FilePage extends React.Component<Props> {
navigate('/publish'); navigate('/publish');
}} }}
/> />
) : (
<SubscribeButton uri={channelUri} channelName={channelName} />
)} )}
{!claimIsMine && ( {!claimIsMine && (
<Button <React.Fragment>
button="alt" {channelUri && <SubscribeButton uri={channelUri} channelName={channelName} />}
icon={icons.TIP}
label={__('Send a tip')} <Button
onClick={() => openModal(MODALS.SEND_TIP, { uri })} button="alt"
/> icon={icons.TIP}
label={__('Send a tip')}
onClick={() => openModal(MODALS.SEND_TIP, { uri })}
/>
</React.Fragment>
)} )}
<Button <Button
button="alt" button="alt"

View file

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

View file

@ -14,17 +14,6 @@ export const selectPlayingUri = createSelector(
state => state.playingUri 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( export const selectRewardContentClaimIds = createSelector(
selectState, selectState,
state => state.rewardedContentClaimIds state => state.rewardedContentClaimIds