mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-11 04:48:00 +03:00
Merge pull request #4821 from urbit/mp/landscape/me-highlight
landscape: highlight content mentioning our ship
This commit is contained in:
commit
77219c6825
@ -264,6 +264,7 @@ class ChatMessage extends Component<ChatMessageProps> {
|
|||||||
componentDidMount() {}
|
componentDidMount() {}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
let { highlighted } = this.props;
|
||||||
const {
|
const {
|
||||||
msg,
|
msg,
|
||||||
previousMsg,
|
previousMsg,
|
||||||
@ -279,12 +280,21 @@ class ChatMessage extends Component<ChatMessageProps> {
|
|||||||
unreadMarkerRef,
|
unreadMarkerRef,
|
||||||
history,
|
history,
|
||||||
api,
|
api,
|
||||||
highlighted,
|
|
||||||
showOurContact,
|
showOurContact,
|
||||||
fontSize,
|
fontSize,
|
||||||
hideHover
|
hideHover
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
const ourMention = msg?.contents?.some((e) => {
|
||||||
|
return e?.mention && e?.mention === window.ship;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!highlighted) {
|
||||||
|
if (ourMention) {
|
||||||
|
highlighted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let onReply = this.props?.onReply ?? (() => {});
|
let onReply = this.props?.onReply ?? (() => {});
|
||||||
const transcluded = this.props?.transcluded ?? 0;
|
const transcluded = this.props?.transcluded ?? 0;
|
||||||
let { renderSigil } = this.props;
|
let { renderSigil } = this.props;
|
||||||
|
@ -35,6 +35,7 @@ interface CommentItemProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function CommentItem(props: CommentItemProps): ReactElement {
|
export function CommentItem(props: CommentItemProps): ReactElement {
|
||||||
|
let { highlighted } = props;
|
||||||
const { ship, name, api, comment, group } = props;
|
const { ship, name, api, comment, group } = props;
|
||||||
const association = useMetadataState(
|
const association = useMetadataState(
|
||||||
useCallback(s => s.associations.graph[`/ship/${ship}/${name}`], [ship,name])
|
useCallback(s => s.associations.graph[`/ship/${ship}/${name}`], [ship,name])
|
||||||
@ -47,6 +48,16 @@ export function CommentItem(props: CommentItemProps): ReactElement {
|
|||||||
await api.graph.removeNodes(ship, name, [comment.post?.index]);
|
await api.graph.removeNodes(ship, name, [comment.post?.index]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ourMention = post?.contents?.some((e) => {
|
||||||
|
return e?.mention && e?.mention === window.ship;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!highlighted) {
|
||||||
|
if (ourMention) {
|
||||||
|
highlighted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const commentIndexArray = (comment.post?.index || '/').split('/');
|
const commentIndexArray = (comment.post?.index || '/').split('/');
|
||||||
const commentIndex = commentIndexArray[commentIndexArray.length - 1];
|
const commentIndex = commentIndexArray[commentIndexArray.length - 1];
|
||||||
|
|
||||||
@ -107,7 +118,7 @@ export function CommentItem(props: CommentItemProps): ReactElement {
|
|||||||
borderRadius="1"
|
borderRadius="1"
|
||||||
p="1"
|
p="1"
|
||||||
mb="1"
|
mb="1"
|
||||||
backgroundColor={props.highlighted ? 'washedBlue' : 'white'}
|
backgroundColor={highlighted ? 'washedBlue' : 'white'}
|
||||||
transcluded={0}
|
transcluded={0}
|
||||||
api={api}
|
api={api}
|
||||||
post={post}
|
post={post}
|
||||||
|
Loading…
Reference in New Issue
Block a user