Expand Habit type
Include: - habitType: Daily, Weekly, Yearly... what's the trigger? - minutesDuration: Estimation of how long it'll take to complete
This commit is contained in:
parent
ea0cd01e18
commit
1c8a8f5d2c
2 changed files with 125 additions and 46 deletions
|
@ -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"
|
||||
]
|
||||
List.map
|
||||
(\( duration, x ) ->
|
||||
{ label = x
|
||||
, habitType = State.Evening
|
||||
, minutesDuration = duration
|
||||
}
|
||||
)
|
||||
[ ( 30, "Read" )
|
||||
, ( 1, "Record in State.Habit Journal" )
|
||||
]
|
||||
|
||||
|
||||
monday : List State.Habit
|
||||
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
|
||||
|
|
|
@ -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 =
|
||||
|
|
Loading…
Reference in a new issue