Skip to content

Commit

Permalink
Render emotes in notice
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaserlang committed Nov 5, 2024
1 parent dd7d95e commit 526bd28
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tbot/web/ui/live_chat/components/chat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import useWebSocket from "react-use-websocket";
import { RenderMessage } from "./render_message";
import { RenderModAction } from "./render_mod_action";
import { RenderNotice } from "./render_notice";
import { parseTwitchEmotes, parseTwitchBadges } from "../parse_tags";
import { parseTwitchEmotes } from "../parse_tags";
import { useParseEmotes } from "./parse_emotes";

import "./chat.scss";
Expand Down
13 changes: 12 additions & 1 deletion tbot/web/ui/live_chat/components/render_notice.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
import { providerShort } from "./provider_short";
import sanitizeHtml from "sanitize-html";

export function RenderNotice({ msg }) {
return (
<div className="notice">
{providerShort(msg.provider)}
<span className="text">{msg.message}</span>
<span
className="text"
dangerouslySetInnerHTML={{
__html: sanitizeHtml(msg.message, {
allowedTags: ["img"],
allowedAttributes: {
img: ["src", "title", "class"],
},
}),
}}
></span>
</div>
);
}

0 comments on commit 526bd28

Please sign in to comment.