First version of new ui based on tailwind

This drops fomantic-ui as css toolkit and introduces tailwindcss. With
tailwind there are no predefined components, but it's very easy to
create those. So customizing the look&feel is much simpler, most of
the time no additional css is needed.

This requires a complete rewrite of the markup + styles. Luckily all
logic can be kept as is. The now old ui is not removed, it is still
available by using a request header `Docspell-Ui` with a value of `1`
for the old ui and `2` for the new ui.

Another addition is "dev mode", where docspell serves assets with a
no-cache header, to disable browser caching. This makes developing a
lot easier.
This commit is contained in:
Eike Kettner
2021-01-29 20:48:27 +01:00
parent 442b76c5af
commit dd935454c9
140 changed files with 15077 additions and 214 deletions

View File

@ -4,12 +4,14 @@ module Comp.ScanMailboxManage exposing
, init
, update
, view
, view2
)
import Api
import Api.Model.BasicResult exposing (BasicResult)
import Api.Model.ScanMailboxSettings exposing (ScanMailboxSettings)
import Api.Model.ScanMailboxSettingsList exposing (ScanMailboxSettingsList)
import Comp.MenuBar as MB
import Comp.ScanMailboxForm
import Comp.ScanMailboxList
import Data.Flags exposing (Flags)
@ -18,6 +20,7 @@ import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onClick)
import Http
import Styles as S
import Util.Http
@ -253,3 +256,57 @@ viewForm settings model =
viewList : Model -> Html Msg
viewList model =
Html.map ListMsg (Comp.ScanMailboxList.view model.listModel model.items)
--- View2
view2 : UiSettings -> Model -> Html Msg
view2 settings model =
div [ class "flex flex-col" ]
([ div
[ classList
[ ( S.errorMessage, Maybe.map .success model.result == Just False )
, ( S.successMessage, Maybe.map .success model.result == Just True )
, ( "hidden", model.result == Nothing )
]
]
[ Maybe.map .message model.result
|> Maybe.withDefault ""
|> text
]
]
++ (case model.detailModel of
Just msett ->
viewForm2 settings msett
Nothing ->
viewList2 model
)
)
viewForm2 : UiSettings -> Comp.ScanMailboxForm.Model -> List (Html Msg)
viewForm2 settings model =
[ Html.map DetailMsg
(Comp.ScanMailboxForm.view2 "" settings model)
]
viewList2 : Model -> List (Html Msg)
viewList2 model =
[ MB.view
{ start =
[ MB.PrimaryButton
{ tagger = NewTask
, label = "New Task"
, icon = Just "fa fa-plus"
, title = "Create a new scan mailbox task"
}
]
, end = []
, rootClasses = "mb-4"
}
, Html.map ListMsg (Comp.ScanMailboxList.view2 model.listModel model.items)
]