diff options
author | Andrew Cady <d@jerkface.net> | 2022-10-20 15:54:37 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2022-10-20 15:54:37 -0400 |
commit | 8113a5ffca4bcb76a2d07c5ebf92abb586cbae0a (patch) | |
tree | 595fff44ba4e8bb845ffc65906566a8abe5d0d41 | |
parent | 9b802013a2ce72257b1511f73d0ba7459cb4d578 (diff) |
add WeekSelection to state (WIP)
-rwxr-xr-x | repgoal.hs | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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 | ||
117 | drawUI :: St -> [Widget ()] | 117 | drawUI :: St -> [Widget ()] |
118 | drawUI (St lifts) = [vCenter $ vBox [hCenter oneRepMaxTable, withVScrollBarHandles $ withVScrollBars OnRight $ viewport () Vertical $ hCenter lastSetTable]] | 118 | drawUI (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 |
157 | data St = St { | 157 | data St = St { |
158 | lifts :: [LiftRecord] | 158 | lifts :: [LiftRecord], |
159 | week :: WeekSelection | ||
159 | } | 160 | } |
160 | 161 | ||
162 | data 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) |
162 | data CustomEvent = CustomEvent | 165 | data 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) |