import { useQuery } from "react-query"; import { fetchGuildInfo } from "../../api"; import { GuildError } from "./GuildError"; import { createPortal, PropsWithChildren } from "preact/compat"; import { Import } from "../Import"; import { useGuild } from "../App/useGuild"; import { Link } from "wouter"; import { usePathname } from "wouter/use-browser-location"; import "./index.scss"; export const Guild = ({ children }: PropsWithChildren) => { const guild = useGuild(); const { isSuccess, data: guildInfo } = useQuery(fetchGuildInfo(guild)); if (!isSuccess) { return <>; } else if (guildInfo.error) { return ; } else { const importModal = createPortal(, document.getElementById("bottom-sidebar")); const path = usePathname(); return ( <> {importModal} {children} ); } };