From 83393df37e59516cb10f64eea75ced798551795b Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Sun, 31 Mar 2024 19:52:21 +0200 Subject: [PATCH] Display: a lot of small changes. --- src/App/Container.purs | 4 ++-- src/App/DisplayErrors.purs | 8 ++++---- src/App/Page/Authentication.purs | 2 +- src/App/Page/DomainList.purs | 8 +++++--- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/App/Container.purs b/src/App/Container.purs index 7f5aa93..fca17ef 100644 --- a/src/App/Container.purs +++ b/src/App/Container.purs @@ -606,7 +606,6 @@ handleAction = case _ of (AuthD.GotToken msg) -> do handleAction $ Log $ SuccessLog $ "Authenticated to authd!" H.modify_ _ { token = Just msg.token } - handleAction $ AddNotif $ GoodNotification "Authenticated!" handleAction $ ToggleAuthenticated (Just msg.token) sessionstorage <- H.liftEffect $ Window.sessionStorage =<< HTML.window @@ -720,10 +719,11 @@ handleAction = case _ of m@(DNSManager.MkLogged logged_message) -> do handleAction $ Log $ SuccessLog $ "Authenticated to dnsmanagerd!" H.tell _nav unit $ NavigationInterface.ToggleAdmin logged_message.admin + handleAction $ AddNotif $ GoodNotification "You are now authenticated!" handleAction $ DispatchDNSMessage m m@(DNSManager.MkDomainAdded response) -> do handleAction $ Log $ SuccessLog $ "Domain added: " <> response.domain - handleAction $ AddNotif $ GoodNotification $ "You just registered the domain \"" + handleAction $ AddNotif $ GoodNotification $ "You have just registered the domain \"" <> response.domain <> "\"! 🥳 You can now manage it (click on its button)." handleAction $ DispatchDNSMessage m (DNSManager.MkRRReadOnly response) -> do diff --git a/src/App/DisplayErrors.purs b/src/App/DisplayErrors.purs index c777a2e..e18491c 100644 --- a/src/App/DisplayErrors.purs +++ b/src/App/DisplayErrors.purs @@ -87,7 +87,7 @@ show_error_domain e = case e of _ -> Bulma.p """ The domain (or label) contains invalid characters. A domain label should start with a letter, - then eventually a series of letters, digits and hyphenations ('-'), + then eventually a series of letters, digits and hyphenations ("-"), and must finish with either a letter or a digit. """ @@ -147,10 +147,10 @@ error_to_paragraph_label v = Bulma.error_message (Bulma.p $ show_error_title_lab show_error_title_label :: ValidationLabel.Error -> String show_error_title_label v = case v of ValidationLabel.ParsingError x -> case x.error of - Nothing -> "Cannot parse the label (position: " <> show x.position <> ")." + Nothing -> "Invalid label" Just (ValidationLabel.CannotParse _) -> - "Cannot parse the label (position: " <> show x.position <> ")." - Just (ValidationLabel.CannotEntirelyParse) -> "Cannot entirely parse the label." + "Invalid label" + Just (ValidationLabel.CannotEntirelyParse) -> "Invalid label (cannot entirely parse the label)" Just (ValidationLabel.Size min max n) -> "Label size should be between " <> show min <> " and " <> show max <> " (current size: " <> show n <> ")." diff --git a/src/App/Page/Authentication.purs b/src/App/Page/Authentication.purs index 82d07a3..068d4f1 100644 --- a/src/App/Page/Authentication.purs +++ b/src/App/Page/Authentication.purs @@ -348,7 +348,7 @@ handleAction = case _ of let { login, token, password, confirmation} = newPasswordForm if A.any (_ == "") [ login, token, password, confirmation ] - then H.raise $ Log $ ErrorLog "All entries are required" + then H.raise $ Log $ ErrorLog "All entries are required." else if password == confirmation then case L.login login, P.password password of Left errors, _ -> H.modify_ _ { errors = [ Login errors ] } diff --git a/src/App/Page/DomainList.purs b/src/App/Page/DomainList.purs index 49d71e8..44f7fb1 100644 --- a/src/App/Page/DomainList.purs +++ b/src/App/Page/DomainList.purs @@ -164,7 +164,9 @@ render { accepted_domains, my_domains, newDomainForm, wsUp, active_modal } Nothing -> Bulma.columns_ [ Bulma.column_ [ Bulma.h3 "New domain", render_add_domain_form] , Bulma.column_ [ Bulma.h3 "My domains" - , HH.ul_ $ map (\domain -> HH.li_ (domain_buttons domain)) my_domains + , if A.length my_domains > 0 + then HH.ul_ $ map (\domain -> HH.li_ (domain_buttons domain)) $ A.sort my_domains + else Bulma.p "No domain yet." ] ] Just domain -> Bulma.modal "Deleting a domain" @@ -261,7 +263,7 @@ handleAction = case _ of H.raise $ Log $ SystemLog $ "Add a new domain (" <> new_domain <> ")" handleAction $ HandleNewDomainInput $ INP_newdomain "" _, _ -> - H.raise $ Log $ UnableToSend $ "You didn't enter a valid new domain" + H.raise $ Log $ UnableToSend $ "The new domain name is invalid." handleQuery :: forall a m. MonadAff m => Query a -> H.HalogenM State Action () Output m (Maybe a) handleQuery = case _ of @@ -303,7 +305,7 @@ page_reload s1 message = case message of DNSManager.MkLogged response -> s1 { accepted_domains = response.accepted_domains - , my_domains = response.my_domains + , my_domains = A.sort response.my_domains } _ -> s1