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:
parent
f975ce304a
commit
c6bda1b7dd
@ -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(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user