diff --git a/src/components/Questions/QuestionsTable.tsx b/src/components/Questions/QuestionsTable.tsx index d02bc3c99bb2..813a9137bf1b 100644 --- a/src/components/Questions/QuestionsTable.tsx +++ b/src/components/Questions/QuestionsTable.tsx @@ -104,13 +104,7 @@ const Row = ({ } = question const latestAuthor = replies?.data?.[replies.data.length - 1]?.attributes?.profile || profile - const isOP = profile?.data?.id === user?.profile?.id - const numReplies = - replies?.data?.filter((reply) => - reply.attributes.profile?.data?.id === Number(process.env.GATSBY_AI_PROFILE_ID) - ? isModerator || reply.attributes.helpful || isOP - : true - ).length || 0 + const numReplies = replies?.data?.length || 0 const { ref, inView } = useInView({ threshold: 0, diff --git a/src/components/Squeak/components/Markdown.tsx b/src/components/Squeak/components/Markdown.tsx index 5defc6d95cd6..627a63d90682 100644 --- a/src/components/Squeak/components/Markdown.tsx +++ b/src/components/Squeak/components/Markdown.tsx @@ -6,6 +6,15 @@ import { ZoomImage } from 'components/ZoomImage' import { TransformImage } from 'react-markdown/lib/ast-to-react' import remarkGfm from 'remark-gfm' +const replaceMentions = (body: string) => { + return body.replace(/@([a-zA-Z0-9-]+\/[0-9]+|max)/g, (match, username) => { + if (username === 'max') { + return `[${match}](/community/profiles/${process.env.GATSBY_AI_PROFILE_ID})` + } + return `[${match}](/community/profiles/${username.split('/')[1]})` + }) +} + export const Markdown = ({ children, transformImageUri, @@ -23,7 +32,9 @@ export const Markdown = ({ remarkPlugins={[remarkGfm]} transformImageUri={transformImageUri} rehypePlugins={[rehypeSanitize]} - className={`flex-1 !text-sm overflow-hidden text-ellipsis mr-1 !pb-0 text-primary/75 dark:text-primary-dark/75 font-normal ${regularText ? '' : 'question-content community-post-markdown'}`} + className={`flex-1 !text-sm overflow-hidden text-ellipsis mr-1 !pb-0 text-primary/75 dark:text-primary-dark/75 font-normal ${ + regularText ? '' : 'question-content community-post-markdown' + }`} components={{ pre: ({ children }) => { return ( @@ -57,7 +68,7 @@ export const Markdown = ({ img: ZoomImage, }} > - {children} + {replaceMentions(children)} ) } diff --git a/src/components/Squeak/components/Question.tsx b/src/components/Squeak/components/Question.tsx index 8fead51cb0e1..fe431fa9ab99 100644 --- a/src/components/Squeak/components/Question.tsx +++ b/src/components/Squeak/components/Question.tsx @@ -228,36 +228,38 @@ const DeleteButton = ({ questionID }: { questionID: number }) => { const MaxReply = ({ children }: { children: React.ReactNode }) => { return ( -
- Hang tight, checking to see if we can find an answer for you... -
-- {messages[currentMessageIndex]} -
-- Dang, we couldn’t find anything this time. A community member will hopefully respond soon! -
-+ Hang tight, checking to see if we can find an answer for you... +
++ {messages[currentMessageIndex]} +
+Dang, we couldn’t find anything this time. A community member will hopefully respond soon!
+- Great to hear! This answer has been marked as the solution. + Great to hear! Thanks for helping us improve.
Drop image here
-Drop image here
+