From 0066c6476b45e4d2fc495375460a479945a3a58c Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Fri, 7 Dec 2018 23:03:16 -0800 Subject: [PATCH] Initial commit. Start basic Elm application. --- elm.json | 24 ++++++++++++++++++++++ src/Main.elm | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 elm.json create mode 100644 src/Main.elm diff --git a/elm.json b/elm.json new file mode 100644 index 0000000..0a55772 --- /dev/null +++ b/elm.json @@ -0,0 +1,24 @@ +{ + "type": "application", + "source-directories": [ + "src" + ], + "elm-version": "0.19.0", + "dependencies": { + "direct": { + "elm/browser": "1.0.1", + "elm/core": "1.0.2", + "elm/html": "1.0.0", + "elm/url": "1.0.0" + }, + "indirect": { + "elm/json": "1.1.2", + "elm/time": "1.0.0", + "elm/virtual-dom": "1.0.2" + } + }, + "test-dependencies": { + "direct": {}, + "indirect": {} + } +} \ No newline at end of file diff --git a/src/Main.elm b/src/Main.elm new file mode 100644 index 0000000..022f638 --- /dev/null +++ b/src/Main.elm @@ -0,0 +1,58 @@ +import Browser exposing (application) +import Browser.Navigation as Nav +import Url exposing (Url) +import Html exposing (div) + +type alias Flags = + { token : Maybe String + } + +type alias Model = + { key : Nav.Key + , token : Maybe String + } + +type Msg = + None + | TryUrl Browser.UrlRequest + | ChangeUrl Url + +init : Flags -> Url -> Nav.Key -> (Model, Cmd Msg) +init flags url key = + let + model = + { key = key + , token = flags.token + } + cmd = case flags.token of + Just _ -> Cmd.none + Nothing -> Cmd.none + in + (model, cmd) + +view : Model -> Browser.Document Msg +view m = + { title = "Scylla" + , body = [] + } + +update : Msg -> Model -> (Model, Cmd Msg) +update msg model = (model, Cmd.none) + +subscriptions : Model -> Sub Msg +subscriptions m = Sub.none + +onUrlRequest : Browser.UrlRequest -> Msg +onUrlRequest = TryUrl + +onUrlChange : Url -> Msg +onUrlChange = ChangeUrl + +main = application + { init = init + , view = view + , update = update + , subscriptions = subscriptions + , onUrlRequest = onUrlRequest + , onUrlChange = onUrlChange + }