Improve item detail view

- Separate page (permalink) for item details

- Use available space and hide search menu

- Disable item navigation links if there is nothing to go to

- Show notes more prominently and allow to hide them
This commit is contained in:
Eike Kettner
2019-12-31 00:56:41 +01:00
parent 36a6fdd746
commit c73cdd82ab
12 changed files with 342 additions and 183 deletions

View File

@ -10,6 +10,7 @@ module Page exposing
, pageFromString
, pageName
, pageToString
, set
, uploadId
)
@ -31,6 +32,7 @@ type Page
| RegisterPage
| UploadPage (Maybe String)
| NewInvitePage
| ItemDetailPage String
isSecured : Page -> Bool
@ -63,6 +65,9 @@ isSecured page =
UploadPage arg ->
Util.Maybe.isEmpty arg
ItemDetailPage _ ->
True
isOpen : Page -> Bool
isOpen page =
@ -114,6 +119,9 @@ pageName page =
Nothing ->
"Upload"
ItemDetailPage _ ->
"Item"
loginPageReferrer : Page -> Maybe Page
loginPageReferrer page =
@ -169,6 +177,9 @@ pageToString page =
NewInvitePage ->
"/app/newinvite"
ItemDetailPage id ->
"/app/item/" ++ id
pageFromString : String -> Maybe Page
pageFromString str =
@ -191,6 +202,11 @@ href page =
Attr.href (pageToString page)
set : Nav.Key -> Page -> Cmd msg
set key page =
Nav.pushUrl key (pageToString page)
goto : Page -> Cmd msg
goto page =
Nav.load (pageToString page)
@ -215,6 +231,7 @@ parser =
, Parser.map (\s -> UploadPage (Just s)) (s pathPrefix </> s "upload" </> string)
, Parser.map (UploadPage Nothing) (s pathPrefix </> s "upload")
, Parser.map NewInvitePage (s pathPrefix </> s "newinvite")
, Parser.map ItemDetailPage (s pathPrefix </> s "item" </> string)
]