import { IAccountStanding } from "@sc07-canvas/lib/src/net"; import { useCallback, useEffect, useState } from "react"; import network from "../../lib/network"; import { Button, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, } from "@nextui-org/react"; export const AccountStanding = () => { const [standingInfo, setStandingInfo] = useState(false); const [standing, setStanding] = useState( network.getState("standing")?.[0] ); const handleStanding = useCallback( (standing: IAccountStanding) => { setStanding(standing); }, [setStanding] ); useEffect(() => { network.on("standing", handleStanding); return () => { network.off("standing", handleStanding); }; }, []); return ( <> {standing?.banned && (
You are banned
)} setStandingInfo(false)}> {(onClose) => ( <> Account Standing {standing?.banned ? ( <> You are banned until {standing.until}
{standing.reason ? ( <>Public reason given: {standing.reason} ) : ( <>No reason given )} ) : ( <>Your account is in good standing )}
)}
); };