Update default server thing for 0.19

This commit is contained in:
Richard Feldman
2018-08-05 05:05:34 -04:00
parent 31d96cd537
commit 7b12aa570f
4 changed files with 70 additions and 47 deletions

View File

@@ -1,15 +0,0 @@
{
"version": "1.0.0",
"summary": "helpful summary of your project, less than 80 characters",
"repository": "https://github.com/user/project.git",
"license": "BSD3",
"source-directories": [
"."
],
"exposed-modules": [],
"dependencies": {
"elm-lang/core": "5.1.1 <= v < 6.0.0",
"elm-lang/html": "2.0.0 <= v < 3.0.0"
},
"elm-version": "0.18.0 <= v < 0.19.0"
}

32
server/elm.json Normal file
View File

@@ -0,0 +1,32 @@
{
"type": "application",
"source-directories": [
"src"
],
"elm-version": "0.19.0",
"dependencies": {
"direct": {
"NoRedInk/json-decode-pipeline": "1.0.0",
"elm/browser": "1.0.0",
"elm/core": "1.0.0",
"elm/html": "1.0.0",
"elm/http": "1.0.0",
"elm/json": "1.0.0",
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm-explorations/markdown": "1.0.0",
"lukewestby/elm-http-builder": "6.0.0",
"rtfeldman/elm-iso8601": "1.0.1",
"rtfeldman/elm-validate": "4.0.0"
},
"indirect": {
"elm/parser": "1.0.0",
"elm/regex": "1.0.0",
"elm/virtual-dom": "1.0.0"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}

View File

@@ -18,7 +18,6 @@
<link href="/fonts.css" rel="stylesheet" type="text/css"> <link href="/fonts.css" rel="stylesheet" type="text/css">
<!-- Import the custom Bootstrap 4 theme from our hosted CDN --> <!-- Import the custom Bootstrap 4 theme from our hosted CDN -->
<link rel="stylesheet" href="/main.css"> <link rel="stylesheet" href="/main.css">
<script src="//localhost:35729/livereload.js?snipver=1"></script>
<style>/* Loading spinner courtesy of https://github.com/tobiasahlin/SpinKit */ <style>/* Loading spinner courtesy of https://github.com/tobiasahlin/SpinKit */
.sk-three-bounce { margin-right: 10px; } .sk-three-bounce .sk-child { width: 14px; height: 14px; background-color: #333; border-radius: 100%; display: inline-block; -webkit-animation: sk-three-bounce 1.4s ease-in-out 0s infinite both; animation: sk-three-bounce 1.4s ease-in-out 0s infinite both; } .sk-three-bounce .sk-bounce1 { -webkit-animation-delay: 0.28s; animation-delay: 0.28s; } .sk-three-bounce .sk-bounce2 { -webkit-animation-delay: 0.44s; animation-delay: 0.44s; } .sk-three-bounce .sk-bounce3 { -webkit-animation-delay: 0.6s; animation-delay: 0.6s; } @-webkit-keyframes sk-three-bounce { 0%, 80%, 100% { -webkit-transform: scale(0); transform: scale(0); } 40% { -webkit-transform: scale(1); transform: scale(1); } } @keyframes sk-three-bounce { 0%, 80%, 100% { -webkit-transform: scale(0); transform: scale(0); } 40% { -webkit-transform: scale(1); transform: scale(1); } } .sk-three-bounce { margin-right: 10px; } .sk-three-bounce .sk-child { width: 14px; height: 14px; background-color: #333; border-radius: 100%; display: inline-block; -webkit-animation: sk-three-bounce 1.4s ease-in-out 0s infinite both; animation: sk-three-bounce 1.4s ease-in-out 0s infinite both; } .sk-three-bounce .sk-bounce1 { -webkit-animation-delay: 0.28s; animation-delay: 0.28s; } .sk-three-bounce .sk-bounce2 { -webkit-animation-delay: 0.44s; animation-delay: 0.44s; } .sk-three-bounce .sk-bounce3 { -webkit-animation-delay: 0.6s; animation-delay: 0.6s; } @-webkit-keyframes sk-three-bounce { 0%, 80%, 100% { -webkit-transform: scale(0); transform: scale(0); } 40% { -webkit-transform: scale(1); transform: scale(1); } } @keyframes sk-three-bounce { 0%, 80%, 100% { -webkit-transform: scale(0); transform: scale(0); } 40% { -webkit-transform: scale(1); transform: scale(1); } }
</style> </style>
@@ -26,9 +25,9 @@
<script src="/elm.js"></script> <script src="/elm.js"></script>
</head> </head>
<body id="page-body"> <body>
<script> <script>
var app = Elm.Main.fullscreen(localStorage.session || null); var app = Elm.Main.init({flags: localStorage.session || null});
app.ports.storeSession.subscribe(function(session) { app.ports.storeSession.subscribe(function(session) {
localStorage.session = session; localStorage.session = session;

View File

@@ -7,6 +7,7 @@ port module Main exposing (..)
setup, and you should ask the instructor for help! setup, and you should ask the instructor for help!
-} -}
import Browser
import Html exposing (Html, h1, img, section, text) import Html exposing (Html, h1, img, section, text)
import Html.Attributes exposing (alt, src, style) import Html.Attributes exposing (alt, src, style)
import Json.Decode exposing (Value) import Json.Decode exposing (Value)
@@ -18,38 +19,44 @@ port storeSession : Maybe String -> Cmd msg
port onSessionChange : (Value -> msg) -> Sub msg port onSessionChange : (Value -> msg) -> Sub msg
main : Program Value () () main : Program () () ()
main = main =
Html.programWithFlags Browser.application
{ init = \_ -> ( (), Cmd.none ) { init = \_ _ _ -> ( (), Cmd.none )
, update = \() () -> ( (), Cmd.none ) , onUrlChange = \_ -> ()
, subscriptions = \() -> Sub.none , onUrlRequest = \_ -> ()
, update =
\() () ->
if False then
( (), storeSession Nothing )
else
( (), Cmd.none )
, subscriptions = \() -> onSessionChange (\_ -> ())
, view = , view =
\() -> \() ->
section { title = "Elm 0.19 workshop"
[ style , body =
[ ( "margin", "40px auto" ) [ section
, ( "width", "960px" ) [ style "margin" "40px auto"
, ( "text-align", "center" ) , style "width" "960px"
, style "text-align" "center"
]
[ h1
[ style "margin" "40px auto"
, style "font-family" "Helvetica, Arial, sans-serif"
, style "font-size" "128px"
, style "color" "rgb(90, 99, 120)"
]
[ text "Youre all set!" ]
, img
[ alt "Heart in the style of the Elm logo, by Marco Perone"
, src "https://user-images.githubusercontent.com/1094080/39399444-a90f2746-4aeb-11e8-9bd6-4fe45e535921.png"
, style "width" "368px"
, style "height" "305px"
]
[]
] ]
] ]
[ h1 }
[ style
[ ( "margin", "40px auto" )
, ( "font-family", "Helvetica, Arial, sans-serif" )
, ( "font-size", "128px" )
, ( "color", "rgb(90, 99, 120)" )
]
]
[ text "Youre all set!" ]
, img
[ alt "Heart in the style of the Elm logo, by Marco Perone"
, src "https://user-images.githubusercontent.com/1094080/39399444-a90f2746-4aeb-11e8-9bd6-4fe45e535921.png"
, style
[ ( "width", "368px" )
, ( "height", "305px" )
]
]
[]
]
} }