Use titles vs names on channel claim previews, but show name in channel areas (#962)
* use titles * Sidebar: show "title + name" Co-authored-by: Thomas Zarebczan <thomas.zarebczan@gmail.com>
This commit is contained in:
parent
d5a91b5917
commit
49fc238e4c
8 changed files with 76 additions and 17 deletions
|
@ -415,7 +415,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||||
</UriIndicator>
|
</UriIndicator>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<ClaimPreviewSubtitle uri={uri} type={type} />
|
<ClaimPreviewSubtitle uri={uri} type={type} showAtSign={isChannelUri} />
|
||||||
{(pending || !!reflectingProgress) && <PublishPending uri={uri} />}
|
{(pending || !!reflectingProgress) && <PublishPending uri={uri} />}
|
||||||
{channelSubscribers}
|
{channelSubscribers}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -17,11 +17,12 @@ type Props = {
|
||||||
isLivestream: boolean,
|
isLivestream: boolean,
|
||||||
fetchSubCount: (string) => void,
|
fetchSubCount: (string) => void,
|
||||||
subCount: number,
|
subCount: number,
|
||||||
|
showAtSign?: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
// previews used in channel overview and homepage (and other places?)
|
// previews used in channel overview and homepage (and other places?)
|
||||||
function ClaimPreviewSubtitle(props: Props) {
|
function ClaimPreviewSubtitle(props: Props) {
|
||||||
const { pending, uri, claim, type, beginPublish, isLivestream, fetchSubCount, subCount } = props;
|
const { pending, uri, claim, type, beginPublish, isLivestream, fetchSubCount, subCount, showAtSign } = props;
|
||||||
const isChannel = claim && claim.value_type === 'channel';
|
const isChannel = claim && claim.value_type === 'channel';
|
||||||
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
|
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ function ClaimPreviewSubtitle(props: Props) {
|
||||||
<div className="media__subtitle">
|
<div className="media__subtitle">
|
||||||
{claim ? (
|
{claim ? (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<UriIndicator uri={uri} link stripAtSign />{' '}
|
<UriIndicator uri={uri} showAtSign={showAtSign} link />{' '}
|
||||||
{!pending && claim && (
|
{!pending && claim && (
|
||||||
<>
|
<>
|
||||||
{isChannel && type !== 'inline' && (
|
{isChannel && type !== 'inline' && (
|
||||||
|
|
|
@ -222,7 +222,7 @@ function ClaimPreviewTile(props: Props) {
|
||||||
<TruncatedText text={title || (claim && claim.name)} lines={isChannel ? 1 : 2} />
|
<TruncatedText text={title || (claim && claim.name)} lines={isChannel ? 1 : 2} />
|
||||||
{isChannel && (
|
{isChannel && (
|
||||||
<div className="claim-tile__about">
|
<div className="claim-tile__about">
|
||||||
<UriIndicator uri={uri} stripAtSign />
|
<UriIndicator uri={uri} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</h2>
|
</h2>
|
||||||
|
@ -247,7 +247,7 @@ function ClaimPreviewTile(props: Props) {
|
||||||
</UriIndicator>
|
</UriIndicator>
|
||||||
|
|
||||||
<div className="claim-tile__about">
|
<div className="claim-tile__about">
|
||||||
<UriIndicator uri={uri} link stripAtSign />
|
<UriIndicator uri={uri} link />
|
||||||
<div className="claim-tile__about--counts">
|
<div className="claim-tile__about--counts">
|
||||||
<FileViewCountInline uri={uri} isLivestream={isLivestream} />
|
<FileViewCountInline uri={uri} isLivestream={isLivestream} />
|
||||||
{isLivestream && <LivestreamDateTime uri={uri} />}
|
{isLivestream && <LivestreamDateTime uri={uri} />}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import TruncatedText from 'component/common/truncated-text';
|
import TruncatedText from 'component/common/truncated-text';
|
||||||
|
import { stripLeadingAtSign } from 'util/string';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
uri: string,
|
uri: string,
|
||||||
|
@ -13,7 +14,11 @@ function ClaimPreviewTitle(props: Props) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="claim-preview__title">
|
<div className="claim-preview__title">
|
||||||
{claim ? <TruncatedText text={title || claim.name} lines={2} /> : <span>{__('Nothing here')}</span>}
|
{claim ? (
|
||||||
|
<TruncatedText text={title || stripLeadingAtSign(claim.name)} lines={2} />
|
||||||
|
) : (
|
||||||
|
<span>{__('Nothing here')}</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ function ClaimRepostAuthor(props: Props) {
|
||||||
<div className="claim-preview__repost-ribbon">
|
<div className="claim-preview__repost-ribbon">
|
||||||
<Icon icon={ICONS.REPOST} size={10} className="claim-preview__repost-icon" />
|
<Icon icon={ICONS.REPOST} size={10} className="claim-preview__repost-icon" />
|
||||||
<br />
|
<br />
|
||||||
<UriIndicator link uri={repostChannelUrl} />
|
<UriIndicator link uri={repostChannelUrl} showAtSign />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -5,6 +5,7 @@ import * as ICONS from 'constants/icons';
|
||||||
import * as KEYCODES from 'constants/keycodes';
|
import * as KEYCODES from 'constants/keycodes';
|
||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
|
import ClaimPreviewTitle from 'component/claimPreviewTitle';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import Icon from 'component/common/icon';
|
import Icon from 'component/common/icon';
|
||||||
import NotificationBubble from 'component/notificationBubble';
|
import NotificationBubble from 'component/notificationBubble';
|
||||||
|
@ -13,7 +14,6 @@ import I18nMessage from 'component/i18nMessage';
|
||||||
import ChannelThumbnail from 'component/channelThumbnail';
|
import ChannelThumbnail from 'component/channelThumbnail';
|
||||||
import { useIsMobile, useIsLargeScreen, isTouch } from 'effects/use-screensize';
|
import { useIsMobile, useIsLargeScreen, isTouch } from 'effects/use-screensize';
|
||||||
import { GetLinksData } from 'util/buildHomepage';
|
import { GetLinksData } from 'util/buildHomepage';
|
||||||
import { stripLeadingAtSign } from 'util/string';
|
|
||||||
import { DOMAIN, ENABLE_UI_NOTIFICATIONS, ENABLE_NO_SOURCE_CLAIMS, CHANNEL_STAKED_LEVEL_LIVESTREAM } from 'config';
|
import { DOMAIN, ENABLE_UI_NOTIFICATIONS, ENABLE_NO_SOURCE_CLAIMS, CHANNEL_STAKED_LEVEL_LIVESTREAM } from 'config';
|
||||||
|
|
||||||
const FOLLOWED_ITEM_INITIAL_LIMIT = 10;
|
const FOLLOWED_ITEM_INITIAL_LIMIT = 10;
|
||||||
|
@ -536,16 +536,19 @@ function SideNavigation(props: Props) {
|
||||||
function SubscriptionListItem({ subscription }: { subscription: Subscription }) {
|
function SubscriptionListItem({ subscription }: { subscription: Subscription }) {
|
||||||
const { uri, channelName } = subscription;
|
const { uri, channelName } = subscription;
|
||||||
return (
|
return (
|
||||||
<li className="navigation-link__wrapper">
|
<li className="navigation-link__wrapper navigation__subscription">
|
||||||
<Button
|
<Button
|
||||||
navigate={uri}
|
navigate={uri}
|
||||||
className="navigation-link navigation-link--with-thumbnail"
|
className="navigation-link navigation-link--with-thumbnail"
|
||||||
activeClass="navigation-link--active"
|
activeClass="navigation-link--active"
|
||||||
>
|
>
|
||||||
<ChannelThumbnail xsmall uri={uri} hideStakedIndicator />
|
<ChannelThumbnail xsmall uri={uri} hideStakedIndicator />
|
||||||
<span dir="auto" className="button__label">
|
<div className="navigation__subscription-title">
|
||||||
{stripLeadingAtSign(channelName)}
|
<ClaimPreviewTitle uri={uri} />
|
||||||
</span>
|
<span dir="auto" className="channel-name">
|
||||||
|
{channelName}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</Button>
|
</Button>
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
|
|
|
@ -5,7 +5,7 @@ import classnames from 'classnames';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import { stripLeadingAtSign } from 'util/string';
|
import { stripLeadingAtSign } from 'util/string';
|
||||||
|
|
||||||
type ChannelInfo = { uri: string, name: string };
|
type ChannelInfo = { uri: string, name: string, title: string };
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
uri: string,
|
uri: string,
|
||||||
|
@ -15,7 +15,7 @@ type Props = {
|
||||||
focusable?: boolean, // Defaults to 'true' if not provided.
|
focusable?: boolean, // Defaults to 'true' if not provided.
|
||||||
hideAnonymous?: boolean,
|
hideAnonymous?: boolean,
|
||||||
inline?: boolean,
|
inline?: boolean,
|
||||||
stripAtSign?: boolean,
|
showAtSign?: boolean,
|
||||||
className?: string,
|
className?: string,
|
||||||
children: ?Node, // to allow for other elements to be nested within the UriIndicator (commit: 1e82586f).
|
children: ?Node, // to allow for other elements to be nested within the UriIndicator (commit: 1e82586f).
|
||||||
// --- redux ---
|
// --- redux ---
|
||||||
|
@ -48,6 +48,7 @@ class UriIndicator extends React.PureComponent<Props> {
|
||||||
isAnonymous: false,
|
isAnonymous: false,
|
||||||
channelName: channelInfo.name,
|
channelName: channelInfo.name,
|
||||||
channelLink: isLinkType ? channelInfo.uri : false,
|
channelLink: isLinkType ? channelInfo.uri : false,
|
||||||
|
channelTitle: channelInfo.title,
|
||||||
};
|
};
|
||||||
} else if (claim) {
|
} else if (claim) {
|
||||||
const signingChannel = claim.signing_channel && claim.signing_channel.amount;
|
const signingChannel = claim.signing_channel && claim.signing_channel.amount;
|
||||||
|
@ -59,6 +60,10 @@ class UriIndicator extends React.PureComponent<Props> {
|
||||||
isAnonymous: !signingChannel && !isChannelClaim,
|
isAnonymous: !signingChannel && !isChannelClaim,
|
||||||
channelName: channelClaim?.name,
|
channelName: channelClaim?.name,
|
||||||
channelLink: isLinkType ? channelClaim?.canonical_url || channelClaim?.permanent_url : false,
|
channelLink: isLinkType ? channelClaim?.canonical_url || channelClaim?.permanent_url : false,
|
||||||
|
channelTitle:
|
||||||
|
channelClaim && channelClaim.value && channelClaim.value.title
|
||||||
|
? channelClaim.value.title
|
||||||
|
: stripLeadingAtSign(channelClaim?.name),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
|
@ -66,6 +71,7 @@ class UriIndicator extends React.PureComponent<Props> {
|
||||||
isAnonymous: undefined,
|
isAnonymous: undefined,
|
||||||
channelName: undefined,
|
channelName: undefined,
|
||||||
channelLink: undefined,
|
channelLink: undefined,
|
||||||
|
channelTitle: undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -81,7 +87,7 @@ class UriIndicator extends React.PureComponent<Props> {
|
||||||
focusable = true,
|
focusable = true,
|
||||||
external = false,
|
external = false,
|
||||||
hideAnonymous = false,
|
hideAnonymous = false,
|
||||||
stripAtSign,
|
showAtSign,
|
||||||
className,
|
className,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
@ -108,11 +114,11 @@ class UriIndicator extends React.PureComponent<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.hasChannelData) {
|
if (data.hasChannelData) {
|
||||||
const { channelName, channelLink } = data;
|
const { channelLink, channelTitle, channelName } = data;
|
||||||
|
|
||||||
const inner = (
|
const inner = (
|
||||||
<span dir="auto" className={classnames('channel-name', { 'channel-name--inline': inline })}>
|
<span dir="auto" className={classnames('channel-name', { 'channel-name--inline': inline })}>
|
||||||
{stripAtSign ? stripLeadingAtSign(channelName) : channelName}
|
{showAtSign ? channelName : stripLeadingAtSign(channelTitle)}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -459,3 +459,47 @@
|
||||||
margin-bottom: -2px;
|
margin-bottom: -2px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.navigation-link__wrapper.navigation__subscription {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navigation__subscription {
|
||||||
|
.button__content {
|
||||||
|
padding-top: var(--spacing-xxs);
|
||||||
|
padding-bottom: var(--spacing-xxs);
|
||||||
|
}
|
||||||
|
|
||||||
|
.navigation-link {
|
||||||
|
&:hover {
|
||||||
|
.channel-name {
|
||||||
|
color: var(--color-text); // disable the hover color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.channel-thumbnail {
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navigation__subscription-title {
|
||||||
|
max-width: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.claim-preview__title {
|
||||||
|
span {
|
||||||
|
font-size: var(--font-xsmall);
|
||||||
|
$font_descender_est_height: 5px;
|
||||||
|
margin-bottom: calc(#{$font_descender_est_height} * -0.7);
|
||||||
|
display: block;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.channel-name {
|
||||||
|
opacity: 0.7;
|
||||||
|
font-size: var(--font-xxsmall);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue