Skip to content

Commit

Permalink
Finish TimeTracker migration, add clock ticks
Browse files Browse the repository at this point in the history
  • Loading branch information
Erudition committed Nov 12, 2023
1 parent 51dd160 commit ee09760
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 310 deletions.
299 changes: 0 additions & 299 deletions elm-to-be-migrated/TimeTracker.elm

This file was deleted.

13 changes: 9 additions & 4 deletions elm/Layouts/AppFrame.elm
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import Replicated.Reducer.RepList as RepList exposing (RepList)
import Route exposing (Route)
import Route.Path
import Shared
import Shared.Model
import Shared.Msg exposing (..)
import Shared.PopupType as PopupType
import SmartTime.Duration as Duration
Expand Down Expand Up @@ -84,7 +85,7 @@ layout props shared route =
{ init = init
, update = update
, view = view shared route
, subscriptions = subscriptions
, subscriptions = subscriptions shared
}


Expand Down Expand Up @@ -113,7 +114,8 @@ init _ =


type Msg
= JustRunEffects (List (Effect Shared.Msg))
= NoOp
| JustRunEffects (List (Effect Shared.Msg))
| EffectsAndLogError (List (Effect Shared.Msg)) String
| SendSharedMsg Shared.Msg
| AskAModel
Expand All @@ -123,6 +125,9 @@ type Msg
update : Msg -> Model -> ( Model, Effect Msg )
update msg model =
case msg of
NoOp ->
( model, Effect.none )

JustRunEffects effects ->
( model
, Effect.batch effects
Expand Down Expand Up @@ -177,8 +182,8 @@ update msg model =
)


subscriptions : Model -> Sub Msg
subscriptions model =
subscriptions : Shared.Model.Model -> Model -> Sub Msg
subscriptions shared model =
Sub.none


Expand Down
24 changes: 18 additions & 6 deletions elm/Pages/TimeTracker.elm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import VitePluginHelper
page : Shared.Model -> Route () -> Page Model Msg
page shared route =
Page.new
{ init = init
{ init = init route
, update = update shared
, subscriptions = subscriptions
, view = view shared route
Expand All @@ -77,13 +77,28 @@ type alias Model =
{}


init : () -> ( Model, Effect Msg )
init () =
init : Route () -> () -> ( Model, Effect Msg )
init route () =
( {}
, Effect.none
)


urlTriggers : Profile -> List ( String, Dict.Dict String Msg )
urlTriggers app =
let
activitiesWithNames =
List.concat <| List.map entriesPerActivity (Activity.allUnhidden app.activities)

entriesPerActivity activity =
List.map (\nm -> ( nm, StartTracking (Activity.getID activity) )) (Activity.getNames activity)
++ List.map (\nm -> ( String.toLower nm, StartTracking (Activity.getID activity) )) (Activity.getNames activity)
in
[ ( "start", Dict.fromList activitiesWithNames )
, ( "stop", Dict.fromList [ ( "stop", StartTracking Activity.unknown ) ] )
]



-- UPDATE

Expand Down Expand Up @@ -138,9 +153,6 @@ view shared route model =
[ class "activity-screen" ]
[ lazy2 viewActivities ( shared.time, shared.timeZone ) shared.replica
]
, section [ css [ opacity (num 0.1) ] ]
[ text "Quite Ambitious."
]
]
}

Expand Down
Loading

0 comments on commit ee09760

Please sign in to comment.