mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Improve document list view
Replace the html table with something that has more vertical space, but scales better horizontally. On most screens at least 6-8 entries should be visible at once.
This commit is contained in:
@ -7,14 +7,14 @@ module Page.Home.Data exposing
|
||||
)
|
||||
|
||||
import Api.Model.ItemLightList exposing (ItemLightList)
|
||||
import Comp.ItemList
|
||||
import Comp.ItemCardList
|
||||
import Comp.SearchMenu
|
||||
import Http
|
||||
|
||||
|
||||
type alias Model =
|
||||
{ searchMenuModel : Comp.SearchMenu.Model
|
||||
, itemListModel : Comp.ItemList.Model
|
||||
, itemListModel : Comp.ItemCardList.Model
|
||||
, searchInProgress : Bool
|
||||
, viewMode : ViewMode
|
||||
}
|
||||
@ -23,7 +23,7 @@ type alias Model =
|
||||
emptyModel : Model
|
||||
emptyModel =
|
||||
{ searchMenuModel = Comp.SearchMenu.emptyModel
|
||||
, itemListModel = Comp.ItemList.emptyModel
|
||||
, itemListModel = Comp.ItemCardList.init
|
||||
, searchInProgress = False
|
||||
, viewMode = Listing
|
||||
}
|
||||
@ -33,7 +33,7 @@ type Msg
|
||||
= Init
|
||||
| SearchMenuMsg Comp.SearchMenu.Msg
|
||||
| ResetSearch
|
||||
| ItemListMsg Comp.ItemList.Msg
|
||||
| ItemCardListMsg Comp.ItemCardList.Msg
|
||||
| ItemSearchResp (Result Http.Error ItemLightList)
|
||||
| DoSearch
|
||||
|
||||
@ -47,10 +47,10 @@ itemNav : String -> Model -> { prev : Maybe String, next : Maybe String }
|
||||
itemNav id model =
|
||||
let
|
||||
prev =
|
||||
Comp.ItemList.prevItem model.itemListModel id
|
||||
Comp.ItemCardList.prevItem model.itemListModel id
|
||||
|
||||
next =
|
||||
Comp.ItemList.nextItem model.itemListModel id
|
||||
Comp.ItemCardList.nextItem model.itemListModel id
|
||||
in
|
||||
{ prev = Maybe.map .id prev
|
||||
, next = Maybe.map .id next
|
||||
|
@ -2,7 +2,7 @@ module Page.Home.Update exposing (update)
|
||||
|
||||
import Api
|
||||
import Browser.Navigation as Nav
|
||||
import Comp.ItemList
|
||||
import Comp.ItemCardList
|
||||
import Comp.SearchMenu
|
||||
import Data.Flags exposing (Flags)
|
||||
import Page exposing (Page(..))
|
||||
@ -40,10 +40,10 @@ update key flags msg model =
|
||||
in
|
||||
( m2, Cmd.batch [ c2, Cmd.map SearchMenuMsg (Tuple.second nextState.modelCmd) ] )
|
||||
|
||||
ItemListMsg m ->
|
||||
ItemCardListMsg m ->
|
||||
let
|
||||
( m2, c2, mitem ) =
|
||||
Comp.ItemList.update flags m model.itemListModel
|
||||
Comp.ItemCardList.update flags m model.itemListModel
|
||||
|
||||
cmd =
|
||||
case mitem of
|
||||
@ -53,14 +53,14 @@ update key flags msg model =
|
||||
Nothing ->
|
||||
Cmd.none
|
||||
in
|
||||
( { model | itemListModel = m2 }, Cmd.batch [ Cmd.map ItemListMsg c2, cmd ] )
|
||||
( { model | itemListModel = m2 }, Cmd.batch [ Cmd.map ItemCardListMsg c2, cmd ] )
|
||||
|
||||
ItemSearchResp (Ok list) ->
|
||||
let
|
||||
m =
|
||||
{ model | searchInProgress = False, viewMode = Listing }
|
||||
in
|
||||
update key flags (ItemListMsg (Comp.ItemList.SetResults list)) m
|
||||
update key flags (ItemCardListMsg (Comp.ItemCardList.SetResults list)) m
|
||||
|
||||
ItemSearchResp (Err _) ->
|
||||
( { model | searchInProgress = False }, Cmd.none )
|
||||
|
@ -1,6 +1,6 @@
|
||||
module Page.Home.View exposing (view)
|
||||
|
||||
import Comp.ItemList
|
||||
import Comp.ItemCardList
|
||||
import Comp.SearchMenu
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
@ -45,7 +45,7 @@ view model =
|
||||
resultPlaceholder
|
||||
|
||||
else
|
||||
Html.map ItemListMsg (Comp.ItemList.view model.itemListModel)
|
||||
Html.map ItemCardListMsg (Comp.ItemCardList.view model.itemListModel)
|
||||
|
||||
Detail ->
|
||||
div [] []
|
||||
|
Reference in New Issue
Block a user