From e7d5f889524447dfc74e727b2a2ff7dd27e6914d Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Fri, 29 Jan 2021 05:08:38 -0500 Subject: Add Invoice option --- Biz/Devalloc.hs | 27 +++++++++++++++++++++------ 1 file 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 -- cgit v1.2.3