style cleanup

This commit is contained in:
Sean Yesmunt 2021-03-15 10:58:21 -04:00 committed by DispatchCommit
parent 874188a973
commit 3aead19b47
4 changed files with 110 additions and 104 deletions

View file

@ -10,10 +10,11 @@ type Props = {
doToast: ({ message: string }) => void, doToast: ({ message: string }) => void,
label?: string, label?: string,
primaryButton?: boolean, primaryButton?: boolean,
name?: string,
}; };
export default function CopyableText(props: Props) { export default function CopyableText(props: Props) {
const { copyable, doToast, snackMessage, label, primaryButton = false } = props; const { copyable, doToast, snackMessage, label, primaryButton = false, name } = props;
const input = useRef(); const input = useRef();
@ -38,6 +39,7 @@ export default function CopyableText(props: Props) {
type="text" type="text"
className="form-field--copyable" className="form-field--copyable"
readOnly readOnly
name={name}
label={label} label={label}
value={copyable || ''} value={copyable || ''}
ref={input} ref={input}

View file

@ -36,7 +36,7 @@ import PasswordResetPage from 'page/passwordReset';
import PasswordSetPage from 'page/passwordSet'; import PasswordSetPage from 'page/passwordSet';
import SignInVerifyPage from 'page/signInVerify'; import SignInVerifyPage from 'page/signInVerify';
import ChannelsPage from 'page/channels'; import ChannelsPage from 'page/channels';
import LiveStreamPage from 'page/livestream'; import LiveStreamSetupPage from 'page/livestreamSetup';
import EmbedWrapperPage from 'page/embedWrapper'; import EmbedWrapperPage from 'page/embedWrapper';
import TopPage from 'page/top'; import TopPage from 'page/top';
import Welcome from 'page/welcome'; import Welcome from 'page/welcome';
@ -276,7 +276,7 @@ function AppRouter(props: Props) {
<PrivateRoute {...props} path={`/$/${PAGES.SETTINGS_BLOCKED_MUTED}`} component={ListBlockedPage} /> <PrivateRoute {...props} path={`/$/${PAGES.SETTINGS_BLOCKED_MUTED}`} component={ListBlockedPage} />
<PrivateRoute {...props} path={`/$/${PAGES.WALLET}`} exact component={WalletPage} /> <PrivateRoute {...props} path={`/$/${PAGES.WALLET}`} exact component={WalletPage} />
<PrivateRoute {...props} path={`/$/${PAGES.CHANNELS}`} component={ChannelsPage} /> <PrivateRoute {...props} path={`/$/${PAGES.CHANNELS}`} component={ChannelsPage} />
<PrivateRoute {...props} path={`/$/${PAGES.LIVESTREAM}`} component={LiveStreamPage} /> <PrivateRoute {...props} path={`/$/${PAGES.LIVESTREAM}`} component={LiveStreamSetupPage} />
<PrivateRoute {...props} path={`/$/${PAGES.BUY}`} component={BuyPage} /> <PrivateRoute {...props} path={`/$/${PAGES.BUY}`} component={BuyPage} />
<PrivateRoute {...props} path={`/$/${PAGES.NOTIFICATIONS}`} component={NotificationsPage} /> <PrivateRoute {...props} path={`/$/${PAGES.NOTIFICATIONS}`} component={NotificationsPage} />
<PrivateRoute {...props} path={`/$/${PAGES.AUTH_WALLET_PASSWORD}`} component={SignInWalletPasswordPage} /> <PrivateRoute {...props} path={`/$/${PAGES.AUTH_WALLET_PASSWORD}`} component={SignInWalletPasswordPage} />

View file

@ -1,5 +1,6 @@
// @flow // @flow
import * as PAGES from 'constants/pages'; import * as PAGES from 'constants/pages';
import * as PUBLISH_MODES from 'constants/publish_types';
import React from 'react'; import React from 'react';
import Page from 'component/page'; import Page from 'component/page';
import Spinner from 'component/spinner'; import Spinner from 'component/spinner';
@ -10,7 +11,10 @@ import { Lbry } from 'lbry-redux';
import { toHex } from 'util/hex'; import { toHex } from 'util/hex';
import ClaimPreview from 'component/claimPreview'; import ClaimPreview from 'component/claimPreview';
import { FormField } from 'component/common/form'; import { FormField } from 'component/common/form';
import * as PUBLISH_MODES from 'constants/publish_types'; import CopyableText from 'component/copyableText';
import Card from 'component/common/card';
import ClaimList from 'component/claimList';
import livestream from '../livestream';
type Props = { type Props = {
channels: Array<ChannelClaim>, channels: Array<ChannelClaim>,
@ -62,7 +66,6 @@ export default function LivestreamSetupPage(props: Props) {
const [isFetching, setIsFetching] = React.useState(true); const [isFetching, setIsFetching] = React.useState(true);
const [isLive, setIsLive] = React.useState(false); const [isLive, setIsLive] = React.useState(false);
const [livestreamClaim, setLivestreamClaim] = React.useState(false);
const [livestreamClaims, setLivestreamClaims] = React.useState([]); const [livestreamClaims, setLivestreamClaims] = React.useState([]);
React.useEffect(() => { React.useEffect(() => {
@ -78,7 +81,6 @@ export default function LivestreamSetupPage(props: Props) {
.then((res) => { .then((res) => {
if (res && res.items && res.items.length > 0) { if (res && res.items && res.items.length > 0) {
const claim = res.items[res.items.length - 1]; const claim = res.items[res.items.length - 1];
setLivestreamClaim(claim);
setLivestreamClaims(res.items.reverse()); setLivestreamClaims(res.items.reverse());
} else { } else {
setIsFetching(false); setIsFetching(false);
@ -109,58 +111,55 @@ export default function LivestreamSetupPage(props: Props) {
/> />
)} )}
<div className="card-stack">
{!fetchingChannels && activeChannelClaim && ( {!fetchingChannels && activeChannelClaim && (
<React.Fragment> <>
{/* Channel Selector */}
<ChannelSelector hideAnon /> <ChannelSelector hideAnon />
{/* Display StreamKey */} {streamKey && livestreamClaims.length > 0 && (
{streamKey ? ( <Card
<div> title={__('Your stream key')}
{/* Stream Server Address */} actions={
<FormField <>
name={'livestreamServer'} <CopyableText
label={'Stream Server'} primaryButton
type={'text'} name="stream-server"
defaultValue={'rtmp://stream.odysee.com/live'} label={__('Stream server')}
readOnly copyable="rtmp://stream.odysee.com/live"
snackMessage={__('Copied')}
/>
<CopyableText
primaryButton
name="livestream-key"
label={__('Stream key')}
copyable={streamKey}
snackMessage={__('Copied')}
/>
</>
}
/> />
{/* Stream Key */}
<FormField name={'livestreamKey'} label={'Stream Key'} type={'text'} defaultValue={streamKey} readOnly />
</div>
) : (
<div>
<div style={{ marginBottom: 'var(--spacing-l)' }}>{JSON.stringify(activeChannelClaim)}</div>
{sigData && <div>{JSON.stringify(sigData)}</div>}
</div>
)} )}
{/* Stream Claim(s) */} {livestreamClaims.length > 0 ? (
{livestreamClaim && livestreamClaims ? ( <ClaimList
<div style={{ marginTop: 'var(--spacing-l)' }}> header={__('Your livestream uploads')}
<h3>Your LiveStream Claims</h3> uris={livestreamClaims.map((claim) => claim.permanent_url)}
/>
{livestreamClaims.map((claim) => (
<ClaimPreview key={claim.uri} uri={claim.permanent_url} />
))}
{/*<h3>Your LiveStream Claims</h3>
<ClaimPreview
uri={livestreamClaim.permanent_url}
/>*/}
</div>
) : ( ) : (
<div style={{ marginTop: 'var(--spacing-l)' }}> <Yrbl
<div>You must first publish a livestream claim before your stream will be visible!</div> className="livestream__publish-intro"
title={__('No livestream publishes found')}
{/* Relies on https://github.com/lbryio/lbry-desktop/pull/5669 */} subtitle={__('You need to upload your livestream details before you can go live.')}
actions={
<div className="section__actions">
<Button <Button
button="primary" button="primary"
navigate={`/$/${PAGES.UPLOAD}?type=${PUBLISH_MODES.LIVESTREAM.toLowerCase()}`} navigate={`/$/${PAGES.UPLOAD}?type=${PUBLISH_MODES.LIVESTREAM.toLowerCase()}`}
label={__('Create A LiveStream')} label={__('Create A Livestream')}
/> />
</div> </div>
}
/>
)} )}
{/* Debug Stuff */} {/* Debug Stuff */}
@ -214,8 +213,9 @@ export default function LivestreamSetupPage(props: Props) {
/> />
</div> </div>
)} )}
</React.Fragment> </>
)} )}
</div>
</Page> </Page>
); );
} }

View file

@ -196,3 +196,7 @@
display: inline-block; display: inline-block;
} }
} }
.livestream__publish-intro {
margin-top: var(--spacing-l);
}