import * as React from "react"; import {RemoteIcon} from "tc-shared/file/Icons"; import {useState} from "react"; export const IconRenderer = (props: { icon: string; title?: string; className?: string; }) => { if(!props.icon) { return
; } else if(typeof props.icon === "string") { return ; } else { throw "JQuery icons are not longer supported"; } } export const RemoteIconRenderer = (props: { icon: RemoteIcon, className?: string, title?: string }) => { const [ revision, setRevision ] = useState(0); props.icon.events.reactUse("notify_state_changed", () => setRevision(revision + 1)); switch (props.icon.getState()) { case "empty": case "destroyed": return ; case "loaded": if(props.icon.iconId >= 0 && props.icon.iconId <= 1000) { if(props.icon.iconId === 0) { return ; } return ; } return (