mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-03-28 17:55:06 +00:00
- 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
58 lines
1.2 KiB
Elm
58 lines
1.2 KiB
Elm
module Page.Home.Data exposing
|
|
( Model
|
|
, Msg(..)
|
|
, ViewMode(..)
|
|
, emptyModel
|
|
, itemNav
|
|
)
|
|
|
|
import Api.Model.ItemDetail exposing (ItemDetail)
|
|
import Api.Model.ItemLightList exposing (ItemLightList)
|
|
import Comp.ItemList
|
|
import Comp.SearchMenu
|
|
import Http
|
|
|
|
|
|
type alias Model =
|
|
{ searchMenuModel : Comp.SearchMenu.Model
|
|
, itemListModel : Comp.ItemList.Model
|
|
, searchInProgress : Bool
|
|
, viewMode : ViewMode
|
|
}
|
|
|
|
|
|
emptyModel : Model
|
|
emptyModel =
|
|
{ searchMenuModel = Comp.SearchMenu.emptyModel
|
|
, itemListModel = Comp.ItemList.emptyModel
|
|
, searchInProgress = False
|
|
, viewMode = Listing
|
|
}
|
|
|
|
|
|
type Msg
|
|
= Init
|
|
| SearchMenuMsg Comp.SearchMenu.Msg
|
|
| ItemListMsg Comp.ItemList.Msg
|
|
| ItemSearchResp (Result Http.Error ItemLightList)
|
|
| DoSearch
|
|
|
|
|
|
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
|
|
}
|