import { Hash, VolumeFull } from "@styled-icons/boxicons-regular"; import { observer } from "mobx-react-lite"; import { Channel } from "revolt.js/dist/maps/Channels"; import { useContext } from "preact/hooks"; import { AppContext } from "../../context/revoltjs/RevoltClient"; import { ImageIconBase, IconBaseProps } from "./IconBase"; import fallback from "./assets/group.png"; interface Props extends IconBaseProps { isServerChannel?: boolean; } export default observer( ( props: Props & Omit, keyof Props>, ) => { const client = useContext(AppContext); const { size, target, attachment, isServerChannel: server, animate, children, as, ...imgProps } = props; const iconURL = client.generateFileURL( target?.icon ?? attachment, { max_side: 256 }, animate, ); const isServerChannel = server || (target && (target.channel_type === "TextChannel" || target.channel_type === "VoiceChannel")); if (typeof iconURL === "undefined") { if (isServerChannel) { if (target?.channel_type === "VoiceChannel") { return ; } return ; } } return ( // ! fixme: replace fallback with +