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";
.navbar.is-spaced a.navbar-item.is-active {
border-bottom: 1px solid #2e3440;
border-radius: 0;
/*
.navbar.is-spaced a.navbar-item.is-active {
border-bottom: 1px solid $dark;
border-radius: 0;
}
/*/
.hero.is-dark.is-bold {
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;
.navbar.is-spaced a.navbar-item.is-active {
/*
.navbar.is-spaced a.navbar-item.is-active {
border-bottom: 1px solid $dark;
border-radius: 0;
}
/*/
.hero.is-dark.is-bold {
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 =
case dest of
OfPlayer id ->
"http://localhost:8088/api/players/" ++ String.fromInt id ++ "/loot"
"api/players/" ++ String.fromInt id ++ "/loot"
OfShop ->
"http://localhost:8088/api/shop"
"api/shop"
OfGroup ->
"http://localhost:8088/api/players/0/loot"
"api/players/0/loot"
in
Http.get
{ url = url
@@ -187,7 +187,7 @@ checkList toMsg itemList =
toMsg [] <| Just (printError e)
in
Http.post
{ url = "http://localhost:8088/api/items"
{ url = "api/items"
, body =
E.list (\t -> E.string t) itemList
|> Http.jsonBody
@@ -330,27 +330,27 @@ confirmAction id data =
( endpoint, method ) =
case data of
AddPayload _ _ ->
( "http://localhost:8088/api/players/" ++ id ++ "/loot"
( "api/players/" ++ id ++ "/loot"
, "POST"
)
BuyPayload _ _ _ ->
( "http://localhost:8088/api/players/" ++ id ++ "/loot"
( "api/players/" ++ id ++ "/loot"
, "PUT"
)
SellPayload _ _ _ _ ->
( "http://localhost:8088/api/players/" ++ id ++ "/loot"
( "api/players/" ++ id ++ "/loot"
, "DELETE"
)
GrabPayload _ ->
( "http://localhost:8088/api/players/" ++ id ++ "/claims"
( "api/players/" ++ id ++ "/claims"
, "POST"
)
WealthPayload _ ->
( "http://localhost:8088/api/players/" ++ id ++ "/wealth"
( "api/players/" ++ id ++ "/wealth"
, "PUT"
)
in
@@ -367,7 +367,7 @@ confirmAction id data =
undoLastAction id =
Http.request
{ url = "http://localhost:8088/api/players/" ++ String.fromInt id ++ "/events/last"
{ url = "api/players/" ++ String.fromInt id ++ "/events/last"
, method = "DELETE"
, headers = []
, body = Http.emptyBody
@@ -398,7 +398,7 @@ replaceShopItems toMsg loot =
toMsg Nothing
in
Http.request
{ url = "http://localhost:8088/api/shop"
{ url = "api/shop"
, method = "POST"
, headers = []
, body = Http.jsonBody data
@@ -412,7 +412,7 @@ send : { method : String, path : String, decoder : Decoder a } -> Task Http.Erro
send { method, path, decoder } =
Http.task
{ method = method
, url = "http://localhost:8088/" ++ path
, url = path
, headers = []
, body = Http.emptyBody
, resolver = Http.stringResolver <| handleJsonResponse decoder

View File

@@ -49,7 +49,7 @@ blankPlayer =
get : (Result Http.Error Player -> msg) -> Int -> Cmd msg
get toMsg id =
Http.get
{ url = "http://localhost:8088/api/players/" ++ String.fromInt id ++ "/"
{ url = "api/players/" ++ String.fromInt id ++ "/"
, expect = Http.expectJson toMsg (valueDecoder playerDecoder)
}
@@ -64,11 +64,14 @@ list toMsg =
toMsg players
Err e ->
Debug.log ("Player's list fetch error : " ++ Debug.toString e) <|
toMsg []
let
_ =
Debug.log "Player's list fetch error" (Debug.toString e)
in
toMsg []
in
Http.get
{ url = "http://localhost:8088/api/players/"
{ url = "api/players/"
, 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 _ _ key =
init _ url key =
let
_ =
Debug.log "init with url" (Debug.toString url)
in
( { navbar = initNavbar key
, page = Page.Loading
}
@@ -165,6 +169,10 @@ update msg model =
( LinkClicked urlRequest, _ ) ->
case urlRequest of
Browser.Internal url ->
let
_ =
Debug.log "internal url request" (Debug.toString url)
in
( model, Nav.pushUrl model.navbar.navKey (Url.toString url) )
Browser.External href ->

View File

@@ -10,7 +10,7 @@ import Page.Dashboard as Home
import Page.GroupChest as GroupChest
import Page.Shop as Shop
import Process
import Route
import Route exposing (toHref)
import Session exposing (Session)
import Task
import Wealth
@@ -216,19 +216,19 @@ renderLevel left right =
navLink icon route page =
let
( link, url ) =
linkText =
case route of
Route.Merchant ->
( "Marchand", "/marchand" )
"Marchand"
Route.GroupChest ->
( "Coffre de groupe", "/groupe" )
"Coffre de groupe"
Route.Home ->
( "Accueil", "/" )
"Accueil"
Route.About ->
( "About", "/" )
"About"
isActive =
case ( route, page ) of
@@ -247,9 +247,9 @@ navLink icon route page =
_ ->
False
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" }
, 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
@@ -18,13 +30,32 @@ type Route
parser : P.Parser (Route -> a) a
parser =
oneOf
[ P.map Home P.top
, P.map GroupChest (P.s "groupe")
, P.map Merchant (P.s "marchand")
, P.map About (P.s "about")
[ P.map Home root
, P.map GroupChest (root </> P.s "groupe")
, P.map Merchant (root </> P.s "marchand")
, P.map About (root </> P.s "about")
]
fromUrl : Url.Url -> Maybe Route
fromUrl url =
P.parse parser url
toHref : Route -> String
toHref route =
"/"
++ scriptName
++ (case route of
Home ->
"/"
About ->
"/"
Merchant ->
"/marchand"
GroupChest ->
"/groupe"
)