Compare commits

...

2 Commits

Author SHA1 Message Date
18c39eac1d updates for production env 2019-12-15 14:30:28 +01:00
ef3dd1f2ac updates style 2019-12-14 14:05:47 +01:00
7 changed files with 80 additions and 33 deletions

View File

@@ -1,9 +1,11 @@
@charset "UTF-8"; @charset "UTF-8";
.navbar.is-spaced a.navbar-item.is-active { /*
border-bottom: 1px solid #2e3440; .navbar.is-spaced a.navbar-item.is-active {
border-radius: 0; border-bottom: 1px solid $dark;
border-radius: 0;
} }
/*/
.hero.is-dark.is-bold { .hero.is-dark.is-bold {
background-image: linear-gradient(280deg, #191c22 0%, #2e3440 71%, #3b4252 100%) !important; background-image: linear-gradient(280deg, #191c22 0%, #2e3440 71%, #3b4252 100%) !important;
} }

View File

@@ -30,11 +30,14 @@ $notification-padding: 0.8rem 2.5rem 0.8rem 1rem;
//$box-radius: 0 0 2rem 2rem; //$box-radius: 0 0 2rem 2rem;
.navbar.is-spaced a.navbar-item.is-active { /*
.navbar.is-spaced a.navbar-item.is-active {
border-bottom: 1px solid $dark; border-bottom: 1px solid $dark;
border-radius: 0; border-radius: 0;
} }
/*/
.hero.is-dark.is-bold { .hero.is-dark.is-bold {
background-image: linear-gradient(280deg, darken($dark, 10) 0%, $dark 71%, $dark-bis 100%) !important; background-image: linear-gradient(280deg, darken($dark, 10) 0%, $dark 71%, $dark-bis 100%) !important;
} }

View File

@@ -113,13 +113,13 @@ fetchLoot toMsg dest =
url = url =
case dest of case dest of
OfPlayer id -> OfPlayer id ->
"http://localhost:8088/api/players/" ++ String.fromInt id ++ "/loot" "api/players/" ++ String.fromInt id ++ "/loot"
OfShop -> OfShop ->
"http://localhost:8088/api/shop" "api/shop"
OfGroup -> OfGroup ->
"http://localhost:8088/api/players/0/loot" "api/players/0/loot"
in in
Http.get Http.get
{ url = url { url = url
@@ -187,7 +187,7 @@ checkList toMsg itemList =
toMsg [] <| Just (printError e) toMsg [] <| Just (printError e)
in in
Http.post Http.post
{ url = "http://localhost:8088/api/items" { url = "api/items"
, body = , body =
E.list (\t -> E.string t) itemList E.list (\t -> E.string t) itemList
|> Http.jsonBody |> Http.jsonBody
@@ -330,27 +330,27 @@ confirmAction id data =
( endpoint, method ) = ( endpoint, method ) =
case data of case data of
AddPayload _ _ -> AddPayload _ _ ->
( "http://localhost:8088/api/players/" ++ id ++ "/loot" ( "api/players/" ++ id ++ "/loot"
, "POST" , "POST"
) )
BuyPayload _ _ _ -> BuyPayload _ _ _ ->
( "http://localhost:8088/api/players/" ++ id ++ "/loot" ( "api/players/" ++ id ++ "/loot"
, "PUT" , "PUT"
) )
SellPayload _ _ _ _ -> SellPayload _ _ _ _ ->
( "http://localhost:8088/api/players/" ++ id ++ "/loot" ( "api/players/" ++ id ++ "/loot"
, "DELETE" , "DELETE"
) )
GrabPayload _ -> GrabPayload _ ->
( "http://localhost:8088/api/players/" ++ id ++ "/claims" ( "api/players/" ++ id ++ "/claims"
, "POST" , "POST"
) )
WealthPayload _ -> WealthPayload _ ->
( "http://localhost:8088/api/players/" ++ id ++ "/wealth" ( "api/players/" ++ id ++ "/wealth"
, "PUT" , "PUT"
) )
in in
@@ -367,7 +367,7 @@ confirmAction id data =
undoLastAction id = undoLastAction id =
Http.request Http.request
{ url = "http://localhost:8088/api/players/" ++ String.fromInt id ++ "/events/last" { url = "api/players/" ++ String.fromInt id ++ "/events/last"
, method = "DELETE" , method = "DELETE"
, headers = [] , headers = []
, body = Http.emptyBody , body = Http.emptyBody
@@ -398,7 +398,7 @@ replaceShopItems toMsg loot =
toMsg Nothing toMsg Nothing
in in
Http.request Http.request
{ url = "http://localhost:8088/api/shop" { url = "api/shop"
, method = "POST" , method = "POST"
, headers = [] , headers = []
, body = Http.jsonBody data , body = Http.jsonBody data
@@ -412,7 +412,7 @@ send : { method : String, path : String, decoder : Decoder a } -> Task Http.Erro
send { method, path, decoder } = send { method, path, decoder } =
Http.task Http.task
{ method = method { method = method
, url = "http://localhost:8088/" ++ path , url = path
, headers = [] , headers = []
, body = Http.emptyBody , body = Http.emptyBody
, resolver = Http.stringResolver <| handleJsonResponse decoder , resolver = Http.stringResolver <| handleJsonResponse decoder

View File

@@ -49,7 +49,7 @@ blankPlayer =
get : (Result Http.Error Player -> msg) -> Int -> Cmd msg get : (Result Http.Error Player -> msg) -> Int -> Cmd msg
get toMsg id = get toMsg id =
Http.get Http.get
{ url = "http://localhost:8088/api/players/" ++ String.fromInt id ++ "/" { url = "api/players/" ++ String.fromInt id ++ "/"
, expect = Http.expectJson toMsg (valueDecoder playerDecoder) , expect = Http.expectJson toMsg (valueDecoder playerDecoder)
} }
@@ -64,11 +64,14 @@ list toMsg =
toMsg players toMsg players
Err e -> Err e ->
Debug.log ("Player's list fetch error : " ++ Debug.toString e) <| let
toMsg [] _ =
Debug.log "Player's list fetch error" (Debug.toString e)
in
toMsg []
in in
Http.get Http.get
{ url = "http://localhost:8088/api/players/" { url = "api/players/"
, expect = Http.expectJson parseResponse (valueDecoder <| D.list playerDecoder) , expect = Http.expectJson parseResponse (valueDecoder <| D.list playerDecoder)
} }

View File

@@ -60,7 +60,11 @@ setPage page model =
init : () -> Url.Url -> Nav.Key -> ( Model, Cmd Msg ) init : () -> Url.Url -> Nav.Key -> ( Model, Cmd Msg )
init _ _ key = init _ url key =
let
_ =
Debug.log "init with url" (Debug.toString url)
in
( { navbar = initNavbar key ( { navbar = initNavbar key
, page = Page.Loading , page = Page.Loading
} }
@@ -165,6 +169,10 @@ update msg model =
( LinkClicked urlRequest, _ ) -> ( LinkClicked urlRequest, _ ) ->
case urlRequest of case urlRequest of
Browser.Internal url -> Browser.Internal url ->
let
_ =
Debug.log "internal url request" (Debug.toString url)
in
( model, Nav.pushUrl model.navbar.navKey (Url.toString url) ) ( model, Nav.pushUrl model.navbar.navKey (Url.toString url) )
Browser.External href -> Browser.External href ->

View File

@@ -10,7 +10,7 @@ import Page.Dashboard as Home
import Page.GroupChest as GroupChest import Page.GroupChest as GroupChest
import Page.Shop as Shop import Page.Shop as Shop
import Process import Process
import Route import Route exposing (toHref)
import Session exposing (Session) import Session exposing (Session)
import Task import Task
import Wealth import Wealth
@@ -216,19 +216,19 @@ renderLevel left right =
navLink icon route page = navLink icon route page =
let let
( link, url ) = linkText =
case route of case route of
Route.Merchant -> Route.Merchant ->
( "Marchand", "/marchand" ) "Marchand"
Route.GroupChest -> Route.GroupChest ->
( "Coffre de groupe", "/groupe" ) "Coffre de groupe"
Route.Home -> Route.Home ->
( "Accueil", "/" ) "Accueil"
Route.About -> Route.About ->
( "About", "/" ) "About"
isActive = isActive =
case ( route, page ) of case ( route, page ) of
@@ -247,9 +247,9 @@ navLink icon route page =
_ -> _ ->
False False
in in
a [ class "navbar-item", classList [ ( "is-active", isActive ) ], href url ] a [ class "navbar-item", classList [ ( "is-active", isActive ) ], href (toHref route) ]
[ B.icon { icon = icon, ratio = Just "fa-1x", size = Just "is-medium" } [ B.icon { icon = icon, ratio = Just "fa-1x", size = Just "is-medium" }
, span [] [ text link ] , span [] [ text linkText ]
] ]

View File

@@ -5,6 +5,18 @@ import Url.Parser as P exposing ((</>), Parser, oneOf, s)
-- Name of the application, prepended to it's actual root
scriptName =
"lootalot"
root =
P.s scriptName
-- ROUTES -- ROUTES
@@ -18,13 +30,32 @@ type Route
parser : P.Parser (Route -> a) a parser : P.Parser (Route -> a) a
parser = parser =
oneOf oneOf
[ P.map Home P.top [ P.map Home root
, P.map GroupChest (P.s "groupe") , P.map GroupChest (root </> P.s "groupe")
, P.map Merchant (P.s "marchand") , P.map Merchant (root </> P.s "marchand")
, P.map About (P.s "about") , P.map About (root </> P.s "about")
] ]
fromUrl : Url.Url -> Maybe Route fromUrl : Url.Url -> Maybe Route
fromUrl url = fromUrl url =
P.parse parser url P.parse parser url
toHref : Route -> String
toHref route =
"/"
++ scriptName
++ (case route of
Home ->
"/"
About ->
"/"
Merchant ->
"/marchand"
GroupChest ->
"/groupe"
)