From c6bda1b7ddf57e6e3b611a9a28deae25f876313b Mon Sep 17 00:00:00 2001 From: Puyodead1 Date: Wed, 17 May 2023 10:43:29 -0400 Subject: [PATCH] go to first channel in guild --- src/components/GuildItem.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/GuildItem.tsx b/src/components/GuildItem.tsx index 8bfab33..0a9cd55 100644 --- a/src/components/GuildItem.tsx +++ b/src/components/GuildItem.tsx @@ -1,4 +1,8 @@ -import { CDNRoutes, ImageFormat } from "@spacebarchat/spacebar-api-types/v9"; +import { + CDNRoutes, + ChannelType, + ImageFormat, +} from "@spacebarchat/spacebar-api-types/v9"; import React from "react"; import { useNavigate } from "react-router-dom"; import styled from "styled-components"; @@ -44,7 +48,12 @@ function GuildItem(props: Props) { if (!guild) return null; const doNavigate = () => { - navigate(`/channels/${props.guildId}`); + const channel = guild.channels.mapped.find( + (x) => x.type !== ChannelType.GuildCategory, + ); + navigate( + `/channels/${props.guildId}${channel ? `/${channel.id}` : ""}`, + ); }; React.useEffect(() => {