From e95cac3c12361b50153216a765509aeb8dc4fec5 Mon Sep 17 00:00:00 2001 From: Puyodead1 Date: Thu, 30 Nov 2023 15:06:51 -0500 Subject: [PATCH] channel mention click navigation --- src/components/markdown/Mention.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/markdown/Mention.tsx b/src/components/markdown/Mention.tsx index a63be2d..a7be06d 100644 --- a/src/components/markdown/Mention.tsx +++ b/src/components/markdown/Mention.tsx @@ -1,4 +1,5 @@ import React, { memo } from "react"; +import { useNavigate } from "react-router-dom"; import styled from "styled-components"; import { useAppStore } from "../../stores/AppStore"; import Channel from "../../stores/objects/Channel"; @@ -46,6 +47,12 @@ function UserMention({ id }: MentionProps) { function ChannelMention({ id }: MentionProps) { const app = useAppStore(); const [channel, setChannel] = React.useState(null); + const navigate = useNavigate(); + + const click = () => { + if (!channel) return; + navigate(`/channels/${channel.guildId}/${channel.id}`); + }; React.useEffect(() => { const channel = app.channels.get(id); @@ -60,7 +67,7 @@ function ChannelMention({ id }: MentionProps) { ); return ( - + #{channel.name} );