58 lines
1.3 KiB
Elm
58 lines
1.3 KiB
Elm
module NavRow exposing (..)
|
|
|
|
import CommonElements exposing (..)
|
|
import Element exposing (..)
|
|
import Element.Region as Region
|
|
import Model exposing (..)
|
|
import Request exposing (..)
|
|
import Url
|
|
|
|
|
|
getNavRow : Model -> Element Msg
|
|
getNavRow model =
|
|
row
|
|
[ Region.navigation
|
|
|
|
--, explain Debug.todo
|
|
, paddingXY 10 5
|
|
, spacing 10
|
|
, width fill
|
|
]
|
|
[ namedLink "/" "TODOAPP"
|
|
, getDebugInfo model
|
|
, getCurrentUser model
|
|
]
|
|
|
|
|
|
|
|
-- temp function to get current page url
|
|
-- and links in case shit breaks
|
|
|
|
|
|
getDebugInfo : Model -> Element Msg
|
|
getDebugInfo model =
|
|
row
|
|
[ centerX ]
|
|
[ text "Current URL: "
|
|
, bolded (Url.toString model.url)
|
|
, column []
|
|
[ namedLink "/" "root"
|
|
, namedLink "/login" "login"
|
|
, namedLink "/signup" "signup"
|
|
, namedLink "/account" "account"
|
|
, namedLink "/about" "about"
|
|
]
|
|
]
|
|
|
|
|
|
getCurrentUser : Model -> Element Msg
|
|
getCurrentUser model =
|
|
el []
|
|
(case model.user of
|
|
Just user ->
|
|
namedLink "/account" user.email
|
|
|
|
_ ->
|
|
namedLink "/login" "Log In"
|
|
)
|