From 00338e431b2738fdd2ab6766c2cafc990bc0b2d9 Mon Sep 17 00:00:00 2001 From: DaneEveritt Date: Sat, 25 Jun 2022 21:29:41 -0400 Subject: [PATCH] Automatically hide the kill modal when server stops --- .../scripts/components/server/console/PowerButtons.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/resources/scripts/components/server/console/PowerButtons.tsx b/resources/scripts/components/server/console/PowerButtons.tsx index b2a789b78..07b10714b 100644 --- a/resources/scripts/components/server/console/PowerButtons.tsx +++ b/resources/scripts/components/server/console/PowerButtons.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { Button } from '@/components/elements/button/index'; import Can from '@/components/elements/Can'; import { ServerContext } from '@/state/server'; @@ -27,6 +27,12 @@ export default ({ className }: PowerButtonProps) => { } }; + useEffect(() => { + if (status === 'offline') { + setOpen(false); + } + }, [ status ]); + return (