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

@ -8,6 +8,7 @@ import App.Data exposing (..)
import Browser exposing (UrlRequest(..))
import Browser.Navigation as Nav
import Data.Flags
import Data.UiTheme
import Page exposing (Page(..))
import Page.CollectiveSettings.Data
import Page.CollectiveSettings.Update
@ -47,6 +48,38 @@ update msg model =
updateWithSub : Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
updateWithSub msg model =
case msg of
ToggleSidebar ->
( { model | sidebarVisible = not model.sidebarVisible }, Cmd.none, Sub.none )
ToggleDarkMode ->
let
settings =
model.uiSettings
next =
Data.UiTheme.cycle settings.uiTheme
newSettings =
{ settings | uiTheme = next }
in
case model.flags.account of
Just _ ->
-- when authenticated, store it in settings only
-- once new settings arrive via a subscription,
-- the ui is updated. so it is also updated on
-- page refresh
( { model | userMenuOpen = False }
, Ports.storeUiSettings model.flags newSettings
, Sub.none
)
Nothing ->
-- when not logged in, simply set the theme
( { model | userMenuOpen = False }
, Ports.setUiTheme next
, Sub.none
)
HomeMsg lm ->
updateHome lm model
@ -213,8 +246,17 @@ updateWithSub msg model =
)
GetUiSettings settings ->
let
setTheme =
Ports.setUiTheme settings.uiTheme
in
Util.Update.andThen2
[ updateUserSettings Page.UserSettings.Data.UpdateSettings
[ \m ->
( { m | sidebarVisible = settings.sideMenuVisible }
, setTheme
, Sub.none
)
, updateUserSettings Page.UserSettings.Data.UpdateSettings
, updateHome Page.Home.Data.UiSettingsUpdated
, updateItemDetail Page.ItemDetail.Data.UiSettingsUpdated
]