From 480943d563d25f28b9324494939db3db617a3b7d Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Wed, 13 Mar 2024 14:50:49 +0100 Subject: [PATCH] Code cleaning: all pages in App.Page. --- src/App/Container.purs | 29 ++++++++++--------- .../Administration.purs} | 2 +- .../Authentication.purs} | 2 +- .../DomainList.purs} | 2 +- .../{HomeInterface.purs => Page/Home.purs} | 2 +- .../MailValidation.purs} | 2 +- .../Navigation.purs} | 2 +- .../Registration.purs} | 2 +- src/App/{ => Page}/Setup.purs | 2 +- .../{ZoneInterface.purs => Page/Zone.purs} | 2 +- 10 files changed, 25 insertions(+), 22 deletions(-) rename src/App/{AdministrationInterface.purs => Page/Administration.purs} (99%) rename src/App/{AuthenticationInterface.purs => Page/Authentication.purs} (99%) rename src/App/{DomainListInterface.purs => Page/DomainList.purs} (99%) rename src/App/{HomeInterface.purs => Page/Home.purs} (99%) rename src/App/{MailValidationInterface.purs => Page/MailValidation.purs} (99%) rename src/App/{NavigationInterface.purs => Page/Navigation.purs} (99%) rename src/App/{RegistrationInterface.purs => Page/Registration.purs} (99%) rename src/App/{ => Page}/Setup.purs (99%) rename src/App/{ZoneInterface.purs => Page/Zone.purs} (99%) diff --git a/src/App/Container.purs b/src/App/Container.purs index 9a801cd..61938ea 100644 --- a/src/App/Container.purs +++ b/src/App/Container.purs @@ -53,19 +53,6 @@ import Data.Array as A import Data.Maybe (Maybe(..), maybe) import Data.Either (Either(..)) import Data.Tuple (Tuple(..)) -import App.AuthenticationInterface as AI -import App.RegistrationInterface as RI -import App.MailValidationInterface as MVI -import App.Log as AppLog -import App.WS as WS -import App.AdministrationInterface as AdminInterface -import App.SetupInterface as SetupInterface -import App.DomainListInterface as DomainListInterface -import App.ZoneInterface as ZoneInterface -import App.HomeInterface as HomeInterface -import App.NavigationInterface as NavigationInterface -import App.Messages.DNSManagerDaemon as DNSManager -import App.Messages.AuthenticationDaemon as AuthD import Halogen as H import Halogen.HTML as HH import Halogen.HTML.Properties as HP @@ -73,6 +60,22 @@ import Type.Proxy (Proxy(..)) import Effect.Aff.Class (class MonadAff) import Data.ArrayBuffer.Types (ArrayBuffer) +import App.Messages.DNSManagerDaemon as DNSManager +import App.Messages.AuthenticationDaemon as AuthD + +import App.Log as AppLog +import App.WS as WS + +import App.Page.Authentication as AI +import App.Page.Registration as RI +import App.Page.MailValidation as MVI +import App.Page.Administration as AdminInterface +import App.Page.Setup as SetupInterface +import App.Page.DomainList as DomainListInterface +import App.Page.Zone as ZoneInterface +import App.Page.Home as HomeInterface +import App.Page.Navigation as NavigationInterface + import Web.HTML (window) as HTML import Web.HTML.Window (sessionStorage) as Window import Web.Storage.Storage as Storage diff --git a/src/App/AdministrationInterface.purs b/src/App/Page/Administration.purs similarity index 99% rename from src/App/AdministrationInterface.purs rename to src/App/Page/Administration.purs index b69d09c..5fbdd97 100644 --- a/src/App/AdministrationInterface.purs +++ b/src/App/Page/Administration.purs @@ -8,7 +8,7 @@ - TODO: raise a user to admin (and vice versa) - TODO: list users (getting them slowly, otherwise it will cause problems with thousands of logins) -} -module App.AdministrationInterface where +module App.Page.Administration where import Prelude (Unit, bind, discard, not, pure, show, ($), (<<<), (<>), (=<<), map, (/=)) diff --git a/src/App/AuthenticationInterface.purs b/src/App/Page/Authentication.purs similarity index 99% rename from src/App/AuthenticationInterface.purs rename to src/App/Page/Authentication.purs index e4effa4..3073261 100644 --- a/src/App/AuthenticationInterface.purs +++ b/src/App/Page/Authentication.purs @@ -1,6 +1,6 @@ -- | `App.AuthenticationInterface` is both the authentication and password recovery interface. -- | TODO: token validation. -module App.AuthenticationInterface where +module App.Page.Authentication where import Prelude (Unit, bind, discard, pure, ($), (<<<), (<>), (>), (==), map, show) diff --git a/src/App/DomainListInterface.purs b/src/App/Page/DomainList.purs similarity index 99% rename from src/App/DomainListInterface.purs rename to src/App/Page/DomainList.purs index b894cb6..aa25f37 100644 --- a/src/App/DomainListInterface.purs +++ b/src/App/Page/DomainList.purs @@ -9,7 +9,7 @@ -- | - ask for confirmation -- | - switch to the interface to show and modify the content of a Zone -- | - TODO: validate the domain before sending a message to `dnsmanagerd` -module App.DomainListInterface where +module App.Page.DomainList where import Prelude (Unit, bind, discard, map, otherwise, pure, ($), (/=), (<<<), (<>), (>)) diff --git a/src/App/HomeInterface.purs b/src/App/Page/Home.purs similarity index 99% rename from src/App/HomeInterface.purs rename to src/App/Page/Home.purs index 7f1d27f..ad9bd6b 100644 --- a/src/App/HomeInterface.purs +++ b/src/App/Page/Home.purs @@ -1,5 +1,5 @@ -- | `App.HomeInterface` presents the website and its features. -module App.HomeInterface where +module App.Page.Home where import Prelude (Unit, pure, unit, ($)) diff --git a/src/App/MailValidationInterface.purs b/src/App/Page/MailValidation.purs similarity index 99% rename from src/App/MailValidationInterface.purs rename to src/App/Page/MailValidation.purs index e825721..3abaa55 100644 --- a/src/App/MailValidationInterface.purs +++ b/src/App/Page/MailValidation.purs @@ -1,7 +1,7 @@ -- | `App.MailValidationInterface` is a simple interface for mail verification. -- | A token is sent at registration at the provided email address. -- | This token has to be used to validate the email address. -module App.MailValidationInterface where +module App.Page.MailValidation where import Prelude (Unit, bind, discard, pure, ($), (<<<), (<>), map, show) diff --git a/src/App/NavigationInterface.purs b/src/App/Page/Navigation.purs similarity index 99% rename from src/App/NavigationInterface.purs rename to src/App/Page/Navigation.purs index 80b8dbf..51e034e 100644 --- a/src/App/NavigationInterface.purs +++ b/src/App/Page/Navigation.purs @@ -3,7 +3,7 @@ -- | This module is required since some javascript is needed to toggle display of hidden resources. -- | On mobile, a burger menu is displayed and hides the navigation buttons. -- | On desktop, there is no need for this, all the navigation buttons are displayed by default. -module App.NavigationInterface where +module App.Page.Navigation where import Prelude (Unit, (<>), not, ($), discard, pure) diff --git a/src/App/RegistrationInterface.purs b/src/App/Page/Registration.purs similarity index 99% rename from src/App/RegistrationInterface.purs rename to src/App/Page/Registration.purs index 28e0e8d..4495c8b 100644 --- a/src/App/RegistrationInterface.purs +++ b/src/App/Page/Registration.purs @@ -1,6 +1,6 @@ -- | `App.RegistrationInterface` is a registration interface. -- | Registration requires a login, an email address and a password. -module App.RegistrationInterface where +module App.Page.Registration where import Prelude (Unit, bind, discard, pure, ($), (<<<), (<>), map, show) diff --git a/src/App/Setup.purs b/src/App/Page/Setup.purs similarity index 99% rename from src/App/Setup.purs rename to src/App/Page/Setup.purs index f8ba19a..04b4631 100644 --- a/src/App/Setup.purs +++ b/src/App/Page/Setup.purs @@ -1,6 +1,6 @@ -- | `App.SetupInterface` allows users to change their password or their email address. -- | Users can also erase their account. -module App.SetupInterface where +module App.Page.Setup where import Prelude (Unit, bind, discard, pure, ($), (<<<), (==)) diff --git a/src/App/ZoneInterface.purs b/src/App/Page/Zone.purs similarity index 99% rename from src/App/ZoneInterface.purs rename to src/App/Page/Zone.purs index ac1396c..9112c37 100644 --- a/src/App/ZoneInterface.purs +++ b/src/App/Page/Zone.purs @@ -16,7 +16,7 @@ -- | TODO: do not allow for the modification of read-only resource records. -- | -- | TODO: move all serialization code to a single module. -module App.ZoneInterface where +module App.Page.Zone where import Prelude (Unit, unit, void , bind, pure