mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-26 02:48:25 +00:00
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:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user