import { List, ListItem, Divider, Box } from '@material-ui/core'; import { makeStyles } from '@material-ui/core/styles'; import { ClassNameMap } from '@material-ui/styles'; import Panel from './Panel'; import PeriodicFetch from '../lib/fetchers/periodicFetch'; import { HeaderText, BodyText } from './Text'; import { BLUE, GREY, TEXT, HOVER } from '../lib/consts/DEFAULT_THEME'; const useStyles = makeStyles(() => ({ root: { width: '100%', }, divider: { background: TEXT, }, button: { '&:hover': { backgroundColor: HOVER, }, paddingLeft: 0, }, noPaddingLeft: { paddingLeft: 0, }, decorator: { width: '20px', height: '100%', borderRadius: 2, }, started: { backgroundColor: BLUE, }, stopped: { backgroundColor: GREY, }, })); const selectDecorator = ( state: string, ): keyof ClassNameMap<'started' | 'stopped'> => { switch (state) { case 'Started': return 'started'; case 'Stopped': return 'stopped'; default: return 'stopped'; } }; const Servers = ({ anvil }: { anvil: AnvilListItem }): JSX.Element => { const classes = useStyles(); const { data } = PeriodicFetch( `${process.env.NEXT_PUBLIC_API_URL}/anvils/get_servers?anvil_uuid=`, anvil?.anvil_uuid, ); return ( {data && data.servers.map((server: AnvilServer) => { return ( <>
{server.server_state === 'Started' && ( )} ); })} ); }; export default Servers;