From b49856d17097b799f39a63df3a229b3b526ce1e9 Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Thu, 14 Nov 2024 03:50:19 +0100 Subject: [PATCH] Some more explanations on different buttons' actions. --- src/App/Page/DomainList.purs | 10 +++++----- src/Bulma.purs | 23 +++++++++++++++++++++-- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/App/Page/DomainList.purs b/src/App/Page/DomainList.purs index 3ad7dc2..b379f44 100644 --- a/src/App/Page/DomainList.purs +++ b/src/App/Page/DomainList.purs @@ -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 diff --git a/src/Bulma.purs b/src/Bulma.purs index 54571cb..0cb9995 100644 --- a/src/Bulma.purs +++ b/src/Bulma.purs @@ -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"