summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2021-01-29 05:08:38 -0500
committerBen Sima <ben@bsima.me>2021-01-29 05:08:38 -0500
commite7d5f889524447dfc74e727b2a2ff7dd27e6914d (patch)
treedac3b814aac1b1936eea2e11807d3ab2afb55bbc
parent308fba10204b8898b6b14fb481fb7de2088abf09 (diff)
Add Invoice option
-rw-r--r--Biz/Devalloc.hs27
1 files changed, 21 insertions, 6 deletions
diff --git a/Biz/Devalloc.hs b/Biz/Devalloc.hs
index 0e214d8..c6a86b4 100644
--- a/Biz/Devalloc.hs
+++ b/Biz/Devalloc.hs
@@ -148,6 +148,7 @@ data Subscription = Free | Invoice
instance Web.FromForm Subscription where
fromForm f = case Web.parseUnique "user-subscription" f of
Right "Free" -> Right Free
+ Right "Invoice" -> Right Invoice
Right x -> Left <| "could not parse form value: " <> x
Left x -> Left <| "could not parse form value: " <> x
@@ -881,10 +882,15 @@ instance Lucid.ToHtml Analyses where
"Analyze one of your repos"
Lucid.div_ <| do
forM_ analyses <| \Analysis {..} ->
- Lucid.a_ [href analysisId, style <| Biz.Look.marginAll (em 1)] <| do
- Lucid.div_ <| Lucid.toHtml url
- Lucid.div_ [style <| Clay.fontSizeCustom Clay.Font.small]
- <| Lucid.toHtml commit
+ Lucid.a_
+ [ href analysisId,
+ style <| Biz.Look.marginAll (em 1)
+ <> Clay.textDecoration Clay.none
+ ]
+ <| do
+ Lucid.div_ <| Lucid.toHtml url
+ Lucid.div_ [style <| Clay.fontSizeCustom Clay.Font.small]
+ <| Lucid.toHtml commit
footer
where
href aid = Lucid.linkHref_ "/" <| fieldLink getAnalysis aid
@@ -912,12 +918,21 @@ instance Lucid.ToHtml UserAccount where
let name = "user-subscription"
Lucid.label_ [Lucid.for_ name] "Your plan:"
Lucid.select_ [Lucid.name_ name] <| do
- Lucid.option_ [Lucid.value_ "Free"] <| Lucid.toHtml userSubscription
+ Lucid.option_
+ (Lucid.value_ "Free" : isSelected Free)
+ <| Lucid.toHtml Free
+ Lucid.option_
+ (Lucid.value_ "Invoice" : isSelected Invoice)
+ <| Lucid.toHtml Invoice
Lucid.input_ [Lucid.type_ "submit", Lucid.value_ "Save"]
when (userSubscription == Invoice) <| do
- Lucid.p_ "You will received an invoice by email next month."
+ Lucid.p_ "Thanks! You will receive an invoice by email every month."
footer
where
+ isSelected sel =
+ if userSubscription == sel
+ then [Lucid.selected_ <| tshow sel]
+ else mempty
UserEmail email = userEmail
style :: Clay.Css -> Lucid.Attribute