get display to work
This commit is contained in:
parent
238e6fba75
commit
00c9c587c7
9 changed files with 135 additions and 20 deletions
24
src/home.ml
24
src/home.ml
|
|
@ -2,14 +2,20 @@ open Tyxml.Html
|
|||
|
||||
let get request =
|
||||
let title = "Pellest is the best game ever!" in
|
||||
let about = div [ txt App.about ] in
|
||||
let register_link = div [ a ~a:[ a_href "/register" ] [ txt "Register" ] ] in
|
||||
let login_link = div [ a ~a:[ a_href "/login" ] [ txt "Login" ] ] in
|
||||
let logout_link = div [ a ~a:[ a_href "/logout" ] [ txt "Logout" ] ] in
|
||||
let page =
|
||||
div
|
||||
@@
|
||||
if User.is_logged_in request then [ about; logout_link ]
|
||||
else [ about; login_link; register_link ]
|
||||
if User.is_logged_in request then
|
||||
let welcome =
|
||||
div [ txt (Format.sprintf "welcome %s" (User.get_nick_unsafe request)) ]
|
||||
in
|
||||
let island =
|
||||
div [ a ~a:[ a_href "/island" ] [ txt "🏝️ Go to your island !" ] ]
|
||||
in
|
||||
let logout = div [ a ~a:[ a_href "/logout" ] [ txt "Logout" ] ] in
|
||||
[ welcome; island; logout ]
|
||||
else
|
||||
let about = div [ txt App.about ] in
|
||||
let register = div [ a ~a:[ a_href "/register" ] [ txt "Register" ] ] in
|
||||
let login = div [ a ~a:[ a_href "/login" ] [ txt "Login" ] ] in
|
||||
[ about; login; register ]
|
||||
in
|
||||
Template.render ~title ~scripts:[] page
|
||||
Template.render ~title ~scripts:[] (div page)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue