lbry-desktop/ui/page/creatorDashboard/view.jsx

50 lines
1.4 KiB
React
Raw Permalink Normal View History

2020-03-18 18:11:37 +01:00
// @flow
import * as PAGES from 'constants/pages';
2020-03-18 18:11:37 +01:00
import React from 'react';
import Page from 'component/page';
import Spinner from 'component/spinner';
2020-03-18 22:14:11 +01:00
import Button from 'component/button';
import CreatorAnalytics from 'component/creatorAnalytics';
2020-04-22 21:07:38 +02:00
import ChannelSelector from 'component/channelSelector';
import Yrbl from 'component/yrbl';
2020-03-18 18:11:37 +01:00
type Props = {
channels: Array<ChannelClaim>,
2020-03-18 22:14:11 +01:00
fetchingChannels: boolean,
activeChannelClaim: ?ChannelClaim,
2020-03-18 18:11:37 +01:00
};
export default function CreatorDashboardPage(props: Props) {
const { channels, fetchingChannels, activeChannelClaim } = props;
2020-04-22 21:07:38 +02:00
const hasChannels = channels && channels.length > 0;
2020-03-18 18:11:37 +01:00
return (
<Page>
2020-03-18 22:14:11 +01:00
{fetchingChannels && (
2020-03-18 18:11:37 +01:00
<div className="main--empty">
<Spinner delayed />
</div>
)}
{!fetchingChannels && !hasChannels && (
<Yrbl
type="happy"
title={__("You haven't created a channel yet, let's fix that!")}
2020-09-02 22:08:37 +02:00
actions={
<div className="section__actions">
<Button button="primary" navigate={`/$/${PAGES.CHANNEL_NEW}`} label={__('Create A Channel')} />
2020-03-18 22:14:11 +01:00
</div>
}
/>
2020-03-18 18:11:37 +01:00
)}
2020-03-18 22:14:11 +01:00
{!fetchingChannels && activeChannelClaim && (
2020-04-22 21:07:38 +02:00
<React.Fragment>
2021-06-14 19:19:03 +02:00
<ChannelSelector hideAnon />
<CreatorAnalytics uri={activeChannelClaim.canonical_url} />
2020-04-22 21:07:38 +02:00
</React.Fragment>
)}
2020-03-18 18:11:37 +01:00
</Page>
);
}