import classes from "./switch-space.module.css"; import { useNavigate } from "react-router-dom"; import { SpaceSelect } from "./space-select"; import { getSpaceUrl } from "@/lib/config"; import { Button, Popover, Text } from "@mantine/core"; import { IconChevronDown } from "@tabler/icons-react"; import { useDisclosure } from "@mantine/hooks"; import { CustomAvatar } from "@/components/ui/custom-avatar.tsx"; import { AvatarIconType } from "@/features/attachments/types/attachment.types.ts"; import React from "react"; interface SwitchSpaceProps { spaceName: string; spaceSlug: string; spaceIcon?: string; } export function SwitchSpace({ spaceName, spaceSlug, spaceIcon, }: SwitchSpaceProps) { const navigate = useNavigate(); const [opened, { close, open, toggle }] = useDisclosure(false); const handleSelect = (value: string) => { if (value) { navigate(getSpaceUrl(value)); close(); } }; return ( handleSelect(space.slug)} width={300} opened={true} /> ); }