feat: persist settings and enrich conversation context
This commit is contained in:
1 parent
a36723a325
commit
2c100d72b6
84 files changed
+2248
-644
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import { Fragment } from 'react';
|
||||
import { RedditUsernameLink } from './reddit-username-link.js';
|
||||
|
||||
const USER_MENTION = /(u\/[A-Za-z0-9_-]+|@?t2_[A-Za-z0-9]+(?::reddit\.com)?)/gi;
|
||||
|
||||
export function RedditUserText({ children }: { children: string }) {
|
||||
return children.split(USER_MENTION).map((part, index) => {
|
||||
if (/^u\/(?!t2_)[A-Za-z0-9_-]+$/i.test(part)) {
|
||||
return <RedditUsernameLink key={`${part}-${index}`} username={part} />;
|
||||
}
|
||||
if (/^(?:@?t2_)/i.test(part) || /^u\/t2_/i.test(part)) {
|
||||
return <Fragment key={`${part}-${index}`}>Reddit user</Fragment>;
|
||||
}
|
||||
return <Fragment key={`${part}-${index}`}>{part}</Fragment>;
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user