[Glitch] Emoji: Statuses

Port 0c1ca6c969 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Echo
2025-10-08 16:18:11 +02:00
committed by Claire
parent c4ef050eb6
commit c08a874ba9
14 changed files with 128 additions and 85 deletions

View File

@@ -83,14 +83,15 @@ export const HandledLink: FC<HandledLinkProps & ComponentProps<'a'>> = ({
export const useElementHandledLink = ({
hashtagAccountId,
mentionAccountId,
hrefToMentionAccountId,
}: {
hashtagAccountId?: string;
mentionAccountId?: string;
hrefToMentionAccountId?: (href: string) => string | undefined;
} = {}) => {
const onElement = useCallback<OnElementHandler>(
(element, { key, ...props }) => {
if (element instanceof HTMLAnchorElement) {
const mentionId = hrefToMentionAccountId?.(element.href);
return (
<HandledLink
{...props}
@@ -98,13 +99,13 @@ export const useElementHandledLink = ({
href={element.href}
text={element.innerText}
hashtagAccountId={hashtagAccountId}
mentionAccountId={mentionAccountId}
mentionAccountId={mentionId}
/>
);
}
return undefined;
},
[hashtagAccountId, mentionAccountId],
[hashtagAccountId, hrefToMentionAccountId],
);
return { onElement };
};