about summary refs log tree commit diff
path: root/website/habit-screens/src/Main.elm
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-12-11T22·47+0000
committerWilliam Carroll <wpcarro@gmail.com>2020-12-11T22·47+0000
commit9e2fbfde8e9c2256e1817f79d119e0dd7bed7b7d (patch)
tree6010b135c9c466e5dee21c8e4e5c85f47529a35f /website/habit-screens/src/Main.elm
parent3feb8ceb9a6bbaa48927188de4806c8573f499a5 (diff)
Move the habit-screens project into //website
I'd like to eventually deploy this to wpcarro.dev. Coming soon!
Diffstat (limited to 'website/habit-screens/src/Main.elm')
-rw-r--r--website/habit-screens/src/Main.elm29
1 files changed, 29 insertions, 0 deletions
diff --git a/website/habit-screens/src/Main.elm b/website/habit-screens/src/Main.elm
new file mode 100644
index 000000000000..2ddedb913357
--- /dev/null
+++ b/website/habit-screens/src/Main.elm
@@ -0,0 +1,29 @@
+module Main exposing (main)
+
+import Browser
+import Habits
+import Html exposing (..)
+import State
+import Time
+
+
+subscriptions : State.Model -> Sub State.Msg
+subscriptions model =
+    -- once per minute
+    Time.every (1000 * 60) (\_ -> State.MaybeAdjustWeekday)
+
+
+view : State.Model -> Html State.Msg
+view model =
+    case model.view of
+        State.Habits ->
+            Habits.render model
+
+
+main =
+    Browser.element
+        { init = \() -> State.init
+        , subscriptions = subscriptions
+        , update = State.update
+        , view = view
+        }