Skip to content

Commit bf9deae

Browse files
committed
fix(abbreviations): fix lint, typecheck, and format errors
1 parent 18a7ca0 commit bf9deae

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

src/app/components/message/RenderBody.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MouseEventHandler, ReactNode, useEffect, useState } from 'react';
1+
import { MouseEventHandler, useEffect, useState } from 'react';
22
import parse, { HTMLReactParserOptions } from 'html-react-parser';
33
import Linkify from 'linkify-react';
44
import { Opts } from 'linkifyjs';
@@ -66,9 +66,9 @@ function AbbreviationTerm({ text, definition }: AbbreviationTermProps) {
6666
*/
6767
export function buildAbbrReplaceTextNode(
6868
abbrMap: Map<string, string>
69-
): ((text: string) => ReactNode | undefined) | undefined {
69+
): ((text: string) => JSX.Element | undefined) | undefined {
7070
if (abbrMap.size === 0) return undefined;
71-
return (text: string) => {
71+
return function replaceTextNode(text: string) {
7272
const segments = splitByAbbreviations(text, abbrMap);
7373
if (!segments.some((s) => s.termKey !== undefined)) return undefined;
7474
return (

src/app/features/room/ThreadDrawer.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,16 @@ export function ThreadDrawer({ room, threadRootId, onClose, overlay }: ThreadDra
408408
nicknames,
409409
replaceTextNode: buildAbbrReplaceTextNode(abbrMap),
410410
}),
411-
[mx, room, linkifyOpts, spoilerClickHandler, mentionClickHandler, useAuthentication, nicknames, abbrMap]
411+
[
412+
mx,
413+
room,
414+
linkifyOpts,
415+
spoilerClickHandler,
416+
mentionClickHandler,
417+
useAuthentication,
418+
nicknames,
419+
abbrMap,
420+
]
412421
);
413422

414423
// Power levels & permissions

src/app/plugins/react-custom-html-parser.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ export const getReactCustomHtmlParser = (
351351
useAuthentication?: boolean;
352352
nicknames?: Nicknames;
353353
autoplayEmojis?: boolean;
354-
replaceTextNode?: (text: string) => ReactNode | undefined;
354+
replaceTextNode?: (text: string) => JSX.Element | undefined;
355355
}
356356
): HTMLReactParserOptions => {
357357
const { replaceTextNode } = params;

0 commit comments

Comments
 (0)