Handle remaining usages of MarkdownPreview

- Channel About
  - description: seems handy to have a preview, so pulled in the "allowed" logic.
  - email: shouldn't render preview at all
  - website: shouldn't render preview at all

- Publish Preview:
  - description: there's not enough height anyway, so don't render preview.
This commit is contained in:
infinite-persistence 2021-03-09 22:04:49 +08:00 committed by Sean Yesmunt
parent 0d850742f5
commit 469e9cddc0
3 changed files with 10 additions and 8 deletions

View file

@ -1,9 +1,10 @@
import { connect } from 'react-redux';
import { makeSelectMetadataItemForUri, makeSelectClaimForUri } from 'lbry-redux';
import { makeSelectMetadataItemForUri, makeSelectClaimForUri, makeSelectStakedLevelForChannelUri } from 'lbry-redux';
import ChannelAbout from './view';
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
stakedLevel: makeSelectStakedLevelForChannelUri(props.uri)(state),
description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
website: makeSelectMetadataItemForUri(props.uri, 'website_url')(state),
email: makeSelectMetadataItemForUri(props.uri, 'email')(state),

View file

@ -17,6 +17,7 @@ type Props = {
email: ?string,
website: ?string,
languages: Array<string>,
stakedLevel?: number,
};
const formatEmail = (email: string) => {
@ -29,7 +30,7 @@ const formatEmail = (email: string) => {
};
function ChannelAbout(props: Props) {
const { claim, uri, description, email, website, languages } = props;
const { claim, uri, description, email, website, languages, stakedLevel } = props;
const claimId = claim && claim.claim_id;
return (
@ -40,7 +41,7 @@ function ChannelAbout(props: Props) {
<>
<label>{__('Description')}</label>
<div className="media__info-text media__info-text--constrained">
<MarkdownPreview content={description} />
<MarkdownPreview content={description} stakedLevel={stakedLevel} />
</div>
</>
)}
@ -48,7 +49,7 @@ function ChannelAbout(props: Props) {
<Fragment>
<label>{__('Contact')}</label>
<div className="media__info-text">
<MarkdownPreview content={formatEmail(email)} />
<MarkdownPreview content={formatEmail(email)} simpleLinks />
</div>
</Fragment>
)}
@ -56,7 +57,7 @@ function ChannelAbout(props: Props) {
<Fragment>
<label>{__('Site')}</label>
<div className="media__info-text">
<MarkdownPreview content={website} />
<MarkdownPreview content={website} simpleLinks />
</div>
</Fragment>
)}

View file

@ -34,7 +34,7 @@ type Props = {
publish: (?string, ?boolean) => void,
closeModal: () => void,
enablePublishPreview: boolean,
setEnablePublishPreview: boolean => void,
setEnablePublishPreview: (boolean) => void,
isStillEditing: boolean,
};
@ -105,7 +105,7 @@ class ModalPublishPreview extends React.PureComponent<Props> {
const descriptionValue = description ? (
<div className="media__info-text-preview">
<MarkdownPreview content={description} />
<MarkdownPreview content={description} simpleLinks />
</div>
) : null;
@ -124,7 +124,7 @@ class ModalPublishPreview extends React.PureComponent<Props> {
const tagsValue =
// Do nothing for onClick(). Setting to 'null' results in "View Tag" action -- we don't want to leave the modal.
tags.map(tag => <Tag key={tag.name} title={tag.name} name={tag.name} type={'flow'} onClick={() => {}} />);
tags.map((tag) => <Tag key={tag.name} title={tag.name} name={tag.name} type={'flow'} onClick={() => {}} />);
const depositValue = bid ? <LbcSymbol postfix={`${bid}`} size={14} /> : <p>---</p>;