Revert "improve channel update" #4406

Merged
jessopb merged 1 commit from revert-4405-feat-channelUpdatesPending into master 2020-06-19 19:10:53 +02:00
13 changed files with 2015 additions and 3384 deletions

View file

@ -135,7 +135,7 @@
"imagesloaded": "^4.1.4",
"json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#d00744a8b5474f28553ed8b68ee5400a4ad84b4c",
"lbry-redux": "lbryio/lbry-redux#f8ac5359d9d05fba2c3a536003a9d4c64b86c9f0",
"lbryinc": "lbryio/lbryinc#72eee35f5181940eb4a468a27ddb2a2a4e362fb0",
"lint-staged": "^7.0.2",
"localforage": "^1.7.1",

View file

@ -1199,8 +1199,15 @@
"lbry.tv Premium - 1 month": "lbry.tv Premium - 1 month",
"We will refund no questions asked within 30 days.": "We will refund no questions asked within 30 days.",
"Your Wallet": "Your Wallet",
"Buy": "Buy",
"Buy LBRY Credits": "Buy LBRY Credits",
"Country": "Country",
"Only some countries are eligible at this time. We are working to make this available to everyone.": "Only some countries are eligible at this time. We are working to make this available to everyone.",
"Select your country": "Select your country",
"LBRY, Inc. partners with Moonpay to provide the option to purchase LBC. %learn_more%.": "LBRY, Inc. partners with Moonpay to provide the option to purchase LBC. %learn_more%.",
"Try Anyway": "Try Anyway",
"Purchase Amount": "Purchase Amount",
"Your browser does not support iframes.": "Your browser does not support iframes.",
"Not a valid LBRY address": "Not a valid LBRY address",
"Confirm Tip": "Confirm Tip",
"Supporting": "Supporting",
@ -1223,14 +1230,6 @@
"Sharing information with LBRY, Inc. allows us to report to publishers how their content is doing, as\n well as track basic usage and performance. This is the minimum required to earn rewards from LBRY, Inc.": "Sharing information with LBRY, Inc. allows us to report to publishers how their content is doing, as\n well as track basic usage and performance. This is the minimum required to earn rewards from LBRY, Inc.",
"No information will be sent directly to LBRY, Inc. or third-parties about your usage. Note that as\n peer-to-peer software, your IP address and potentially other system information can be sent to other\n users, though this information is not stored permanently.": "No information will be sent directly to LBRY, Inc. or third-parties about your usage. Note that as\n peer-to-peer software, your IP address and potentially other system information can be sent to other\n users, though this information is not stored permanently.",
"%view_count% Views": "%view_count% Views",
"Buy": "Buy",
"Buy LBRY Credits": "Buy LBRY Credits",
"Country": "Country",
"Only some countries are eligible at this time. We are working to make this available to everyone.": "Only some countries are eligible at this time. We are working to make this available to everyone.",
"Select your country": "Select your country",
"LBRY, Inc. partners with Moonpay to provide the option to purchase LBC. %learn_more%.": "LBRY, Inc. partners with Moonpay to provide the option to purchase LBC. %learn_more%.",
"Your browser does not support iframes.": "Your browser does not support iframes.",
"There was an error. Try %refreshing_the_app_link% to fix it. If that doesn't work, try pressing Ctrl+R/Cmd+R.": "There was an error. Try %refreshing_the_app_link% to fix it. If that doesn't work, try pressing Ctrl+R/Cmd+R.",
"Tap to unmute": "Tap to unmute",
"0 Bytes": "0 Bytes",
"Bytes": "Bytes",
@ -1242,8 +1241,11 @@
"EB": "EB",
"ZB": "ZB",
"YB": "YB",
"Save": "Save",
"Saving...": "Saving...",
"Thanks for the feedback! You help make the app better for everyone.": "Thanks for the feedback! You help make the app better for everyone.",
"Thanks for the feedback. Mark has been notified and is currently walking over to his computer to work on this.": "Thanks for the feedback. Mark has been notified and is currently walking over to his computer to work on this.",
"Changelog": "Changelog",
"Supporting Content Requires LBC": "Supporting Content Requires LBC",
"With LBC, you can send tips to your favorite creators, or help boost their content for more people to see.": "With LBC, you can send tips to your favorite creators, or help boost their content for more people to see.",
"Boost Your Content": "Boost Your Content",
@ -1255,11 +1257,5 @@
"Make this support permanent": "Make this support permanent",
"Custom support amount": "Custom support amount",
"(%lbc_balance% available)": "(%lbc_balance% available)",
"Loading your channels...": "Loading your channels...",
"Changelog": "Changelog",
"Thumbnail source": "Thumbnail source",
"Cover source": "Cover source",
"Save": "Save",
"Saving...": "Saving...",
"Your changes will be live in a few minutes": "Your changes will be live in a few minutes"
"Loading your channels...": "Loading your channels..."
}

View file

@ -31,7 +31,6 @@ function ChannelAbout(props: Props) {
<div className="card">
<section className="section card--section">
<Fragment>
<label>{__('Description')}</label>
{description && (
<div className="media__info-text media__info-text--constrained">
<MarkdownPreview content={description} />

View file

@ -8,7 +8,6 @@ import {
doUpdateChannel,
makeSelectAmountForUri,
makeSelectClaimForUri,
selectUpdateChannelError,
} from 'lbry-redux';
import ChannelPage from './view';
@ -25,7 +24,6 @@ const select = (state, props) => ({
languages: makeSelectMetadataItemForUri(props.uri, 'languages')(state),
amount: makeSelectAmountForUri(props.uri)(state),
claim: makeSelectClaimForUri(props.uri)(state),
updateError: selectUpdateChannelError(state),
});
const perform = dispatch => ({

View file

@ -3,10 +3,10 @@ import React, { useState } from 'react';
import { FormField } from 'component/common/form';
import Button from 'component/button';
import SelectAsset from 'component/selectAsset';
import * as PAGES from 'constants/pages';
import { MINIMUM_PUBLISH_BID } from 'constants/claim';
import TagsSearch from 'component/tagsSearch';
import { FF_MAX_CHARS_IN_DESCRIPTION } from 'constants/form-field';
import ErrorText from 'component/common/error-text';
type Props = {
claim: ChannelClaim,
@ -22,11 +22,10 @@ type Props = {
tags: Array<string>,
locations: Array<string>,
languages: Array<string>,
updateChannel: any => Promise<any>,
updateChannel: any => void,
updateThumb: string => void,
updateCover: string => void,
doneEditing: () => void,
updateError: string,
setEditing: boolean => void,
};
function ChannelForm(props: Props) {
@ -42,11 +41,10 @@ function ChannelForm(props: Props) {
locations,
languages,
amount,
doneEditing,
setEditing,
updateChannel,
updateThumb,
updateCover,
updateError,
} = props;
const { claim_id: claimId } = claim;
@ -103,119 +101,110 @@ function ChannelForm(props: Props) {
};
const handleSubmit = () => {
updateChannel(params).then(success => {
if (success) {
doneEditing();
}
});
updateChannel(params);
setEditing(false);
};
// TODO clear and bail after submit
return (
<div className="card">
<section className={'section card--section'}>
<SelectAsset
onUpdate={v => handleThumbnailChange(v)}
currentValue={params.thumbnailUrl}
assetName={'Thumbnail'}
recommended={__('Recommended ratio is 1:1')}
/>
<section className={'card--section'}>
<SelectAsset
onUpdate={v => handleThumbnailChange(v)}
currentValue={params.thumbnailUrl}
assetName={'Thumbnail'}
recommended={__('Recommended ratio is 1:1')}
/>
<SelectAsset
onUpdate={v => handleCoverChange(v)}
currentValue={params.coverUrl}
assetName={'Cover'}
recommended={__('Recommended ratio is 6.25:1')}
/>
<SelectAsset
onUpdate={v => handleCoverChange(v)}
currentValue={params.coverUrl}
assetName={'Cover'}
recommended={__('Recommended ratio is 6.25:1')}
/>
<FormField
type="text"
name="channel_title2"
label={__('Title')}
placeholder={__('Titular Title')}
disabled={false}
value={params.title}
onChange={e => setParams({ ...params, title: e.target.value })}
/>
<FormField
className="form-field--price-amount"
type="number"
name="content_bid2"
step="any"
label={__('Deposit (LBC)')}
postfix="LBC"
value={params.amount}
error={bidError}
min="0.0"
disabled={false}
onChange={event => handleBidChange(parseFloat(event.target.value))}
placeholder={0.1}
/>
<FormField
type="text"
name="channel_title2"
label={__('Title')}
placeholder={__('Titular Title')}
disabled={false}
value={params.title}
onChange={e => setParams({ ...params, title: e.target.value })}
/>
<FormField
className="form-field--price-amount"
type="number"
name="content_bid2"
step="any"
label={__('Deposit (LBC)')}
postfix="LBC"
value={params.amount}
error={bidError}
min="0.0"
disabled={false}
onChange={event => handleBidChange(parseFloat(event.target.value))}
placeholder={0.1}
/>
<FormField
type="text"
name="channel_website2"
label={__('Website')}
placeholder={__('aprettygoodsite.com')}
disabled={false}
value={params.website}
onChange={e => setParams({ ...params, website: e.target.value })}
/>
<FormField
type="text"
name="channel_website2"
label={__('Website')}
placeholder={__('aprettygoodsite.com')}
disabled={false}
value={params.website}
onChange={e => setParams({ ...params, website: e.target.value })}
/>
<FormField
type="text"
name="content_email2"
label={__('Email')}
placeholder={__('yourstruly@example.com')}
disabled={false}
value={params.email}
onChange={e => setParams({ ...params, email: e.target.value })}
/>
<FormField
type="text"
name="content_email2"
label={__('Email')}
placeholder={__('yourstruly@example.com')}
disabled={false}
value={params.email}
onChange={e => setParams({ ...params, email: e.target.value })}
/>
<FormField
type="markdown"
name="content_description2"
label={__('Description')}
placeholder={__('Description of your content')}
value={params.description}
disabled={false}
onChange={text => setParams({ ...params, description: text })}
textAreaMaxLength={FF_MAX_CHARS_IN_DESCRIPTION}
/>
<FormField
type="markdown"
name="content_description2"
label={__('Description')}
placeholder={__('Description of your content')}
value={params.description}
disabled={false}
onChange={text => setParams({ ...params, description: text })}
textAreaMaxLength={FF_MAX_CHARS_IN_DESCRIPTION}
/>
<TagsSearch
suggestMature
disableAutoFocus
tagsPassedIn={params.tags || []}
label={__('Tags Selected')}
onRemove={clickedTag => {
const newTags = params.tags.slice().filter(tag => tag.name !== clickedTag.name);
setParams({ ...params, tags: newTags });
}}
onSelect={newTags => {
newTags.forEach(newTag => {
if (!params.tags.map(savedTag => savedTag.name).includes(newTag.name)) {
setParams({ ...params, tags: [...params.tags, newTag] });
} else {
// If it already exists and the user types it in, remove it
setParams({ ...params, tags: params.tags.filter(tag => tag.name !== newTag.name) });
}
});
}}
/>
<div className={'section__actions'}>
<Button button="primary" label={__('Submit')} onClick={handleSubmit} />
<Button button="link" label={__('Cancel')} onClick={doneEditing} />
</div>
{updateError && updateError.length ? (
<ErrorText>{updateError}</ErrorText>
) : (
<p className="help">
{__('After submitting, you will not see the changes immediately. Please check back in a few minutes.')}
</p>
)}
</section>
</div>
<TagsSearch
suggestMature
disableAutoFocus
tagsPassedIn={params.tags || []}
label={__('Tags Selected')}
onRemove={clickedTag => {
const newTags = params.tags.slice().filter(tag => tag.name !== clickedTag.name);
setParams({ ...params, tags: newTags });
}}
onSelect={newTags => {
newTags.forEach(newTag => {
if (!params.tags.map(savedTag => savedTag.name).includes(newTag.name)) {
setParams({ ...params, tags: [...params.tags, newTag] });
} else {
// If it already exists and the user types it in, remove it
setParams({ ...params, tags: params.tags.filter(tag => tag.name !== newTag.name) });
}
});
}}
/>
<div className={'section__actions'}>
<Button button="primary" label={__('Submit')} onClick={handleSubmit} />
<Button button="link" label={__('Cancel')} navigate={`$/${PAGES.CHANNELS}`} />
</div>
<p className="help">
{__('After submitting, you will not see the changes immediately. Please check back in a few minutes.')}
</p>
</section>
);
}

View file

@ -8,15 +8,14 @@ type Props = {
doOpenModal: (string, {}) => void,
claim: StreamClaim,
abandonActionCallback: any => void,
iconSize: number,
};
export default function ClaimAbandonButton(props: Props) {
const { doOpenModal, claim, abandonActionCallback, iconSize } = props;
const { doOpenModal, claim, abandonActionCallback } = props;
function abandonClaim() {
doOpenModal(MODALS.CONFIRM_CLAIM_REVOKE, { claim: claim, cb: abandonActionCallback });
}
return <Button disabled={!claim} button="alt" iconSize={iconSize} icon={ICONS.DELETE} onClick={abandonClaim} />;
return <Button button="secondary" icon={ICONS.DELETE} onClick={abandonClaim} />;
}

View file

@ -61,7 +61,7 @@ function ClaimPreviewTile(props: Props) {
const isRepost = claim && claim.repost_channel_url;
const shouldFetch = claim === undefined;
const thumbnailUrl = useGetThumbnail(uri, claim, streamingUrl, getFile, placeholder) || thumbnail;
const claimsInChannel = (claim && claim.meta && claim.meta.claims_in_channel) || 0;
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
const canonicalUrl = claim && claim.canonical_url;
const navigateUrl = formatLbryUrlForWeb(canonicalUrl || uri || '/');

View file

@ -7,7 +7,6 @@ import {
selectCurrentChannelPage,
makeSelectClaimForUri,
selectChannelIsBlocked,
makeSelectClaimIsPending,
} from 'lbry-redux';
import { selectBlackListedOutpoints, doFetchSubCount, makeSelectSubCountForUri } from 'lbryinc';
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
@ -24,7 +23,6 @@ const select = (state, props) => ({
channelIsBlocked: selectChannelIsBlocked(props.uri)(state),
blackListedOutpoints: selectBlackListedOutpoints(state),
subCount: makeSelectSubCountForUri(props.uri)(state),
pending: makeSelectClaimIsPending(props.uri)(state),
});
const perform = dispatch => ({

View file

@ -46,7 +46,6 @@ type Props = {
}>,
fetchSubCount: string => void,
subCount: number,
pending: boolean,
};
function ChannelPage(props: Props) {
@ -65,7 +64,6 @@ function ChannelPage(props: Props) {
blackListedOutpoints,
fetchSubCount,
subCount,
pending,
} = props;
const { channelName } = parseURI(uri);
@ -100,12 +98,6 @@ function ChannelPage(props: Props) {
history.push(`${url}${search}`);
}
function doneEditing() {
setEditing(false);
setThumbPreview(thumbnail);
setCoverPreview(cover);
}
useEffect(() => {
Lbryio.call('yt', 'get_youtuber', { channel_claim_id: claimId }).then(response => {
if (response.is_verified_youtuber) {
@ -184,27 +176,11 @@ function ChannelPage(props: Props) {
<HelpLink href="https://lbry.com/faq/views" />
</span>
{channelIsMine && !editing && (
<>
{pending ? (
<span>{__('Your changes will be live in a few minutes')}</span>
) : (
<Button
button="alt"
title={__('Edit')}
onClick={() => setEditing(!editing)}
icon={ICONS.EDIT}
iconSize={18}
disabled={pending}
/>
)}
</>
)}
{channelIsMine && editing && (
<Button
button="alt"
title={__('Cancel')}
onClick={() => doneEditing()}
icon={ICONS.REMOVE}
title={__('Edit')}
onClick={() => setEditing(!editing)}
icon={ICONS.EDIT}
iconSize={18}
/>
)}
@ -227,7 +203,7 @@ function ChannelPage(props: Props) {
{editing ? (
<ChannelEdit
uri={uri}
doneEditing={doneEditing}
setEditing={setEditing}
updateThumb={v => setThumbPreview(v)}
updateCover={v => setCoverPreview(v)}
/>

View file

@ -1,16 +1,10 @@
import { connect } from 'react-redux';
import {
selectMyChannelClaims,
selectMyChannelUrls,
doFetchChannelListMine,
selectFetchingMyChannels,
} from 'lbry-redux';
import { selectMyChannelClaims, doFetchChannelListMine, selectFetchingMyChannels } from 'lbry-redux';
import { selectYoutubeChannels } from 'redux/selectors/user';
import { doOpenModal } from 'redux/actions/app';
import ChannelsPage from './view';
const select = state => ({
channelUrls: selectMyChannelUrls(state),
channels: selectMyChannelClaims(state),
fetchingChannels: selectFetchingMyChannels(state),
youtubeChannels: selectYoutubeChannels(state),

View file

@ -11,7 +11,6 @@ import Card from 'component/common/card';
type Props = {
channels: Array<ChannelClaim>,
channelUrls: Array<string>,
fetchChannelListMine: () => void,
fetchingChannels: boolean,
youtubeChannels: ?Array<any>,
@ -19,19 +18,30 @@ type Props = {
};
export default function ChannelsPage(props: Props) {
const { channels, channelUrls, fetchChannelListMine, fetchingChannels, youtubeChannels, openModal } = props;
const { channels, fetchChannelListMine, fetchingChannels, youtubeChannels, openModal } = props;
const hasYoutubeChannels = youtubeChannels && Boolean(youtubeChannels.length);
const hasPendingChannels = channels && channels.some(channel => channel.confirmations < 0);
useEffect(() => {
fetchChannelListMine();
let interval;
if (hasPendingChannels) {
interval = setInterval(() => {
fetchChannelListMine();
}, 5000);
}
return () => {
clearInterval(interval);
};
}, [fetchChannelListMine, hasPendingChannels]);
return (
<Page>
{hasYoutubeChannels && <YoutubeTransferStatus hideChannelLink />}
{channelUrls && Boolean(channelUrls.length) && (
{channels && Boolean(channels.length) && (
<Card
title={__('Your Channels')}
titleActions={
@ -43,10 +53,12 @@ export default function ChannelsPage(props: Props) {
/>
}
isBodyList
body={<ClaimList isCardBody loading={fetchingChannels} uris={channelUrls} />}
body={
<ClaimList isCardBody loading={fetchingChannels} uris={channels.map(channel => channel.permanent_url)} />
}
/>
)}
{!(channelUrls && channelUrls.length) && (
{!(channels && channels.length) && (
<React.Fragment>
{!fetchingChannels ? (
<section className="main--empty">

View file

@ -6,7 +6,7 @@ import {
batchActions,
selectMyClaims,
doPublish,
doCheckPendingClaims,
doCheckPendingPublishes,
doCheckReflectingFiles,
ACTIONS as LBRY_REDUX_ACTIONS,
} from 'lbry-redux';
@ -101,5 +101,5 @@ export const doCheckPendingPublishesApp = () => (dispatch: Dispatch, getState: G
};
}
};
return dispatch(doCheckPendingClaims(onConfirmed));
return dispatch(doCheckPendingPublishes(onConfirmed));
};

5086
yarn.lock

File diff suppressed because it is too large Load diff