1
0
mirror of https://github.com/spacebarchat/client.git synced 2024-11-25 19:52:31 +01:00

go to first channel in guild

This commit is contained in:
Puyodead1 2023-05-17 10:43:29 -04:00
parent f975ce304a
commit c6bda1b7dd
No known key found for this signature in database
GPG Key ID: A4FA4FEC0DD353FC

View File

@ -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(() => {