profile: linkify statuses

Also fixes an unfiled bug where disableRemoteContent was ignored

Fixes urbit/landscape#418
This commit is contained in:
Matilde Park 2021-02-12 16:42:34 -05:00
parent ec702d43a0
commit 8f0b8b2101
3 changed files with 12 additions and 7 deletions

View File

@ -14,6 +14,7 @@ import {
Button,
Text
} from "@tlon/indigo-react";
import RichText from '~/views/components/RichText'
import useLocalState from "~/logic/state/local";
import { useHistory } from "react-router-dom";
import {useTutorialModal} from "~/views/components/useTutorialModal";
@ -84,9 +85,9 @@ export function Profile(props: any) {
</>
) : null}
</Row>
<Text maxWidth='18rem' overflowX='hidden' textOverflow="ellipsis"
<RichText disableRemoteContent maxWidth='18rem' overflowX='hidden' textOverflow="ellipsis"
whiteSpace="nowrap"
overflow="hidden" display="inline-block" verticalAlign="middle">{contact?.status ?? ""}</Text>
overflow="hidden" display="inline-block" verticalAlign="middle">{contact?.status ?? ""}</RichText>
</Row>
<Row width="100%" height="300px">
{cover}

View File

@ -14,6 +14,7 @@ import {
ColProps,
Icon
} from '@tlon/indigo-react';
import RichText from './RichText';
import { withLocalState } from '~/logic/state/local';
import { ProfileStatus } from './ProfileStatus';
@ -132,7 +133,7 @@ class ProfileOverlay extends PureComponent<ProfileOverlayProps, {}> {
onClick={() => history.push(`/~profile/~${ship}`)}>
{img}
</Box>
<Col alignItems="end" justifyContent="flex-end" overflow="hidden">
<Col alignItems="end" justifyContent="flex-end" overflow="hidden" minWidth='0'>
<Row width="100%" >
<Text
fontWeight='600'
@ -152,9 +153,12 @@ class ProfileOverlay extends PureComponent<ProfileOverlayProps, {}> {
contact={contact}
/>
) : (
<Text gray>
<RichText display='inline-block' width='100%' minWidth='0' textOverflow='ellipsis'
overflow='hidden'
whiteSpace='pre'
lineHeight="tall" disableRemoteContent gray>
{contact?.status ? contact.status : ''}
</Text>
</RichText>
)
}
</Col>

View File

@ -33,10 +33,10 @@ const RichText = React.memo(({ disableRemoteContent, ...props }) => (
videoShown: false,
oembedShown: false
} : null;
if (hasProvider(linkProps.href)) {
if (!disableRemoteContent && hasProvider(linkProps.href)) {
return <RemoteContent className="mw-100" url={linkProps.href} />;
}
return <BaseAnchor target='_blank' rel='noreferrer noopener' borderBottom='1px solid' remoteContentPolicy={remoteContentPolicy} {...linkProps}>{linkProps.children}</BaseAnchor>;
},
linkReference: (linkProps) => {