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,113 +111,111 @@ export default function LivestreamSetupPage(props: Props) {
/> />
)} )}
{!fetchingChannels && activeChannelClaim && ( <div className="card-stack">
<React.Fragment> {!fetchingChannels && activeChannelClaim && (
{/* 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 */} {livestreamClaims.length > 0 ? (
<FormField name={'livestreamKey'} label={'Stream Key'} type={'text'} defaultValue={streamKey} readOnly /> <ClaimList
</div> header={__('Your livestream uploads')}
) : ( uris={livestreamClaims.map((claim) => claim.permanent_url)}
<div>
<div style={{ marginBottom: 'var(--spacing-l)' }}>{JSON.stringify(activeChannelClaim)}</div>
{sigData && <div>{JSON.stringify(sigData)}</div>}
</div>
)}
{/* Stream Claim(s) */}
{livestreamClaim && livestreamClaims ? (
<div style={{ marginTop: 'var(--spacing-l)' }}>
<h3>Your LiveStream Claims</h3>
{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)' }}>
<div>You must first publish a livestream claim before your stream will be visible!</div>
{/* Relies on https://github.com/lbryio/lbry-desktop/pull/5669 */}
<Button
button="primary"
navigate={`/$/${PAGES.UPLOAD}?type=${PUBLISH_MODES.LIVESTREAM.toLowerCase()}`}
label={__('Create A LiveStream')}
/> />
</div> ) : (
)} <Yrbl
className="livestream__publish-intro"
{/* Debug Stuff */} title={__('No livestream publishes found')}
{streamKey && false && ( subtitle={__('You need to upload your livestream details before you can go live.')}
<div style={{ marginTop: 'var(--spacing-l)' }}> actions={
<h3>Debug Info</h3> <div className="section__actions">
<Button
{/* Channel ID */} button="primary"
<FormField navigate={`/$/${PAGES.UPLOAD}?type=${PUBLISH_MODES.LIVESTREAM.toLowerCase()}`}
name={'channelId'} label={__('Create A Livestream')}
label={'Channel ID'} />
type={'text'} </div>
defaultValue={activeChannelClaim.claim_id} }
readOnly
/> />
)}
{/* Signature */} {/* Debug Stuff */}
<FormField {streamKey && false && (
name={'signature'} <div style={{ marginTop: 'var(--spacing-l)' }}>
label={'Signature'} <h3>Debug Info</h3>
type={'text'}
defaultValue={sigData.signature}
readOnly
/>
{/* Signature TS */} {/* Channel ID */}
<FormField <FormField
name={'signaturets'} name={'channelId'}
label={'Signature Timestamp'} label={'Channel ID'}
type={'text'} type={'text'}
defaultValue={sigData.signing_ts} defaultValue={activeChannelClaim.claim_id}
readOnly readOnly
/> />
{/* Hex Data */} {/* Signature */}
<FormField <FormField
name={'datahex'} name={'signature'}
label={'Hex Data'} label={'Signature'}
type={'text'} type={'text'}
defaultValue={toHex(activeChannelClaim.name)} defaultValue={sigData.signature}
readOnly readOnly
/> />
{/* Channel Public Key */} {/* Signature TS */}
<FormField <FormField
name={'channelpublickey'} name={'signaturets'}
label={'Public Key'} label={'Signature Timestamp'}
type={'text'} type={'text'}
defaultValue={activeChannelClaim.value.public_key} defaultValue={sigData.signing_ts}
readOnly readOnly
/> />
</div>
)} {/* Hex Data */}
</React.Fragment> <FormField
)} name={'datahex'}
label={'Hex Data'}
type={'text'}
defaultValue={toHex(activeChannelClaim.name)}
readOnly
/>
{/* Channel Public Key */}
<FormField
name={'channelpublickey'}
label={'Public Key'}
type={'text'}
defaultValue={activeChannelClaim.value.public_key}
readOnly
/>
</div>
)}
</>
)}
</div>
</Page> </Page>
); );
} }

View file

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