Profile: Allow pointer actions in bio (#1085)

This commit is contained in:
Alexander Zinchuk 2021-05-12 15:28:42 +03:00
parent fd6aec4f08
commit 0c3fe11ea3
3 changed files with 11 additions and 10 deletions

View File

@ -76,13 +76,11 @@ const ChatExtra: FC<OwnProps & StateProps & DispatchProps> = ({
return undefined; return undefined;
} }
const bio = fullInfo && fullInfo.bio;
const formattedNumber = phoneNumber && formatPhoneNumberWithCode(phoneNumber); const formattedNumber = phoneNumber && formatPhoneNumberWithCode(phoneNumber);
const description = getChatDescription(chat);
const link = getChatLink(chat); const link = getChatLink(chat);
const url = link.indexOf('http') === 0 ? link : `http://${link}`; const url = link.indexOf('http') === 0 ? link : `http://${link}`;
const printedUsername = username || chatUsername; const printedUsername = username || chatUsername;
const printedDescription = bio || description; const description = (fullInfo && fullInfo.bio) || getChatDescription(chat);
return ( return (
<div className="ChatExtra"> <div className="ChatExtra">
@ -104,15 +102,14 @@ const ChatExtra: FC<OwnProps & StateProps & DispatchProps> = ({
<span className="subtitle">{lang('Username')}</span> <span className="subtitle">{lang('Username')}</span>
</ListItem> </ListItem>
)} )}
{printedDescription && !!printedDescription.length && ( {description && !!description.length && (
<ListItem <ListItem
icon="info" icon="info"
multiline multiline
narrow narrow
ripple isStatic
onClick={() => handleClick(printedDescription, lang(userId ? 'UserBio' : 'Info'))}
> >
<span className="title">{renderText(printedDescription, ['br', 'links', 'emoji'])}</span> <span className="title">{renderText(description, ['br', 'links', 'emoji'])}</span>
<span className="subtitle">{lang(userId ? 'UserBio' : 'Info')}</span> <span className="subtitle">{lang(userId ? 'UserBio' : 'Info')}</span>
</ListItem> </ListItem>
)} )}

View File

@ -39,7 +39,7 @@
} }
} }
&:not(.disabled) { &:not(.disabled):not(.is-static) {
.ListItem-button { .ListItem-button {
cursor: pointer; cursor: pointer;
@ -50,7 +50,7 @@
} }
@media (min-width: 600px) { @media (min-width: 600px) {
&:not(.has-ripple), &:not(.has-ripple):not(.is-static),
body.animation-level-0 & { body.animation-level-0 & {
.ListItem-button:active { .ListItem-button:active {
--background-color: var(--color-item-active) !important; --background-color: var(--color-item-active) !important;

View File

@ -34,6 +34,7 @@ type OwnProps = {
focus?: boolean; focus?: boolean;
destructive?: boolean; destructive?: boolean;
multiline?: boolean; multiline?: boolean;
isStatic?: boolean;
contextActions?: MenuItemContextAction[]; contextActions?: MenuItemContextAction[];
onClick?: OnClickHandler; onClick?: OnClickHandler;
}; };
@ -52,6 +53,7 @@ const ListItem: FC<OwnProps> = (props) => {
focus, focus,
destructive, destructive,
multiline, multiline,
isStatic,
contextActions, contextActions,
onClick, onClick,
} = props; } = props;
@ -111,8 +113,9 @@ const ListItem: FC<OwnProps> = (props) => {
}, [inactive, contextActions, onClick, handleBeforeContextMenu, handleContextMenu, handleClick]); }, [inactive, contextActions, onClick, handleBeforeContextMenu, handleContextMenu, handleClick]);
const fullClassName = buildClassName( const fullClassName = buildClassName(
'ListItem no-selection', 'ListItem',
className, className,
!isStatic && 'no-selection',
ripple && 'has-ripple', ripple && 'has-ripple',
narrow && 'narrow', narrow && 'narrow',
disabled && 'disabled', disabled && 'disabled',
@ -121,6 +124,7 @@ const ListItem: FC<OwnProps> = (props) => {
focus && 'focus', focus && 'focus',
destructive && 'destructive', destructive && 'destructive',
multiline && 'multiline', multiline && 'multiline',
isStatic && 'is-static',
); );
return ( return (