From 48006c37e89619cba382f223d891f43f576cad4d Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Mon, 22 May 2023 16:23:21 +0200 Subject: [PATCH] Multiple components: still WIP but compiling. --- src/App/AuthenticationForm.purs | 8 +++++--- src/Main.purs | 10 +++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/App/AuthenticationForm.purs b/src/App/AuthenticationForm.purs index d68b101..34b762c 100644 --- a/src/App/AuthenticationForm.purs +++ b/src/App/AuthenticationForm.purs @@ -125,7 +125,7 @@ main = do HA.runHalogenAff do body <- HA.awaitBody let url = "ws://localhost:8080" - runUI rootComponent url body + runUI component url body -------------------------------------------------------------------------------- -- WebSocket message type @@ -137,6 +137,8 @@ type WebSocketMessageType = ArrayBuffer -- Root component module -------------------------------------------------------------------------------- +type Slot = H.Slot Query Void + type Query :: forall k. k -> Type type Query = Const Void type Input = String @@ -161,8 +163,8 @@ type State = , canReconnect :: Boolean } -rootComponent :: forall m. MonadAff m => H.Component Query Input Output m -rootComponent = +component :: forall m. MonadAff m => H.Component Query Input Output m +component = H.mkComponent { initialState , render diff --git a/src/Main.purs b/src/Main.purs index 0388129..df95dc0 100644 --- a/src/Main.purs +++ b/src/Main.purs @@ -121,11 +121,11 @@ renderError = case _ of -------------------------------------------------------------------------------- main :: Effect Unit -main = do - HA.runHalogenAff do - body <- HA.awaitBody - let url = "ws://localhost:8080" - runUI rootComponent url body +main = HA.runHalogenAff do + body <- HA.awaitBody + let url = "ws://localhost:8080" + runUI rootComponent url body + -- runUI Container.component unit body -------------------------------------------------------------------------------- -- WebSocket message type