aboutsummaryrefslogtreecommitdiff
path: root/src/client/Model.elm
blob: 72db56aea65d2ba17f001066ef0aa6780cbe0f96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module Model
  ( Model
  , initialModel
  ) where

import Time exposing (Time)
import Json.Decode as Json

import Model.View exposing (..)
import Model.Translations exposing (..)

type alias Model =
  { view : View
  , currentTime : Time
  , translations : Translations
  }

initialModel : Time -> String -> Model
initialModel initialTime translationsValue =
  { view = LoadingView
  , currentTime = initialTime
  , translations =
      case Json.decodeString translationsDecoder translationsValue of
        Ok translations -> translations
        Err err -> []
  }