From 7c9f5a7a564d90439973dea2a5c352dd32bebef5 Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Tue, 4 Jul 2023 03:11:02 +0200 Subject: [PATCH] UX --- src/App/Container.purs | 14 +++++++------- src/App/WS.purs | 5 ++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/App/Container.purs b/src/App/Container.purs index bcf6a20..01b4469 100644 --- a/src/App/Container.purs +++ b/src/App/Container.purs @@ -75,17 +75,17 @@ render state render_logs = Bulma.box [ HH.slot_ _log unit Log.component unit ] render_auth_WS :: forall monad. MonadAff monad => H.ComponentHTML Action ChildSlots monad - render_auth_WS = Bulma.box [ HH.slot _ws_auth unit WS.component "ws://127.0.0.1:8080" AuthDEvent ] + render_auth_WS = HH.slot _ws_auth unit WS.component "ws://127.0.0.1:8080" AuthDEvent render_dnsmanager_WS :: forall monad. MonadAff monad => H.ComponentHTML Action ChildSlots monad - render_dnsmanager_WS = Bulma.box $ case state.token of - Nothing -> [ Bulma.p "We don't have a token right now." ] - Just _ -> [ HH.slot _ws_dns unit WS.component "ws://127.0.0.1:8081" DNSManagerDEvent ] + render_dnsmanager_WS = case state.token of + Nothing -> Bulma.p "We don't have a token right now." + Just _ -> HH.slot _ws_dns unit WS.component "ws://127.0.0.1:8081" DNSManagerDEvent render_auth_form :: forall monad. MonadAff monad => H.ComponentHTML Action ChildSlots monad - render_auth_form = Bulma.box $ case state.token of - Nothing -> [ HH.slot _af unit AF.component unit OutputAuthComponent ] - Just current_token -> [ Bulma.p ("Token is: " <> current_token) ] + render_auth_form = case state.token of + Nothing -> Bulma.box [ HH.slot _af unit AF.component unit OutputAuthComponent ] + Just current_token -> Bulma.p ("Token is: " <> current_token) render_authd_admin_interface :: forall monad. MonadAff monad => H.ComponentHTML Action ChildSlots monad render_authd_admin_interface = Bulma.box $ case state.token of diff --git a/src/App/WS.purs b/src/App/WS.purs index 157171e..7c8da93 100644 --- a/src/App/WS.purs +++ b/src/App/WS.purs @@ -2,9 +2,8 @@ module App.WS where {- This component handles all WS operations. -} -import Prelude (Unit, bind, discard, map, pure, show, void, when, ($), (&&), (<$>), (<>), (>>=), unit) +import Prelude (Unit, bind, discard, pure, show, void, when, ($), (&&), (<$>), (<>), (>>=)) -import Bulma as Bulma import Data.Maybe (Maybe(..), isJust, isNothing) import Data.String as String @@ -113,7 +112,7 @@ handleAction action = do handleAction ConnectWebSocket Finalize -> do - H.raise $ AppendSystemMessage "Finalize" + H.raise $ AppendSystemMessage $ "Closing websocket for '" <> wsInfo.url <> "'" case wsInfo.connection of Nothing -> H.raise $ AppendSystemMessage "No socket? How is that even possible?" Just socket -> H.liftEffect $ WS.close socket