init repo
This commit is contained in:
commit
1fc3aa340d
8 files changed
+17751
No files matched your search
@@ -0,0 +1,2 @@
|
|||||||
|
fontawesome
|
||||||
|
elm-stuff
|
||||||
Vendored
+10832
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"sources":["../bulma.sass","../sass/utilities/animations.sass","bulma.css","../sass/utilities/mixins.sass","../sass/utilities/initial-variables.sass","../sass/utilities/controls.sass","../sass/base/minireset.sass","../sass/base/generic.sass","../sass/base/helpers.sass","../sass/elements/box.sass","../sass/elements/button.sass","../sass/utilities/functions.sass","../sass/elements/container.sass","../sass/elements/content.sass","../sass/elements/icon.sass","../sass/elements/image.sass","../sass/elements/notification.sass","../sass/elements/progress.sass","../sass/elements/table.sass","../sass/elements/tag.sass","../sass/elements/title.sass","../sass/elements/other.sass","../sass/form/shared.sass","../sass/form/input-textarea.sass","../sass/form/checkbox-radio.sass","../sass/form/select.sass","../sass/form/file.sass","../sass/form/tools.sass","../sass/components/breadcrumb.sass","../sass/components/card.sass","../sass/components/dropdown.sass","../sass/components/level.sass","../sass/components/list.sass","../sass/components/media.sass","../sass/components/menu.sass","../sass/components/message.sass","../sass/components/modal.sass","../sass/components/navbar.sass","../sass/components/pagination.sass","../sass/components/panel.sass","../sass/components/tabs.sass","../sass/grid/columns.sass","../sass/grid/tiles.sass","../sass/layout/hero.sass","../sass/layout/section.sass","../sass/layout/footer.sass"],"names":[],"mappings":"AACA,6DAAA;ACDA;EACE;IACE,uBAAuB;ECEzB;EDDA;IACE,yBAAyB;ECG3B;AACF;ADRA;EACE;IACE,uBAAuB;ECEzB;EDDA;IACE,yBAAyB;ECG3B;AACF;;ACmIA;;;;EANE,2BAA2B;EAC3B,yBAAyB;EACzB,sBAAsB;EACtB,qBAAqB;EACrB,iBAAiB;ADtHnB;;AC2IA;EAfE,6BAD8B;EAE9B,kBAAkB;EAClB,eAAe;EACf,aAAa;EACb,YAAY;EACZ,cAAc;EACd,eAAe;EACf,qBAAq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c/B;EM7cE;IACE,4BAA2B;EN+c/B;EMhdE;IACE,0BAA2B;ENkd/B;EMndE;IACE,4BAA2B;ENqd/B;EMtLine truncated
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
/*! bulma.io v0.8.0 | MIT License | github.com/jgthms/bulma */@-webkit-keyframes spinAround{from{transform:rotate(0)}to{transform:rotate(359deg)}}@keyframes spinAround{from{transform:rotate(0)}to{transform:rotate(359deg)}}.breadcrumb,.button,.delete,.file,.is-unselectable,.modal-close,.pagination-ellipsis,.pagination-link,.pagination-next,.pagination-previous,.tabs{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.navbar-link:not(.is-arrowless)::after,.select:not(.is-multiple):not(.is-loading)::after{border:3px solid transparent;border-radius:2px;border-right:0;border-top:0;content:" ";display:block;height:.625em;margin-top:-.4375em;pointer-events:none;position:absolute;top:50%;transform:rotate(-45deg);transform-origin:center;width:.625em}.block:not(:last-child),.box:not(:last-child),.breadcrumb:not(:last-child),.content:not(:last-child),.highlight:not(:last-child),.level:not(:last-child),.list:not(:last-child),.message:not(:last-child),.notification:not(:last-child),.pagination:not(:last-child),.progress:not(:last-child),.subtitle:not(:last-child),.table-container:not(:last-child),.table:not(:last-child),.tabs:not(:last-child),.title:not(:last-child){margin-bottom:1.5rem}.delete,.modal-close{-moz-appearance:none;-webkit-appearance:none;background-color:rgba(10,10,10,.2);border:none;border-radius:290486px;cursor:pointer;pointer-events:auto;display:inline-block;flex-grow:0;flex-shrink:0;font-size:0;height:20px;max-height:20px;max-width:20px;min-height:20px;min-width:20px;outline:0;position:relative;vertical-align:top;width:20px}.delete::after,.delete::before,.modal-close::after,.modal-close::before{background-color:#fff;content:"";display:block;left:50%;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%) rotate(45deg);transform-origin:center center}.delete::before,.modal-close::before{height:2px;width:50%}.delete::after,.modal-close::after{height:50%;width:2px}.delete:focus,.delete:hover,.modal-close:focus,.modal-close:hover{background-color:rgba(10,10,10,.3)}.delete:active,.modal-close:active{background-color:rgba(10,10,10,.4)}.is-small.delete,.is-small.modal-close{height:16px;max-height:16px;max-width:16px;min-height:16px;min-width:16px;width:16px}.is-medium.delete,.is-medium.modal-close{height:24px;max-height:24px;max-width:24px;min-height:24px;min-width:24px;width:24px}.is-large.delete,.is-large.modal-close{height:32px;max-height:32px;max-width:32px;min-height:32px;min-width:32px;width:32px}.button.is-loading::after,.control.is-loading::after,.loader,.select.is-loading::after{-webkit-animation:spinAround .5s infinite linear;animation:spinAround .5s infinite linear;border:2px solid #dbdbdb;border-radius:290486px;border-right-color:transparent;border-top-color:transparent;content:"";display:block;height:1em;position:relative;width:1em}.hero-video,.image.is-16by9 .has-ratio,.image.is-16by9 img,.image.is-1by1 .has-ratio,.image.is-1by1 img,.image.is-1by2 .has-ratio,.image.is-1by2 img,.image.is-1by3 .has-ratio,.image.is-1by3 img,.image.is-2by1 .has-ratio,.image.is-2by1 img,.image.is-2by3 .has-ratio,.image.is-2by3 img,.image.is-3by1 .has-ratio,.image.is-3by1 img,.image.is-3by2 .has-ratio,.image.is-3by2 img,.image.is-3by4 .has-ratio,.image.is-3by4 img,.image.is-3by5 .has-ratio,.image.is-3by5 img,.image.is-4by3 .has-ratio,.image.is-4by3 img,.image.is-4by5 .has-ratio,.image.is-4by5 img,.image.is-5by3 .has-ratio,.image.is-5by3 img,.image.is-5by4 .has-ratio,.image.is-5by4 img,.image.is-9by16 .has-ratio,.image.is-9by16 img,.image.is-square .has-ratio,.image.is-square img,.is-overlay,.modal,.modal-background{bottom:0;left:0;position:absolute;right:0;top:0}.button,.file-cta,.file-name,.input,.pagination-ellipsis,.pagination-link,.pagination-next,.pagination-previous,.select select,.textarea{-moz-appearance:none;-webkit-appearance:none;align-items:center;border:1px solid transparent;border-radius:4px;box-shadow:none;display:inline-flex;font-size:1rem;height:2.5em;justify-content:flex-start;line-height:1.5;padding-bottom:calc(.5em - 1px);padding-left:calc(.75em - 1px);padding-right:calc(.75em - 1px);padding-top:calc(.5em - 1px);position:relative;vertical-align:top}.button:active,.button:focus,.file-cta:active,.file-cta:focus,.file-name:active,.file-name:focus,.input:active,.input:focus,.is-active.button,.is-active.file-cta,.is-active.file-name,.is-active.input,.is-active.pagination-ellipsis,.is-active.pagination-link,.is-active.pagination-next,.is-active.pagination-previous,.is-active.textarea,.is-focused.button,.is-focused.file-cta,.is-focused.file-name,.is-focused.input,.is-focused.pagination-ellipsis,.is-focused.pagination-link,.is-focused.pagination-next,.is-focused.pagination-previous,.is-focused.textarea,.pagination-ellipsis:active,.pagination-ellipsis:focus,.pagination-link:active,.pagination-link:focus,.pagination-next:active,.pagination-next:focus,.pagination-previous:active,.pagination-previous:focus,.select select.is-active,.seleLine truncated
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"type": "application",
|
||||||
|
"source-directories": [
|
||||||
|
"src"
|
||||||
|
],
|
||||||
|
"elm-version": "0.19.1",
|
||||||
|
"dependencies": {
|
||||||
|
"direct": {
|
||||||
|
"elm/browser": "1.0.1",
|
||||||
|
"elm/core": "1.0.2",
|
||||||
|
"elm/html": "1.0.0",
|
||||||
|
"elm/http": "2.0.0",
|
||||||
|
"elm/json": "1.1.3",
|
||||||
|
"elm/url": "1.0.0"
|
||||||
|
},
|
||||||
|
"indirect": {
|
||||||
|
"elm/bytes": "1.0.8",
|
||||||
|
"elm/file": "1.0.5",
|
||||||
|
"elm/time": "1.0.0",
|
||||||
|
"elm/virtual-dom": "1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test-dependencies": {
|
||||||
|
"direct": {},
|
||||||
|
"indirect": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
|
<link rel="icon" href="/favicon.ico">
|
||||||
|
<link rel="stylesheet" href="/css/bulma.css">
|
||||||
|
<title>Loot-a-Lot !</title>
|
||||||
|
<script src="main.js"></script>
|
||||||
|
<script defer src="fontawesome/js/all.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<!-- built files will be auto injected -->
|
||||||
|
<noscript>
|
||||||
|
<strong>We're sorry but lootalot_front doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||||
|
</noscript>
|
||||||
|
<script>
|
||||||
|
var app = Elm.Main.init({
|
||||||
|
node: document.getElementById('app'),
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+219
@@ -0,0 +1,219 @@
|
|||||||
|
module Main exposing (..)
|
||||||
|
|
||||||
|
import Browser
|
||||||
|
import Browser.Navigation as Nav
|
||||||
|
import Url
|
||||||
|
import Html exposing (..)
|
||||||
|
import Html.Attributes exposing (..)
|
||||||
|
import Html.Events exposing (..)
|
||||||
|
import Http
|
||||||
|
import Json.Decode exposing (Decoder, field, string, int)
|
||||||
|
-- Main
|
||||||
|
|
||||||
|
main : Program () Model Msg
|
||||||
|
main =
|
||||||
|
Browser.application
|
||||||
|
{ init = init
|
||||||
|
, view = view
|
||||||
|
, update = update
|
||||||
|
, subscriptions = subscriptions
|
||||||
|
, onUrlChange = UrlChanged
|
||||||
|
, onUrlRequest = LinkClicked
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Model
|
||||||
|
|
||||||
|
type alias Model =
|
||||||
|
{ key : Nav.Key
|
||||||
|
, url : Url.Url
|
||||||
|
, player: Player
|
||||||
|
, error: String
|
||||||
|
}
|
||||||
|
|
||||||
|
init : () -> Url.Url -> Nav.Key -> ( Model, Cmd Msg )
|
||||||
|
init flags url key =
|
||||||
|
( Model key url blankPlayer "", (fetchPlayer 0))
|
||||||
|
|
||||||
|
|
||||||
|
-- PLAYER
|
||||||
|
--
|
||||||
|
type alias Player =
|
||||||
|
{ name: String
|
||||||
|
, debt: Int
|
||||||
|
, wealth: Wealth
|
||||||
|
}
|
||||||
|
|
||||||
|
blankPlayer =
|
||||||
|
Player "Loading" 100 (Wealth 0 0 0 0)
|
||||||
|
|
||||||
|
type alias Wealth =
|
||||||
|
{ cp: Int
|
||||||
|
, sp: Int
|
||||||
|
, gp: Int
|
||||||
|
, pp: Int
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchPlayer : Int -> Cmd Msg
|
||||||
|
fetchPlayer id =
|
||||||
|
Http.get
|
||||||
|
{ url = "http://localhost:8088/api/players/" ++ (String.fromInt id) ++ "/"
|
||||||
|
, expect = Http.expectJson GotPlayer playerDecoder
|
||||||
|
}
|
||||||
|
|
||||||
|
playerDecoder : Decoder Player
|
||||||
|
playerDecoder =
|
||||||
|
Json.Decode.map3 Player
|
||||||
|
(field "value" (field "name" string))
|
||||||
|
(field "value" (field "debt" int))
|
||||||
|
(Json.Decode.map4 Wealth
|
||||||
|
(field "value" (field "cp" int))
|
||||||
|
(field "value" (field "sp" int))
|
||||||
|
(field "value" (field "gp" int))
|
||||||
|
(field "value" (field "pp" int)))
|
||||||
|
|
||||||
|
-- UPDATE
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= LinkClicked Browser.UrlRequest
|
||||||
|
| UrlChanged Url.Url
|
||||||
|
| DebugSwitchPlayer Int
|
||||||
|
| GotPlayer (Result Http.Error Player)
|
||||||
|
|
||||||
|
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||||
|
update msg model =
|
||||||
|
case msg of
|
||||||
|
LinkClicked urlRequest ->
|
||||||
|
case urlRequest of
|
||||||
|
Browser.Internal url ->
|
||||||
|
( model, Nav.pushUrl model.key (Url.toString url) )
|
||||||
|
--( model, Cmd.none )
|
||||||
|
|
||||||
|
Browser.External href ->
|
||||||
|
( { model | error = "Invalid request '" ++ href ++ "'" }, Cmd.none )
|
||||||
|
|
||||||
|
UrlChanged url ->
|
||||||
|
( { model | url = url }
|
||||||
|
, Cmd.none
|
||||||
|
)
|
||||||
|
|
||||||
|
DebugSwitchPlayer id ->
|
||||||
|
( model, fetchPlayer id)
|
||||||
|
|
||||||
|
GotPlayer result ->
|
||||||
|
case result of
|
||||||
|
Ok player ->
|
||||||
|
( { model | player = player }
|
||||||
|
, Cmd.none
|
||||||
|
)
|
||||||
|
Err error -> ( { model | error = (printError error) }, Cmd.none )
|
||||||
|
|
||||||
|
-- ERRORS
|
||||||
|
|
||||||
|
printError : Http.Error -> String
|
||||||
|
printError error =
|
||||||
|
case error of
|
||||||
|
Http.NetworkError -> "Le serveur ne répond pas"
|
||||||
|
_ -> "Erreur inconnue"
|
||||||
|
|
||||||
|
-- SUBSCRIPTIONS
|
||||||
|
--
|
||||||
|
subscriptions : Model -> Sub Msg
|
||||||
|
subscriptions _ =
|
||||||
|
Sub.none
|
||||||
|
|
||||||
|
|
||||||
|
-- VIEW
|
||||||
|
--
|
||||||
|
|
||||||
|
view : Model -> Browser.Document Msg
|
||||||
|
view model =
|
||||||
|
{ title = "Loot-a-lot in ELM"
|
||||||
|
, body =
|
||||||
|
[ viewHeaderBar model
|
||||||
|
, viewPlayerWealth model.player
|
||||||
|
, section []
|
||||||
|
[ text "Loot-a-lot" ]
|
||||||
|
, p [] [ text "Start using it !" ]
|
||||||
|
, viewDebugSection model
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
-- DEBUG SECTION
|
||||||
|
|
||||||
|
viewDebugSection model =
|
||||||
|
div [class "panel is-danger"]
|
||||||
|
[ p [class "panel-heading"] [text "Debug"]
|
||||||
|
, debugSwitchPlayers
|
||||||
|
, p [class "panel-block"] [text ("URL :" ++ Url.toString model.url)]
|
||||||
|
, p [class "panel-block has-text-danger"] [text model.error]
|
||||||
|
]
|
||||||
|
|
||||||
|
debugSwitchPlayers : Html Msg
|
||||||
|
debugSwitchPlayers =
|
||||||
|
div [ class "panel-tabs" ]
|
||||||
|
[ a [ onClick (DebugSwitchPlayer 0) ] [text "Groupe"]
|
||||||
|
, a [ onClick (DebugSwitchPlayer 1) ] [text "Lomion"]
|
||||||
|
, a [ onClick (DebugSwitchPlayer 2) ] [text "Fefi"]
|
||||||
|
]
|
||||||
|
-- HEADER SECTION
|
||||||
|
|
||||||
|
viewHeaderBar : Model -> Html Msg
|
||||||
|
viewHeaderBar model =
|
||||||
|
nav [ class "navbar", class "is-info" ]
|
||||||
|
[ div [ class "navbar-brand" ]
|
||||||
|
[ p [ class "navbar-item"]
|
||||||
|
[ text model.player.name ]
|
||||||
|
|
||||||
|
, a [class "navbar-burger is-active"]
|
||||||
|
[ span [attribute "aria-hidden" "true"] []
|
||||||
|
, span [attribute "aria-hidden" "true"] []
|
||||||
|
, span [attribute "aria-hidden" "true"] []
|
||||||
|
]
|
||||||
|
]
|
||||||
|
, div [ class "navbar-menu is-active" ]
|
||||||
|
[ div [class "navbar-end"]
|
||||||
|
[ a [class "navbar-item", href "#marchand"] [text "Marchand"]
|
||||||
|
, a [class "navbar-item", href "#coffre"] [text "Mon coffre"]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
-- WEALTH
|
||||||
|
--
|
||||||
|
|
||||||
|
viewPlayerWealth : Player -> Html Msg
|
||||||
|
viewPlayerWealth player =
|
||||||
|
section [ class "level" ]
|
||||||
|
([div [class "level-left box"]
|
||||||
|
([div [ class "level-item" ]
|
||||||
|
[ p [class "is-size-3"] [text "Argent"]
|
||||||
|
, span [ class "icon is-large" ] [ i [ class "fas fa-2x fa-piggy-bank" ] [] ]
|
||||||
|
]
|
||||||
|
] ++ (showWealth player.wealth))
|
||||||
|
] ++ (if player.debt > 0 then
|
||||||
|
[ div [class "level-right"]
|
||||||
|
[div [class "level-item"]
|
||||||
|
[p [class "heading is-size-4 has-text-danger"]
|
||||||
|
[text ("Dette : " ++ (String.fromInt player.debt) ++ "po")]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
else
|
||||||
|
[]
|
||||||
|
))
|
||||||
|
|
||||||
|
showWealth : Wealth -> List (Html Msg)
|
||||||
|
showWealth wealth =
|
||||||
|
[ showWealthField "pp" wealth.pp
|
||||||
|
, showWealthField "gp" wealth.gp
|
||||||
|
, showWealthField "sp" wealth.sp
|
||||||
|
, showWealthField "cp" wealth.cp
|
||||||
|
]
|
||||||
|
|
||||||
|
showWealthField : String -> Int -> Html Msg
|
||||||
|
showWealthField name value =
|
||||||
|
div [ class "level-item" ]
|
||||||
|
[ p [ class "is-size-4"] [text (String.fromInt value)]
|
||||||
|
, p [class "heading"] [text name]
|
||||||
|
]
|
||||||
Reference in new issue
Block a user