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

feat(GuildItem): navigation

This commit is contained in:
Puyodead1 2023-04-28 17:34:46 -04:00
parent 2db6962485
commit c3c8925b94
No known key found for this signature in database
GPG Key ID: A4FA4FEC0DD353FC

View File

@ -1,4 +1,5 @@
import { CDNRoutes, ImageFormat } from "@spacebarchat/spacebar-api-types/v9";
import { useNavigate } from "react-router-dom";
import styled from "styled-components";
import { useAppStore } from "../stores/AppStore";
import REST from "../utils/REST";
@ -32,13 +33,18 @@ interface Props {
*/
function GuildItem(props: Props) {
const app = useAppStore();
const navigate = useNavigate();
const guild = app.guilds.get(props.guildId);
if (!guild) return null;
const doNavigate = () => {
navigate(`/channels/${props.guildId}`);
};
return (
<Tooltip title={guild.name} placement="right">
<Wrapper>
<Wrapper onClick={doNavigate}>
{guild.icon ? (
<img
src={REST.makeCDNUrl(