Compare commits
No commits in common. "b4a75feca0a0316a41ebc6570ea4cfad361b11c5" and "4181c86c821660d5e34b084ebb3403596c354d2d" have entirely different histories.
b4a75feca0
...
4181c86c82
@ -92,10 +92,8 @@ data Action
|
||||
| UpdateMyDomains (Array String)
|
||||
|
||||
| HandleNewDomainInput NewDomainFormAction
|
||||
| AskDomainTransferUUIDInput String
|
||||
|
||||
| NewDomainAttempt Event
|
||||
| AskDomainTransferAttempt Event
|
||||
| RemoveDomain String
|
||||
| EnterDomain String
|
||||
|
||||
@ -105,9 +103,8 @@ data Action
|
||||
| Initialize
|
||||
| Finalize
|
||||
|
||||
-- | The form only has two visible elements:
|
||||
-- | The form only has two elements:
|
||||
-- | the subdomain name input and the selected TLD.
|
||||
-- | The type also includes validation errors.
|
||||
|
||||
type NewDomainFormState
|
||||
= { new_domain :: String
|
||||
@ -115,17 +112,11 @@ type NewDomainFormState
|
||||
, selected_domain :: String
|
||||
}
|
||||
|
||||
-- | The form "askDomainTransfer" is simple enough: an input for the UUID and a button.
|
||||
-- | The type also includes validation errors.
|
||||
|
||||
type AskDomainTransferState = { uuid :: String, _errors :: Array Validation.Error }
|
||||
|
||||
-- | The entire component's state contains the form, accepted domains,
|
||||
-- | the list of own domains and a boolean to know if the connection is up.
|
||||
|
||||
type State =
|
||||
{ newDomainForm :: NewDomainFormState
|
||||
, askDomainTransferForm :: AskDomainTransferState
|
||||
, accepted_domains :: Array String
|
||||
, my_domains :: Array String
|
||||
|
||||
@ -152,27 +143,21 @@ default_domain = "netlib.re"
|
||||
|
||||
initialState :: Input -> State
|
||||
initialState _ =
|
||||
{ newDomainForm: { new_domain: "", _errors: [], selected_domain: default_domain }
|
||||
, askDomainTransferForm: { uuid: "", _errors: [] }
|
||||
{ newDomainForm: { new_domain: ""
|
||||
, _errors: []
|
||||
, selected_domain: default_domain
|
||||
}
|
||||
, accepted_domains: [ default_domain ]
|
||||
, my_domains: [ ]
|
||||
, active_modal: Nothing
|
||||
}
|
||||
|
||||
render :: forall m. State -> H.ComponentHTML Action () m
|
||||
render { accepted_domains, my_domains, newDomainForm, askDomainTransferForm, active_modal }
|
||||
render { accepted_domains, my_domains, newDomainForm, active_modal }
|
||||
= Bulma.section_small
|
||||
[ case active_modal of
|
||||
Nothing -> Bulma.columns_
|
||||
[ Bulma.column_ [ Bulma.h3 "New domain", render_add_domain_form
|
||||
, Bulma.hr
|
||||
, Bulma.h3 "Ask for a domain transfer"
|
||||
, Bulma.simple_quote """
|
||||
Someone wants to give you the ownership of a domain.
|
||||
Please enter the UUID of the transfer.
|
||||
"""
|
||||
, render_ask_domain_transfer_form
|
||||
]
|
||||
[ Bulma.column_ [ Bulma.h3 "New domain", render_add_domain_form]
|
||||
, Bulma.column_ [ Bulma.h3 "My domains"
|
||||
, if A.length my_domains > 0
|
||||
then HH.ul_ $ map (\domain -> HH.li_ (domain_buttons domain)) $ A.sort my_domains
|
||||
@ -211,17 +196,6 @@ render { accepted_domains, my_domains, newDomainForm, askDomainTransferForm, act
|
||||
else HH.div_ [ ]
|
||||
]
|
||||
|
||||
render_ask_domain_transfer_form = HH.form
|
||||
[ HE.onSubmit AskDomainTransferAttempt ]
|
||||
[ Bulma.box_input "idTransferToken" "Transfer Token" "UUID of the domain"
|
||||
AskDomainTransferUUIDInput
|
||||
askDomainTransferForm.uuid
|
||||
, Bulma.btn_validation_ "ask for a domain transfer"
|
||||
, if A.length askDomainTransferForm._errors > 0
|
||||
then HH.div_ $ map error_to_paragraph_label askDomainTransferForm._errors
|
||||
else HH.div_ [ ]
|
||||
]
|
||||
|
||||
domain_choice :: Int -> Action
|
||||
domain_choice i
|
||||
= HandleNewDomainInput <<< UpdateSelectedDomain $ maybe default_domain (\x -> x) $ accepted_domains A.!! i
|
||||
@ -255,9 +229,6 @@ handleAction = case _ of
|
||||
Right _ -> H.modify_ _ { newDomainForm { _errors = [] } }
|
||||
UpdateSelectedDomain domain -> H.modify_ _ { newDomainForm { selected_domain = domain } }
|
||||
|
||||
AskDomainTransferUUIDInput str -> do
|
||||
H.modify_ _ { askDomainTransferForm { uuid = toLower str } }
|
||||
|
||||
EnterDomain domain -> do
|
||||
H.raise $ ChangePageZoneInterface domain
|
||||
|
||||
@ -278,7 +249,7 @@ handleAction = case _ of
|
||||
|
||||
case newDomainForm.new_domain, newDomainForm._errors, new_domain of
|
||||
"", _, _ ->
|
||||
H.raise $ Log $ UnableToSend "You didn't enter the new domain."
|
||||
H.raise $ Log $ UnableToSend "You didn't enter the new domain!"
|
||||
_, [], _ -> do
|
||||
message <- H.liftEffect
|
||||
$ DNSManager.serialize
|
||||
@ -289,23 +260,6 @@ handleAction = case _ of
|
||||
_, _, _ ->
|
||||
H.raise $ Log $ UnableToSend $ "The new domain name is invalid."
|
||||
|
||||
AskDomainTransferAttempt ev -> do
|
||||
H.liftEffect $ Event.preventDefault ev
|
||||
|
||||
{ askDomainTransferForm } <- H.get
|
||||
case askDomainTransferForm.uuid, askDomainTransferForm._errors of
|
||||
"", _ ->
|
||||
H.raise $ Log $ UnableToSend "You didn't enter the UUID of the transfer."
|
||||
uuid, [] -> do
|
||||
--message <- H.liftEffect
|
||||
-- $ DNSManager.serialize
|
||||
-- $ DNSManager.MkNewDomain { domain: new_domain }
|
||||
--H.raise $ MessageToSend message
|
||||
H.raise $ Log $ SystemLog $ "TODO: Ask for a domain transfer (" <> uuid <> ")."
|
||||
handleAction $ AskDomainTransferUUIDInput ""
|
||||
_, _ ->
|
||||
H.raise $ Log $ UnableToSend $ "The UUID is invalid."
|
||||
|
||||
handleQuery :: forall a m. MonadAff m => Query a -> H.HalogenM State Action () Output m (Maybe a)
|
||||
handleQuery = case _ of
|
||||
|
||||
|
@ -1154,8 +1154,8 @@ render_resources records
|
||||
|
||||
show_token_or_btn rr =
|
||||
case rr.rrtype of
|
||||
"A" -> Bulma.btn_ (C.is_small) "🏁 Ask for a token" (NewToken rr.rrid)
|
||||
"AAAA" -> Bulma.btn_ (C.is_small) "🏁 Ask for a token" (NewToken rr.rrid)
|
||||
"A" -> Bulma.btn_ (C.is_small) "🏁 Ask for a token!" (NewToken rr.rrid)
|
||||
"AAAA" -> Bulma.btn_ (C.is_small) "🏁 Ask for a token!" (NewToken rr.rrid)
|
||||
_ -> HH.text ""
|
||||
|
||||
fancy_qualifier_display :: RR.Qualifier -> String
|
||||
|
@ -544,11 +544,6 @@ div_content content = HH.div [HP.classes (C.content)] content
|
||||
explanation :: forall w i. Array (HH.HTML w i) -> HH.HTML w i
|
||||
explanation content = HH.blockquote [HP.classes [HH.ClassName "justified"]] content
|
||||
|
||||
quote :: forall w i. Array (HH.HTML w i) -> HH.HTML w i
|
||||
quote content = div_content [ explanation content ]
|
||||
|
||||
simple_quote :: forall w i. String -> HH.HTML w i
|
||||
simple_quote content = quote [ p content ]
|
||||
|
||||
tabs :: forall w i. Array HH.ClassName -> Array (HH.HTML w i) -> HH.HTML w i
|
||||
tabs classes tab_list = HH.div [HP.classes $ C.tabs <> classes] [HH.ul_ tab_list]
|
||||
|
Loading…
Reference in New Issue
Block a user