mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-29 16:31:33 +00:00
pending, loading spinner
This commit is contained in:
parent
a54fb12525
commit
a8daecacf6
2 changed files with 20 additions and 4 deletions
|
@ -1,10 +1,18 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { selectYoutubeChannels, doClaimYoutubeChannels, doUserFetch } from 'lbryinc';
|
import {
|
||||||
|
selectYoutubeChannels,
|
||||||
|
selectYTImportPending,
|
||||||
|
selectUserIsPending,
|
||||||
|
doClaimYoutubeChannels,
|
||||||
|
doUserFetch,
|
||||||
|
} from 'lbryinc';
|
||||||
|
|
||||||
import YoutubeChannelList from './view';
|
import YoutubeChannelList from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
ytChannels: selectYoutubeChannels(state),
|
ytChannels: selectYoutubeChannels(state),
|
||||||
|
ytImportPending: selectYTImportPending(state),
|
||||||
|
userFetchPending: selectUserIsPending(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
|
|
@ -2,22 +2,25 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import YoutubeChannelListItem from './internal/youtubeChannel';
|
import YoutubeChannelListItem from './internal/youtubeChannel';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
|
import Spinner from 'component/spinner';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
ytChannels: Array<any>,
|
ytChannels: Array<any>,
|
||||||
|
ytImportPending: boolean,
|
||||||
|
userFetchPending: boolean,
|
||||||
claimChannels: () => void,
|
claimChannels: () => void,
|
||||||
updateUser: () => void,
|
updateUser: () => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function YoutubeChannelList(props: Props) {
|
export default function YoutubeChannelList(props: Props) {
|
||||||
const { ytChannels, claimChannels, updateUser } = props;
|
const { ytChannels, ytImportPending, userFetchPending, claimChannels, updateUser } = props;
|
||||||
const hasChannels = ytChannels && ytChannels.length;
|
const hasChannels = ytChannels && ytChannels.length;
|
||||||
const transferEnabled = ytChannels && ytChannels.some(el => el.transferable === true);
|
const transferEnabled = ytChannels && ytChannels.some(el => el.transferable === true);
|
||||||
return (
|
return (
|
||||||
hasChannels && (
|
hasChannels && (
|
||||||
<section className="card card--section">
|
<section className="card card--section">
|
||||||
<h2 className="card__title--between">
|
<h2 className="card__title--between">
|
||||||
<span>Synced Youtube Channels</span>
|
<span>Synced Youtube Channels{userFetchPending && <Spinner type="small" />}</span>
|
||||||
<div className="card__actions--inline">
|
<div className="card__actions--inline">
|
||||||
<Button button="inverse" onClick={updateUser} label={__('Refresh')} />
|
<Button button="inverse" onClick={updateUser} label={__('Refresh')} />
|
||||||
</div>
|
</div>
|
||||||
|
@ -53,7 +56,12 @@ export default function YoutubeChannelList(props: Props) {
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div className="card__actions">
|
<div className="card__actions">
|
||||||
<Button disabled={IS_WEB} button="primary" onClick={claimChannels} label={__('Claim Channels')} />
|
<Button
|
||||||
|
disabled={IS_WEB || !transferEnabled || ytImportPending}
|
||||||
|
button="primary"
|
||||||
|
onClick={claimChannels}
|
||||||
|
label={__('Claim Channels')}
|
||||||
|
/>
|
||||||
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/youtube#transfer" />
|
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/youtube#transfer" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
Loading…
Add table
Reference in a new issue