about summary refs log tree commit diff
path: root/scratch/habit-screens
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-10-11T13·58+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-10-11T13·58+0100
commit1c8a8f5d2c2b9a20f679fa3bead491948571d5f2 (patch)
tree3410237af2642e1a0a29ad761fef682dcb9e829a /scratch/habit-screens
parentea0cd01e186a0bdd9008b02e6945cefb32b6f415 (diff)
Expand Habit type
Include:

- habitType: Daily, Weekly, Yearly... what's the trigger?
- minutesDuration: Estimation of how long it'll take to complete
Diffstat (limited to 'scratch/habit-screens')
-rw-r--r--scratch/habit-screens/client/src/Habits.elm161
-rw-r--r--scratch/habit-screens/client/src/State.elm14
2 files changed, 127 insertions, 48 deletions
diff --git a/scratch/habit-screens/client/src/Habits.elm b/scratch/habit-screens/client/src/Habits.elm
index a1432f8183b2..5b0fdea9e628 100644
--- a/scratch/habit-screens/client/src/Habits.elm
+++ b/scratch/habit-screens/client/src/Habits.elm
@@ -12,74 +12,138 @@ import UI
 
 morning : List State.Habit
 morning =
-    [ "Make bed"
-    , "Brush teeth"
-    , "Shower"
-    , "Do push-ups"
-    , "Meditate"
-    ]
+    List.map
+        (\( duration, x ) ->
+            { label = x
+            , habitType = State.Morning
+            , minutesDuration = duration
+            }
+        )
+        [ ( 1, "Make bed" )
+        , ( 2, "Brush teeth" )
+        , ( 10, "Shower" )
+        , ( 1, "Do push-ups" )
+        , ( 10, "Meditate" )
+        ]
 
 
 evening : List State.Habit
 evening =
-    [ "Read (30 minutes)"
-    , "Record in State.Habit Journal"
-    ]
-
-
-monday : List State.Habit
+    List.map
+        (\( duration, x ) ->
+            { label = x
+            , habitType = State.Evening
+            , minutesDuration = duration
+            }
+        )
+        [ ( 30, "Read" )
+        , ( 1, "Record in State.Habit Journal" )
+        ]
+
+
+monday : List ( Int, String )
 monday =
-    [ "Bikram Yoga @ 17:00 (90 min)"
+    [ ( 90, "Bikram Yoga @ 17:00" )
     ]
 
 
-tuesday : List State.Habit
+tuesday : List ( Int, String )
 tuesday =
-    [ "Bikram Yoga @ 18:00 (90 min)"
+    [ ( 90, "Bikram Yoga @ 18:00" )
     ]
 
 
-wednesday : List State.Habit
+wednesday : List ( Int, String )
 wednesday =
-    [ "Shave"
-    , "Bikram Yoga @ 17:00 (90 min)"
+    [ ( 5, "Shave" )
+    , ( 90, "Bikram Yoga @ 17:00" )
     ]
 
 
-thursday : List State.Habit
+thursday : List ( Int, String )
 thursday =
     []
 
 
-friday : List State.Habit
+friday : List ( Int, String )
 friday =
-    [ "Bikram Yoga @ 17:00 (60 min)"
-    , "Take-out trash"
-    , "Shop for groceries"
+    [ ( 60, "Bikram Yoga @ 17:00" )
+    , ( 3, "Take-out trash" )
+    , ( 60, "Shop for groceries" )
     ]
 
 
-saturday : List State.Habit
+saturday : List ( Int, String )
 saturday =
-    [ "Warm Yin Yoga @ 15:00 (60 min)"
+    [ ( 60, "Warm Yin Yoga @ 15:00" )
     ]
 
 
-sunday : List State.Habit
+sunday : List ( Int, String )
 sunday =
-    [ "Shampoo"
-    , "Shave"
-    , "Trim nails"
-    , "Combine trash cans"
-    , "Mop tile and wood floors"
-    , "Laundry"
-    , "Vacuum bedroom"
-    , "Dust surfaces"
-    , "Clean mirrors"
-    , "Clean desk"
+    [ ( 1, "Shampoo" )
+    , ( 5, "Shave" )
+    , ( 1, "Trim nails" )
+    , ( 1, "Combine trash cans" )
+    , ( 10, "Mop tile and wood floors" )
+    , ( 10, "Laundry" )
+    , ( 5, "Vacuum bedroom" )
+    , ( 5, "Dust surfaces" )
+    , ( 5, "Clean mirrors" )
+    , ( 5, "Clean desk" )
     ]
 
 
+payday : List State.Habit
+payday =
+    List.map
+        (\( duration, x ) ->
+            { label = x
+            , habitType = State.Payday
+            , minutesDuration = duration
+            }
+        )
+        [ ( 1, "Ensure \"Emergency\" fund has a balance of 1000 GBP" )
+        , ( 1, "Open \"finances_2020\" Google Sheet" )
+        , ( 1, "Settle up with Mimi on TransferWise" )
+        , ( 1, "Adjust GBP:USD exchange rate" )
+        , ( 1, "Adjust \"Stocks (after tax)\" to reflect amount Google sent" )
+        , ( 1, "Add remaining cash to \"Carryover (cash)\"" )
+        , ( 1, "Adjust \"Paycheck\" to reflect amount Google sent" )
+        , ( 5, "In the \"International Xfer\" table, send \"Xfer amount\" from Monzo to USAA" )
+        , ( 10, "Go to an ATM and extract the amount in \"ATM withdrawal\"" )
+        , ( 0, "Await the TransferWise transaction to complete and pay MyFedLoan in USD" )
+        ]
+
+
+firstOfTheMonth : List State.Habit
+firstOfTheMonth =
+    List.map
+        (\( duration, x ) ->
+            { label = x
+            , habitType = State.FirstOfTheMonth
+            , minutesDuration = duration
+            }
+        )
+        [ ( 10, "Create habit template in journal" )
+        , ( 30, "Assess previous month's performance" )
+        , ( 5, "Register for Bikram Yoga classes" )
+        ]
+
+
+firstOfTheYear : List State.Habit
+firstOfTheYear =
+    List.map
+        (\( duration, x ) ->
+            { label = x
+            , habitType = State.FirstOfTheYear
+            , minutesDuration = duration
+            }
+        )
+        [ ( 60, "Write a post mortem for the previous year" )
+        ]
+
+
 weekdayName : Weekday -> String
 weekdayName weekday =
     case weekday of
@@ -107,28 +171,36 @@ weekdayName weekday =
 
 habitsFor : Weekday -> List State.Habit
 habitsFor weekday =
+    let
+        toHabit =
+            List.map
+                (\( duration, x ) ->
+                    { label = x
+                    , habitType = State.DayOfWeek
+                    , minutesDuration = duration
+                    }
+                )
+    in
     case weekday of
         Mon ->
-            monday
+            toHabit monday
 
         Tue ->
-            tuesday
+            toHabit tuesday
 
         Wed ->
-            wednesday
+            toHabit wednesday
 
         Thu ->
-            thursday
+            toHabit thursday
 
         Fri ->
-            friday
+            toHabit friday
 
         Sat ->
-            saturday
+            toHabit saturday
 
         Sun ->
-            sunday
-
 
 tailwind : List ( String, Bool ) -> Attribute msg
 tailwind classes =
@@ -137,6 +209,7 @@ tailwind classes =
         |> List.map (\( k, v ) -> k)
         |> String.join " "
         |> class
+            toHabit sunday
 
 
 render : State.Model -> Html State.Msg
diff --git a/scratch/habit-screens/client/src/State.elm b/scratch/habit-screens/client/src/State.elm
index 3369d843ffbe..c5cdadf3afa0 100644
--- a/scratch/habit-screens/client/src/State.elm
+++ b/scratch/habit-screens/client/src/State.elm
@@ -22,13 +22,19 @@ type View
 
 
 type HabitType
-    = Daily
-    | Weekly
-    | Yearly
+    = Morning
+    | Evening
+    | DayOfWeek
+    | Payday
+    | FirstOfTheMonth
+    | FirstOfTheYear
 
 
 type alias Habit =
-    String
+    { label : String
+    , habitType : HabitType
+    , minutesDuration : Int
+    }
 
 
 type alias Model =