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

@ -3,11 +3,11 @@ module Page.Home.Data exposing
, Msg(..)
, ViewMode(..)
, emptyModel
, itemNav
)
import Api.Model.ItemDetail exposing (ItemDetail)
import Api.Model.ItemLightList exposing (ItemLightList)
import Comp.ItemDetail
import Comp.ItemList
import Comp.SearchMenu
import Http
@ -17,7 +17,6 @@ type alias Model =
{ searchMenuModel : Comp.SearchMenu.Model
, itemListModel : Comp.ItemList.Model
, searchInProgress : Bool
, itemDetailModel : Comp.ItemDetail.Model
, viewMode : ViewMode
}
@ -26,7 +25,6 @@ emptyModel : Model
emptyModel =
{ searchMenuModel = Comp.SearchMenu.emptyModel
, itemListModel = Comp.ItemList.emptyModel
, itemDetailModel = Comp.ItemDetail.emptyModel
, searchInProgress = False
, viewMode = Listing
}
@ -38,10 +36,22 @@ type Msg
| ItemListMsg Comp.ItemList.Msg
| ItemSearchResp (Result Http.Error ItemLightList)
| DoSearch
| ItemDetailMsg Comp.ItemDetail.Msg
| ItemDetailResp (Result Http.Error ItemDetail)
type ViewMode
= Listing
| Detail
itemNav : String -> Model -> { prev : Maybe String, next : Maybe String }
itemNav id model =
let
prev =
Comp.ItemList.prevItem model.itemListModel id
next =
Comp.ItemList.nextItem model.itemListModel id
in
{ prev = Maybe.map .id prev
, next = Maybe.map .id next
}