ui pieces in place and enabled

This commit is contained in:
jessop 2019-09-16 15:28:30 -04:00 committed by Sean Yesmunt
parent e52d78d63e
commit a54fb12525
4 changed files with 60 additions and 35 deletions

View file

@ -1,6 +1,5 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
// fetchUserInfo import { selectYoutubeChannels, doClaimYoutubeChannels, doUserFetch } from 'lbryinc';
import { selectYoutubeChannels } from 'lbryinc';
import YoutubeChannelList from './view'; import YoutubeChannelList from './view';
@ -8,15 +7,12 @@ const select = state => ({
ytChannels: selectYoutubeChannels(state), ytChannels: selectYoutubeChannels(state),
}); });
// const perform = dispatch => ({ const perform = dispatch => ({
// claimChannels: () => dispatch(doTransfer) claimChannels: () => dispatch(doClaimYoutubeChannels()),
// }); updateUser: () => dispatch(doUserFetch()),
});
/*
*/
export default connect( export default connect(
select, select,
null perform
)(YoutubeChannelList); )(YoutubeChannelList);

View file

@ -20,24 +20,29 @@ export default function YoutubeChannelItem(props: Props) {
const { const {
yt_channel_name: ytName, yt_channel_name: ytName,
lbry_channel_name: lbryName, lbry_channel_name: lbryName,
channel_claim_id: claimId,
sync_status: syncStatus, sync_status: syncStatus,
status_token: statusToken, status_token: statusToken,
transferable, transferable,
transfer_state: transferState, transfer_state: transferState,
publish_to_address: publishAddresses,
} = props.channel; } = props.channel;
const LbryYtUrl = 'https://lbry.com/youtube/status/';
// <thead> const LBRY_YT_URL = 'https://lbry.com/youtube/status/';
// <tr> const NOT_TRANSFERED = 'not_transferred';
// <th>{__('Youtube Name')}</th> const PENDING_TRANSFER = 'pending_transfer';
// <th>{__('LBRY Name')} </th> const COMPLETED_TRANSFER = 'completed_transfer';
// <th>{__('Sync Status')} </th>
// <th>{__('Transfer Status')}</th> function renderSwitch(param) {
// </tr> switch (param) {
// </thead> case NOT_TRANSFERED:
const doTransfer = () => {}; return __('Not Transferred');
case PENDING_TRANSFER:
return __('Pending Transfer');
case COMPLETED_TRANSFER:
return __('Completed Transfer');
}
}
// | Youtube Name | LBRY Name | SyncStatus | TransferStatus |
return ( return (
<tr> <tr>
@ -46,13 +51,9 @@ export default function YoutubeChannelItem(props: Props) {
<Button button={'link'} navigate={`lbry://${lbryName}`} label={lbryName} /> <Button button={'link'} navigate={`lbry://${lbryName}`} label={lbryName} />
</td> </td>
<td> <td>
<Button button={'link'} href={`${LbryYtUrl}${statusToken}`} label={syncStatus} /> <Button button={'link'} href={`${LBRY_YT_URL}${statusToken}`} label={syncStatus} />
</td>
<td>{claimId}</td>
<td>
{transferable && <Button button={'link'} onClick={doTransfer} label={'Claim It'} />}
{!transferable && transferState}
</td> </td>
<td>{transferable ? renderSwitch(transferState) : __('Not Transferable')}</td>
</tr> </tr>
); );
} }

View file

@ -1,21 +1,45 @@
// @flow // @flow
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';
type Props = {
ytChannels: Array<any>,
claimChannels: () => void,
updateUser: () => void,
};
export default function YoutubeChannelList(props: Props) { export default function YoutubeChannelList(props: Props) {
const { ytChannels } = props; const { ytChannels, claimChannels, updateUser } = props;
const hasChannels = ytChannels && ytChannels.length;
const transferEnabled = ytChannels && ytChannels.some(el => el.transferable === true);
return ( return (
ytChannels && hasChannels && (
ytChannels.length && (
<section className="card card--section"> <section className="card card--section">
<h2 className="card__title">Channels</h2> <h2 className="card__title--between">
<p className="card__subtitle">You got em</p> <span>Synced Youtube Channels</span>
<div className="card__actions--inline">
<Button button="inverse" onClick={updateUser} label={__('Refresh')} />
</div>
</h2>
{transferEnabled && !IS_WEB && (
<p className="card__subtitle">LBRY is currently holding channels you can take control of.</p>
)}
{!transferEnabled && !IS_WEB && (
<p className="card__subtitle">LBRY is currently holding channels but none are ready for transfer yet.</p>
)}
{IS_WEB && (
<p className="card__subtitle">
{__(`LBRY.tv can't import accounts yet. `)}
<Button button="link" label={__('Download the app')} href="https://lbry.com/get" />
</p>
)}
<table className="table"> <table className="table">
<thead> <thead>
<tr> <tr>
<th>{__('Youtube Name')}</th> <th>{__('Youtube Name')}</th>
<th>{__('LBRY Name')} </th> <th>{__('LBRY Name')} </th>
<th>{__('Sync Status')} </th> <th>{__('Sync Status')} </th>
<th>{__('Channel ClaimId')}</th>
<th>{__('Transfer Status')}</th> <th>{__('Transfer Status')}</th>
</tr> </tr>
</thead> </thead>
@ -28,6 +52,10 @@ export default function YoutubeChannelList(props: Props) {
))} ))}
</tbody> </tbody>
</table> </table>
<div className="card__actions">
<Button disabled={IS_WEB} button="primary" onClick={claimChannels} label={__('Claim Channels')} />
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/youtube#transfer" />
</div>
</section> </section>
) )
); );