Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
juliajforesti committed Sep 21, 2023
1 parent ba6228b commit 7e67c76
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
6 changes: 2 additions & 4 deletions packages/gazzodown/src/elements/PlainSpan.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useTranslation } from '@rocket.chat/ui-contexts';
import { Fragment, memo, ReactElement, useContext, useMemo } from 'react';

import { MarkupInteractionContext } from '../MarkupInteractionContext';
Expand All @@ -8,7 +7,6 @@ type PlainSpanProps = {
};

const PlainSpan = ({ text }: PlainSpanProps): ReactElement => {
const t = useTranslation();
const { highlightRegex, markRegex } = useContext(MarkupInteractionContext);

const content = useMemo(() => {
Expand All @@ -22,7 +20,7 @@ const PlainSpan = ({ text }: PlainSpanProps): ReactElement => {
{chunks.map((chunk, i) => {
if (i % 2 === 0) {
return (
<mark title={t('Highlighted_chosen_word')} key={i} className='highlight-text'>
<mark title='Highlighted_chosen_word' key={i} className='highlight-text'>
{chunk}
</mark>
);
Expand Down Expand Up @@ -53,7 +51,7 @@ const PlainSpan = ({ text }: PlainSpanProps): ReactElement => {
}

return text;
}, [highlightRegex, markRegex, text, t]);
}, [highlightRegex, markRegex, text]);

return <>{content}</>;
};
Expand Down
4 changes: 1 addition & 3 deletions packages/gazzodown/src/mentions/ChannelMentionElement.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Message } from '@rocket.chat/fuselage';
import { useTranslation } from '@rocket.chat/ui-contexts';
import { memo, ReactElement, useContext, useMemo } from 'react';

import { MarkupInteractionContext } from '../MarkupInteractionContext';
Expand All @@ -11,7 +10,6 @@ type ChannelMentionElementProps = {
const handleChannelMention = (mention: string, withSymbol: boolean | undefined): string => (withSymbol ? `#${mention}` : mention);

const ChannelMentionElement = ({ mention }: ChannelMentionElementProps): ReactElement => {
const t = useTranslation();
const { resolveChannelMention, onChannelMentionClick, showMentionSymbol } = useContext(MarkupInteractionContext);

const resolved = useMemo(() => resolveChannelMention?.(mention), [mention, resolveChannelMention]);
Expand All @@ -22,7 +20,7 @@ const ChannelMentionElement = ({ mention }: ChannelMentionElementProps): ReactEl
}

return (
<Message.Highlight title={t('Mentions_channel')} variant='link' clickable onClick={handleClick}>
<Message.Highlight title='Mentions_channel' variant='link' clickable onClick={handleClick}>
{handleChannelMention(resolved.name ?? mention, showMentionSymbol)}
</Message.Highlight>
);
Expand Down
8 changes: 3 additions & 5 deletions packages/gazzodown/src/mentions/UserMentionElement.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Message } from '@rocket.chat/fuselage';
import { useTranslation } from '@rocket.chat/ui-contexts';
import { memo, ReactElement, useContext, useMemo } from 'react';

import { MarkupInteractionContext } from '../MarkupInteractionContext';
Expand All @@ -12,7 +11,6 @@ const handleUserMention = (mention: string | undefined, withSymbol: boolean | un
withSymbol ? `@${mention}` : mention;

const UserMentionElement = ({ mention }: UserMentionElementProps): ReactElement => {
const t = useTranslation();
const { resolveUserMention, onUserMentionClick, isMobile, ownUserId, useRealName, showMentionSymbol } =
useContext(MarkupInteractionContext);

Expand All @@ -23,15 +21,15 @@ const UserMentionElement = ({ mention }: UserMentionElementProps): ReactElement

if (mention === 'all') {
return (
<Message.Highlight title={t('Mentions_all_room_members')} variant='relevant'>
<Message.Highlight title='Mentions_all_room_members' variant='relevant'>
{handleUserMention('all', showMentionSymbol)}
</Message.Highlight>
);
}

if (mention === 'here') {
return (
<Message.Highlight title={t('Mentions_online_room_members')} variant='relevant'>
<Message.Highlight title='Mentions_online_room_members' variant='relevant'>
{handleUserMention('here', showMentionSymbol)}
</Message.Highlight>
);
Expand All @@ -44,7 +42,7 @@ const UserMentionElement = ({ mention }: UserMentionElementProps): ReactElement
return (
<Message.Highlight
variant={resolved._id === ownUserId ? 'critical' : 'other'}
title={resolved._id === ownUserId ? t('Mentions_you') : t('Mentions_user')}
title={resolved._id === ownUserId ? 'Mentions_you' : 'Mentions_user'}
clickable
onClick={handleClick}
data-uid={resolved._id}
Expand Down

0 comments on commit 7e67c76

Please sign in to comment.