Add new post title & url ellipsis overflow. (#6964)

This commit is contained in:
Franco Montenegro 2021-08-26 11:53:32 -03:00 committed by GitHub
parent fe2142ba49
commit 2510217935
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,6 +83,22 @@ const ModalPublishPreview = (props: Props) => {
remoteFile,
} = props;
const maxCharsBeforeOverflow = 128;
const formattedTitle = React.useMemo(() => {
if (title && title.length > maxCharsBeforeOverflow) {
return title.slice(0, maxCharsBeforeOverflow).trim() + '...';
}
return title;
}, [title]);
const formattedUri = React.useMemo(() => {
if (uri && uri.length > maxCharsBeforeOverflow) {
return uri.slice(0, maxCharsBeforeOverflow).trim() + '...';
}
return uri;
}, [uri]);
const livestream =
(uri && isLivestreamClaim) ||
// $FlowFixMe
@ -227,10 +243,10 @@ const ModalPublishPreview = (props: Props) => {
{!livestream && !isMarkdownPost && createRow(__('File'), getFilePathName(filePath))}
{livestream && remoteFile && createRow(__('Replay'), __('Remote File Selected'))}
{isOptimizeAvail && createRow(__('Transcode'), optimize ? __('Yes') : __('No'))}
{createRow(__('Title'), title)}
{createRow(__('Title'), formattedTitle)}
{createRow(__('Description'), descriptionValue)}
{createRow(__('Channel'), channelValue(channel))}
{createRow(__('URL'), uri)}
{createRow(__('URL'), formattedUri)}
{createRow(__('Deposit'), depositValue)}
{createRow(__('Price'), priceValue)}
{createRow(__('Language'), language)}