1
0
mirror of https://github.com/spacebarchat/client.git synced 2024-11-22 10:22:30 +01:00

everyone and here mention rendering

This commit is contained in:
Puyodead1 2023-12-09 16:18:06 -05:00
parent b02e31026a
commit b0e7bb4111
No known key found for this signature in database
GPG Key ID: A4FA4FEC0DD353FC
2 changed files with 14 additions and 1 deletions

View File

@ -176,6 +176,10 @@ const customRenderer: Partial<ReactRenderer> = {
<Mention key={i} type="role" id={match} />
));
replaced = reactStringReplace(replaced, /(@everyone|@here)/, (match, i) => (
<Mention key={i} type="text" id={match} />
));
return replaced;
},
};

View File

@ -125,8 +125,16 @@ function RoleMention({ id }: MentionProps) {
);
}
function CustomMention({ id }: MentionProps) {
return (
<Container>
<span>{id}</span>
</Container>
);
}
interface Props {
type: "role" | "user" | "channel";
type: "role" | "user" | "channel" | "text";
id: string;
}
@ -134,6 +142,7 @@ function Mention({ type, id }: Props) {
if (type === "role") return <RoleMention id={id} />;
if (type === "user") return <UserMention id={id} />;
if (type === "channel") return <ChannelMention id={id} />;
if (type === "text") return <CustomMention id={id} />;
return null;
}