From 6db9f65e0ff4272db5d9c470de317e055224285c Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 29 Jun 2019 16:59:50 -0700 Subject: [PATCH] Hide spinner when connected to websocket --- .../scripts/components/server/Console.tsx | 7 ++++-- .../components/server/ServerConsole.tsx | 24 ++++++++++++------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/resources/scripts/components/server/Console.tsx b/resources/scripts/components/server/Console.tsx index f30d35a6..0eca83d1 100644 --- a/resources/scripts/components/server/Console.tsx +++ b/resources/scripts/components/server/Console.tsx @@ -2,6 +2,8 @@ import React, { createRef, useEffect, useRef } from 'react'; import { Terminal } from 'xterm'; import * as TerminalFit from 'xterm/lib/addons/fit/fit'; import SpinnerOverlay from '@/components/elements/SpinnerOverlay'; +import { State, useStoreState } from 'easy-peasy'; +import { ApplicationState } from '@/state/types'; const theme = { background: 'transparent', @@ -25,8 +27,9 @@ const theme = { }; export default () => { - const ref = createRef(); + const connected = useStoreState((state: State) => state.server.socket.connected); + const ref = createRef(); const terminal = useRef(new Terminal({ disableStdin: true, cursorStyle: 'underline', @@ -50,7 +53,7 @@ export default () => { return (
- +
( -
-
- +export default () => { + const status = useStoreState((state: State) => state.server.status); + + return ( +
+
+ +
+
+

Current status: {status}

+
-
-

Testing

-
-
-); + ); +};