summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@cryptonomic.net>2022-09-15 12:19:32 -0400
committerAndrew Cady <d@cryptonomic.net>2022-09-15 12:19:32 -0400
commit1058238ed858554ab0f76c45ec533e9520603a48 (patch)
tree3210f24a9029cafaf5c3ab4fb4bbd48bdccf4402
parent5e1eb34db0e5656544ea717e49a663680201b5b9 (diff)
tweak widget code
-rwxr-xr-xcountdown.hs57
1 files changed, 27 insertions, 30 deletions
diff --git a/countdown.hs b/countdown.hs
index 7d9299c..6e300ad 100755
--- a/countdown.hs
+++ b/countdown.hs
@@ -134,36 +134,33 @@ countdownWidget isSimulated t =
134 (borderWithLabel (str "Progress through year") $ 134 (borderWithLabel (str "Progress through year") $
135 (str "\n") 135 (str "\n")
136 <=> 136 <=>
137 ((borderWithLabel (str $ printf "%d" currentYear) 137 (hCenter $ hBox
138 (str $ printf "%d day%s remain%s\n%s hour%s remain%s\n%s second%s remain%s" 138 [ (borderWithLabel (str $ printf "%d" currentYear)
139 daysLeft 139 (str $ printf "%d day%s remain%s\n%s hour%s remain%s\n%s second%s remain%s"
140 (pluralize daysLeft) 140 daysLeft
141 (pluralizeVerb daysLeft) 141 (pluralize daysLeft)
142 (commasF 2 hoursLeft) 142 (pluralizeVerb daysLeft)
143 (pluralize $ (floor hoursLeft :: Integer)) 143 (commasF 2 hoursLeft)
144 (pluralizeVerb $ (floor hoursLeft :: Integer)) 144 (pluralize $ (floor hoursLeft :: Integer))
145 (commas secondsLeft) 145 (pluralizeVerb $ (floor hoursLeft :: Integer))
146 (pluralize secondsLeft) 146 (commas secondsLeft)
147 (pluralizeVerb secondsLeft))) 147 (pluralize secondsLeft)
148 <+> 148 (pluralizeVerb secondsLeft)))
149 (borderWithLabel (str "Cosmic Countdown") $ 149 , (borderWithLabel (str "Cosmic Countdown") $
150 (str $ printf "%s years ago" (commas $ (floor cosmicYearsAgo :: Integer))) 150 vBox [ (str $ printf "%s years ago" (commas $ (floor cosmicYearsAgo :: Integer)))
151 <=> 151 , (str "\n\n")
152 (str "\n\n") 152 -- , (str $ printf "%s billion years ago" (commasF 9 $ cosmicYearsAgo / (1000*1000*1000)))
153 <=> 153 -- , (str $ printf "%s million years ago" (commasF 6 $ cosmicYearsAgo / (1000*1000)))
154 (str $ printf "%s billion years ago" (commasF 9 $ cosmicYearsAgo / (1000*1000*1000))) 154 -- , (str $ printf "%s thousand years ago" (commasF 3 $ cosmicYearsAgo / 1000))
155 <=> 155 , (str $ printf "%s days ago" (commas $ (floor $ realToFrac cosmicYearsAgo * daysPerYear :: Integer)))
156 (str $ printf "%s million years ago" (commasF 6 $ cosmicYearsAgo / (1000*1000))) 156 ])
157 <=> 157 ])
158 (str $ printf "%s thousand years ago" (commasF 3 $ cosmicYearsAgo / 1000)) 158 <=>
159 <=> 159 (borderWithLabel (str progressLabel) $
160 (str $ printf "%s days ago" (commas $ (floor $ realToFrac cosmicYearsAgo * daysPerYear :: Integer)))) 160 updateAttrMap
161 <=> 161 (A.mapAttrName yDoneAttr P.progressCompleteAttr .
162 (borderWithLabel (str progressLabel) $ 162 A.mapAttrName yToDoAttr P.progressIncompleteAttr) $
163 updateAttrMap 163 progressBar Nothing (realToFrac $ yearElapsed // yearLength))
164 (A.mapAttrName yDoneAttr P.progressCompleteAttr .
165 A.mapAttrName yToDoAttr P.progressIncompleteAttr) $
166 progressBar Nothing (realToFrac $ yearElapsed // yearLength)))
167 <=> 164 <=>
168 (hCenter $ str $ printf "\nDay #%d of %d in %d\nSecond #%s of %s in %d" 165 (hCenter $ str $ printf "\nDay #%d of %d in %d\nSecond #%s of %s in %d"
169 dayNum 166 dayNum