aboutsummaryrefslogtreecommitdiff
path: root/src/client/Model.elm
blob: c330d8664eab67c4eaf53626b04dc4d73a68c278 (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
27
28
29
module Model
  ( Model
  , initialModel
  ) where

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

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

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

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