Merge pull request #1233 from miikkatu/obscure-nsfw-content-title

Obscure NSFW content title
This commit is contained in:
Sean Yesmunt 2018-04-10 16:14:16 -04:00 committed by GitHub
commit 82f2fbd643
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,19 +1,17 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import { normalizeURI } from 'lbryURI'; import { normalizeURI } from 'lbryURI';
import Button from 'component/button';
import CardMedia from 'component/cardMedia'; import CardMedia from 'component/cardMedia';
import TruncatedText from 'component/common/truncated-text'; import TruncatedText from 'component/common/truncated-text';
import Icon from 'component/common/icon'; import Icon from 'component/common/icon';
import FilePrice from 'component/filePrice'; import FilePrice from 'component/filePrice';
import UriIndicator from 'component/uriIndicator'; import UriIndicator from 'component/uriIndicator';
import NsfwOverlay from 'component/nsfwOverlay';
import * as icons from 'constants/icons'; import * as icons from 'constants/icons';
import classnames from 'classnames'; import classnames from 'classnames';
// TODO: iron these out // TODO: iron these out
type Props = { type Props = {
isResolvingUri: boolean,
resolveUri: string => void,
uri: string, uri: string,
claim: ?{ claim_id: string }, claim: ?{ claim_id: string },
fileInfo: ?{}, fileInfo: ?{},
@ -78,6 +76,24 @@ class FileCard extends React.PureComponent<Props> {
<CardMedia nsfw={shouldObscureNsfw} thumbnail={thumbnail} /> <CardMedia nsfw={shouldObscureNsfw} thumbnail={thumbnail} />
<div className="card-media__internal-links">{showPrice && <FilePrice uri={uri} />}</div> <div className="card-media__internal-links">{showPrice && <FilePrice uri={uri} />}</div>
{shouldObscureNsfw ? (
<div className="card__title-identity">
<div className="card__title--small">
<TruncatedText lines={3}>
{__('This content is obscured because it is NSFW. You can change this in ')}
<Button
button="link"
label={__('Settings.')}
onClick={e => {
// Don't propagate to the onClick handler of parent element
e.stopPropagation();
navigate('/settings');
}}
/>
</TruncatedText>
</div>
</div>
) : (
<div className="card__title-identity"> <div className="card__title-identity">
<div className="card__title--small"> <div className="card__title--small">
<TruncatedText lines={3}>{title}</TruncatedText> <TruncatedText lines={3}>{title}</TruncatedText>
@ -94,6 +110,7 @@ class FileCard extends React.PureComponent<Props> {
)} )}
</div> </div>
</div> </div>
)}
</section> </section>
); );
/* eslint-enable jsx-a11y/click-events-have-key-events */ /* eslint-enable jsx-a11y/click-events-have-key-events */