From 8113a5ffca4bcb76a2d07c5ebf92abb586cbae0a Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Thu, 20 Oct 2022 15:54:37 -0400 Subject: add WeekSelection to state (WIP) --- repgoal.hs | 9 ++++++--- 1 file 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 format = if floor (n * 10) `mod` 10 == (0 :: Integer) then "%.0f" else "%.2f" drawUI :: St -> [Widget ()] -drawUI (St lifts) = [vCenter $ vBox [hCenter oneRepMaxTable, withVScrollBarHandles $ withVScrollBars OnRight $ viewport () Vertical $ hCenter lastSetTable]] +drawUI (St lifts _) = [vCenter $ vBox [hCenter oneRepMaxTable, withVScrollBarHandles $ withVScrollBars OnRight $ viewport () Vertical $ hCenter lastSetTable]] where lastSetTable = renderTable $ table $ map (padLeftRight 1 . str) ["Lift", "Week", "Last Set", "Goal", "Goal+1"] : concatMap toWeekRows lifts 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 -- TODO: State contains chosen repmax formula -- TODO: State contains performances data St = St { - lifts :: [LiftRecord] + lifts :: [LiftRecord], + week :: WeekSelection } +data WeekSelection = Week1 | Week2 | Week3 deriving Enum + -- TODO: Event for inotify on edited text file (as input interface) data CustomEvent = CustomEvent @@ -204,4 +207,4 @@ main = do vty <- buildVty -- liftIO $ setMode (outputIface vty) Mouse True chan <- newBChan 10 - void $ customMain vty buildVty (Just chan) (theApp) (St initial) + void $ customMain vty buildVty (Just chan) (theApp) (St initial Week1) -- cgit v1.2.3