summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2022-10-20 15:54:37 -0400
committerAndrew Cady <d@jerkface.net>2022-10-20 15:54:37 -0400
commit8113a5ffca4bcb76a2d07c5ebf92abb586cbae0a (patch)
tree595fff44ba4e8bb845ffc65906566a8abe5d0d41
parent9b802013a2ce72257b1511f73d0ba7459cb4d578 (diff)
add WeekSelection to state (WIP)
-rwxr-xr-xrepgoal.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/repgoal.hs b/repgoal.hs
index bc3741d..8be74b0 100755
--- a/repgoal.hs
+++ b/repgoal.hs
@@ -115,7 +115,7 @@ showRational n = printf format $ (realToFrac :: Rational -> Float) $ n
115 format = if floor (n * 10) `mod` 10 == (0 :: Integer) then "%.0f" else "%.2f" 115 format = if floor (n * 10) `mod` 10 == (0 :: Integer) then "%.0f" else "%.2f"
116 116
117drawUI :: St -> [Widget ()] 117drawUI :: St -> [Widget ()]
118drawUI (St lifts) = [vCenter $ vBox [hCenter oneRepMaxTable, withVScrollBarHandles $ withVScrollBars OnRight $ viewport () Vertical $ hCenter lastSetTable]] 118drawUI (St lifts _) = [vCenter $ vBox [hCenter oneRepMaxTable, withVScrollBarHandles $ withVScrollBars OnRight $ viewport () Vertical $ hCenter lastSetTable]]
119 where 119 where
120 lastSetTable = renderTable $ table $ map (padLeftRight 1 . str) ["Lift", "Week", "Last Set", "Goal", "Goal+1"] : concatMap toWeekRows lifts 120 lastSetTable = renderTable $ table $ map (padLeftRight 1 . str) ["Lift", "Week", "Last Set", "Goal", "Goal+1"] : concatMap toWeekRows lifts
121 oneRepMaxTable = renderTable $ table $ map (padLeftRight 1 . str) ["Lift", "Achieved Best", "Computed 1RM"] : map toRow lifts 121 oneRepMaxTable = renderTable $ table $ map (padLeftRight 1 . str) ["Lift", "Achieved Best", "Computed 1RM"] : map toRow lifts
@@ -155,9 +155,12 @@ ceilingN n x = ceiling (x / toRational n) * n
155-- TODO: State contains chosen repmax formula 155-- TODO: State contains chosen repmax formula
156-- TODO: State contains performances 156-- TODO: State contains performances
157data St = St { 157data St = St {
158 lifts :: [LiftRecord] 158 lifts :: [LiftRecord],
159 week :: WeekSelection
159} 160}
160 161
162data WeekSelection = Week1 | Week2 | Week3 deriving Enum
163
161-- TODO: Event for inotify on edited text file (as input interface) 164-- TODO: Event for inotify on edited text file (as input interface)
162data CustomEvent = CustomEvent 165data CustomEvent = CustomEvent
163 166
@@ -204,4 +207,4 @@ main = do
204 vty <- buildVty 207 vty <- buildVty
205 -- liftIO $ setMode (outputIface vty) Mouse True 208 -- liftIO $ setMode (outputIface vty) Mouse True
206 chan <- newBChan 10 209 chan <- newBChan 10
207 void $ customMain vty buildVty (Just chan) (theApp) (St initial) 210 void $ customMain vty buildVty (Just chan) (theApp) (St initial Week1)