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

@ -5,14 +5,17 @@ module Comp.ImapSettingsManage exposing
, init
, update
, view
, view2
)
import Api
import Api.Model.BasicResult exposing (BasicResult)
import Api.Model.ImapSettings
import Api.Model.ImapSettingsList exposing (ImapSettingsList)
import Comp.Basic as B
import Comp.ImapSettingsForm
import Comp.ImapSettingsTable
import Comp.MenuBar as MB
import Comp.YesNoDimmer
import Data.Flags exposing (Flags)
import Data.UiSettings exposing (UiSettings)
@ -20,6 +23,7 @@ import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onClick, onInput)
import Http
import Styles as S
import Util.Http
@ -200,6 +204,10 @@ update flags msg model =
( { model | loading = False }, Cmd.none )
--- View
view : UiSettings -> Model -> Html Msg
view settings model =
case model.viewMode of
@ -287,3 +295,105 @@ viewForm settings model =
[ div [ class "ui loader" ] []
]
]
--- View2
view2 : UiSettings -> Model -> Html Msg
view2 settings model =
case model.viewMode of
Table ->
viewTable2 model
Form ->
viewForm2 settings model
viewTable2 : Model -> Html Msg
viewTable2 model =
div []
[ MB.view
{ start =
[ MB.TextInput
{ tagger = SetQuery
, value = model.query
, placeholder = "Search"
, icon = Just "fa fa-search"
}
]
, end =
[ MB.PrimaryButton
{ tagger = InitNew
, title = "Add new SMTP settings"
, icon = Just "fa fa-plus"
, label = "New Settings"
}
]
, rootClasses = "mb-4"
}
, Html.map TableMsg
(Comp.ImapSettingsTable.view2
model.tableModel
)
]
viewForm2 : UiSettings -> Model -> Html Msg
viewForm2 settings model =
let
dimmerSettings =
Comp.YesNoDimmer.defaultSettings2 "Really delete this mail-box connection?"
in
div [ class "flex flex-col md:relative" ]
[ MB.view
{ start =
[ MB.PrimaryButton
{ tagger = Submit
, title = "Submit this form"
, icon = Just "fa fa-save"
, label = "Submit"
}
, MB.SecondaryButton
{ tagger = SetViewMode Table
, title = "Back to list"
, icon = Just "fa fa-arrow-left"
, label = "Cancel"
}
]
, end =
if model.formModel.settings.name /= "" then
[ MB.DeleteButton
{ tagger = RequestDelete
, title = "Delete this settings entry"
, icon = Just "fa fa-trash"
, label = "Delete"
}
]
else
[]
, rootClasses = "mb-4"
}
, Html.map FormMsg
(Comp.ImapSettingsForm.view2
settings
model.formModel
)
, div
[ classList
[ ( "hidden", model.formError == Nothing )
]
, class S.errorMessage
]
[ Maybe.withDefault "" model.formError |> text
]
, Html.map YesNoMsg
(Comp.YesNoDimmer.viewN
True
dimmerSettings
model.deleteConfirm
)
, B.loadingDimmer model.loading
]