Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32424180
D8852.1765352367.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D8852.1765352367.diff
View Options
diff --git a/web/markdown/markdown-chat-mention.react.js b/web/markdown/markdown-chat-mention.react.js
new file mode 100644
--- /dev/null
+++ b/web/markdown/markdown-chat-mention.react.js
@@ -0,0 +1,34 @@
+// @flow
+
+import * as React from 'react';
+
+import type { ResolvedThreadInfo } from 'lib/types/thread-types.js';
+
+import css from './markdown.css';
+import { useOnClickThread } from '../selectors/thread-selectors.js';
+
+type MarkdownSpoilerProps = {
+ +threadInfo: ResolvedThreadInfo,
+ +hasAccessToChat: boolean,
+ +text: string,
+};
+
+function MarkdownSpoiler(props: MarkdownSpoilerProps): React.Node {
+ const { threadInfo, hasAccessToChat, text } = props;
+ const onClick = useOnClickThread(threadInfo);
+
+ if (!hasAccessToChat) {
+ return text;
+ }
+
+ return (
+ <strong className={css.chatMention} onClick={onClick}>
+ {text}
+ </strong>
+ );
+}
+
+const MemoizedMarkdownSpoiler: React.ComponentType<MarkdownSpoilerProps> =
+ React.memo<MarkdownSpoilerProps>(MarkdownSpoiler);
+
+export default MemoizedMarkdownSpoiler;
diff --git a/web/markdown/markdown.css b/web/markdown/markdown.css
--- a/web/markdown/markdown.css
+++ b/web/markdown/markdown.css
@@ -104,3 +104,7 @@
color: white;
}
}
+
+strong.chatMention {
+ cursor: pointer;
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 10, 7:39 AM (13 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5862140
Default Alt Text
D8852.1765352367.diff (1 KB)
Attached To
Mode
D8852: [web] Introduce markdown component for chat mentions
Attached
Detach File
Event Timeline
Log In to Comment