Some more explanations on different buttons' actions.

caa
Philippe Pittoli 2024-11-14 03:50:19 +01:00
parent 15bb4c1526
commit b49856d170
2 changed files with 26 additions and 7 deletions

View File

@ -276,18 +276,18 @@ render { accepted_domains, my_domains, newDomainForm, askDomainTransferForm, del
[ HH.td_ [ Bulma.btn domain.name (EnterDomain domain.name) ]
, HH.td_ [ HH.text $ fromMaybe "" domain.share_key ]
, if A.length domain.owners == 1
then HH.td_ [ Bulma.alert_btn "Unshare" (UnShareDomain domain.name) ]
then HH.td_ [ Bulma.alert_btn_abbr "Unshare the domain by removing the \"share\" token." "Unshare" (UnShareDomain domain.name) ]
else HH.td_ [ Bulma.btn_ro (C.is_warning) "Cannot unshare it" ]
, HH.td_ [ Bulma.alert_btn "Delete" (DeleteDomainModal domain.name) ]
, HH.td_ [ Bulma.alert_btn_abbr "Delete the domain from your list of owned domains. In case you are the only owner, this will also remove all zone data and the domain won't be served anymore." "Delete" (DeleteDomainModal domain.name) ]
]
owned_domain_row domain = HH.tr_
[ HH.td_ [ Bulma.btn domain.name (EnterDomain domain.name) ]
, case domain.transfer_key of
Just key -> HH.td_ [ Bulma.p "Token key:", Bulma.p key ]
Nothing -> HH.td_ [ Bulma.btn "Transfer" (TransferDomain domain.name) ]
, HH.td_ [ Bulma.btn "Share" (ShareDomain domain.name) ]
, HH.td_ [ Bulma.alert_btn "Delete" (DeleteDomainModal domain.name) ]
Nothing -> HH.td_ [ Bulma.btn_abbr "Generate a token to transfer the ownership of a domain." "Transfer" (TransferDomain domain.name) ]
, HH.td_ [ Bulma.btn_abbr "Generate a token to share the ownership of a domain." "Share" (ShareDomain domain.name) ]
, HH.td_ [ Bulma.alert_btn_abbr "Delete the domain. This will remove all zone data and the domain won't be served anymore." "Delete" (DeleteDomainModal domain.name) ]
]
render_add_domain_form = HH.form

View File

@ -379,8 +379,27 @@ textarea_ classes placeholder value action
textarea :: forall w i. String -> String -> (String -> i) -> HH.HTML w i
textarea placeholder value action = textarea_ [] placeholder value action
btn_abbr_ :: forall w action.
Array HH.ClassName -- button classes
-> Array HH.ClassName -- inner div classes
-> String
-> String
-> action
-> HH.HTML w action
btn_abbr_ btnclasses divclasses explanation_ title action
= HH.button
[ HE.onClick \_ -> action
, HP.classes $ C.button <> btnclasses
] [ HH.abbr [ HP.title explanation_ ] [ HH.div [ HP.classes divclasses ] [ HH.text title ] ] ]
btn_abbr :: forall w action. String -> String -> action -> HH.HTML w action
btn_abbr explanation_ title action = btn_abbr_ [] [] explanation_ title action
alert_btn_abbr :: forall w action. String -> String -> action -> HH.HTML w action
alert_btn_abbr explanation_ title action = btn_abbr_ C.is_danger [] explanation_ title action
btn_modify :: forall w i. i -> HH.HTML w i
btn_modify action = btn_ (C.is_small <> C.is_info) "⚒" action
btn_modify action = btn_abbr_ (C.is_small <> C.is_info) (C.is_size 4) "Edit" "⚒" action
btn_save :: forall w i. i -> HH.HTML w i
btn_save action = btn_ C.is_info "Save" action
@ -389,7 +408,7 @@ btn_add :: forall w i. i -> HH.HTML w i
btn_add action = btn_ C.is_info "Add" action
btn_delete :: forall w i. i -> HH.HTML w i
btn_delete action = btn_ (C.is_small <> C.is_danger) "✖" action
btn_delete action = btn_abbr_ (C.is_small <> C.is_danger) (C.is_size 4) "Delete" "✖" action
btn_modify_ro :: forall w i. HH.HTML w i
btn_modify_ro = btn_ro (C.is_small <> C.is_warning) "modify"