diff --git a/resources/scripts/components/dashboard/ServerRow.tsx b/resources/scripts/components/dashboard/ServerRow.tsx index 5d8b6598e..7373fa246 100644 --- a/resources/scripts/components/dashboard/ServerRow.tsx +++ b/resources/scripts/components/dashboard/ServerRow.tsx @@ -3,7 +3,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faEthernet, faHdd, faMemory, faMicrochip, faServer } from '@fortawesome/free-solid-svg-icons'; import { Link } from 'react-router-dom'; import { Server } from '@/api/server/getServer'; -import getServerResourceUsage, { ServerStats } from '@/api/server/getServerResourceUsage'; +import getServerResourceUsage, { ServerPowerState, ServerStats } from '@/api/server/getServerResourceUsage'; import { bytesToHuman, megabytesToHuman } from '@/helpers'; import tw from 'twin.macro'; import GreyRowBox from '@/components/elements/GreyRowBox'; @@ -24,6 +24,21 @@ const IconDescription = styled.p<{ $alarm: boolean }>` ${props => props.$alarm ? tw`text-white` : tw`text-neutral-400`}; `; +const StatusIndicatorBox = styled(GreyRowBox)<{ $status: ServerPowerState | undefined }>` + ${tw`grid grid-cols-12 gap-4 relative`}; + + & .status-bar { + ${tw`w-2 bg-red-500 absolute right-0 z-20 rounded-full m-1 opacity-50 transition-all duration-150`}; + height: calc(100% - 0.5rem); + + ${({ $status }) => (!$status || $status === 'offline') ? tw`bg-red-500` : ($status === 'running' ? tw`bg-green-500` : tw`bg-yellow-500`)}; + } + + &:hover .status-bar { + ${tw`opacity-75`}; + } +`; + export default ({ server, className }: { server: Server; className?: string }) => { const interval = useRef(null); const [ stats, setStats ] = useState(null); @@ -61,15 +76,15 @@ export default ({ server, className }: { server: Server; className?: string }) = const memorylimit = server.limits.memory !== 0 ? megabytesToHuman(server.limits.memory) : 'Unlimited'; return ( - -
+ +

{server.name}

{!!server.description && -

{server.description}

+

{server.description}

}
@@ -131,16 +146,7 @@ export default ({ server, className }: { server: Server; className?: string }) = }
-
-
-
- +
+ ); };