mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 10:58:26 +00:00
Readonly dashboard
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
module Comp.BoxQueryView exposing (..)
|
||||
module Comp.BoxQueryView exposing (Model, Msg, init, reloadData, update, view)
|
||||
|
||||
import Api
|
||||
import Api.Model.ItemLight exposing (ItemLight)
|
||||
@ -32,6 +32,7 @@ type ViewResult
|
||||
|
||||
type Msg
|
||||
= ItemsResp (Result Http.Error ItemLightList)
|
||||
| ReloadData
|
||||
|
||||
|
||||
init : Flags -> QueryData -> ( Model, Cmd Msg )
|
||||
@ -39,27 +40,30 @@ init flags data =
|
||||
( { results = Loading
|
||||
, meta = data
|
||||
}
|
||||
, case data.query of
|
||||
SearchQueryString q ->
|
||||
Api.itemSearch flags (mkQuery q data) ItemsResp
|
||||
|
||||
SearchQueryBookmark bmId ->
|
||||
Api.itemSearchBookmark flags (mkQuery bmId data) ItemsResp
|
||||
, dataCmd flags data
|
||||
)
|
||||
|
||||
|
||||
reloadData : Msg
|
||||
reloadData =
|
||||
ReloadData
|
||||
|
||||
|
||||
|
||||
--- Update
|
||||
|
||||
|
||||
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||
update msg model =
|
||||
update : Flags -> Msg -> Model -> ( Model, Cmd Msg, Bool )
|
||||
update flags msg model =
|
||||
case msg of
|
||||
ItemsResp (Ok list) ->
|
||||
( { model | results = Loaded list }, Cmd.none )
|
||||
( { model | results = Loaded list }, Cmd.none, False )
|
||||
|
||||
ItemsResp (Err err) ->
|
||||
( { model | results = Failed err }, Cmd.none )
|
||||
( { model | results = Failed err }, Cmd.none, False )
|
||||
|
||||
ReloadData ->
|
||||
( model, dataCmd flags model.meta, True )
|
||||
|
||||
|
||||
|
||||
@ -154,7 +158,7 @@ viewEmpty : Texts -> Html Msg
|
||||
viewEmpty texts =
|
||||
div [ class "flex justify-center items-center h-full" ]
|
||||
[ div [ class "px-4 py-4 text-center align-middle text-lg" ]
|
||||
[ i [ class "fa fa-eraser mr-2" ] []
|
||||
[ i [ class "fa fa-smile font-thin mr-2" ] []
|
||||
, text texts.noResults
|
||||
]
|
||||
]
|
||||
@ -182,3 +186,13 @@ mkQuery q meta =
|
||||
, searchMode = Just <| Data.SearchMode.asString Data.SearchMode.Normal
|
||||
, withDetails = Just meta.details
|
||||
}
|
||||
|
||||
|
||||
dataCmd : Flags -> QueryData -> Cmd Msg
|
||||
dataCmd flags data =
|
||||
case data.query of
|
||||
SearchQueryString q ->
|
||||
Api.itemSearch flags (mkQuery q data) ItemsResp
|
||||
|
||||
SearchQueryBookmark bmId ->
|
||||
Api.itemSearchBookmark flags (mkQuery bmId data) ItemsResp
|
||||
|
@ -1,4 +1,4 @@
|
||||
module Comp.BoxSummaryView exposing (..)
|
||||
module Comp.BoxSummaryView exposing (Model, Msg, init, reloadData, update, view)
|
||||
|
||||
import Api
|
||||
import Api.Model.ItemQuery exposing (ItemQuery)
|
||||
@ -17,7 +17,7 @@ import Util.List
|
||||
|
||||
type alias Model =
|
||||
{ results : ViewResult
|
||||
, show : SummaryShow
|
||||
, meta : SummaryData
|
||||
}
|
||||
|
||||
|
||||
@ -29,34 +29,38 @@ type ViewResult
|
||||
|
||||
type Msg
|
||||
= StatsResp (Result Http.Error SearchStats)
|
||||
| ReloadData
|
||||
|
||||
|
||||
init : Flags -> SummaryData -> ( Model, Cmd Msg )
|
||||
init flags data =
|
||||
( { results = Loading
|
||||
, show = data.show
|
||||
, meta = data
|
||||
}
|
||||
, case data.query of
|
||||
SearchQueryString q ->
|
||||
Api.itemSearchStats flags (mkQuery q) StatsResp
|
||||
|
||||
SearchQueryBookmark bmId ->
|
||||
Api.itemSearchStatsBookmark flags (mkQuery bmId) StatsResp
|
||||
, dataCmd flags data
|
||||
)
|
||||
|
||||
|
||||
reloadData : Msg
|
||||
reloadData =
|
||||
ReloadData
|
||||
|
||||
|
||||
|
||||
--- Update
|
||||
|
||||
|
||||
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||
update msg model =
|
||||
update : Flags -> Msg -> Model -> ( Model, Cmd Msg, Bool )
|
||||
update flags msg model =
|
||||
case msg of
|
||||
StatsResp (Ok stats) ->
|
||||
( { model | results = Loaded stats }, Cmd.none )
|
||||
( { model | results = Loaded stats }, Cmd.none, False )
|
||||
|
||||
StatsResp (Err err) ->
|
||||
( { model | results = Failed err }, Cmd.none )
|
||||
( { model | results = Failed err }, Cmd.none, False )
|
||||
|
||||
ReloadData ->
|
||||
( model, dataCmd flags model.meta, True )
|
||||
|
||||
|
||||
|
||||
@ -85,16 +89,21 @@ view texts model =
|
||||
]
|
||||
|
||||
Loaded stats ->
|
||||
case model.show of
|
||||
Data.BoxContent.SummaryShowFields flag ->
|
||||
Comp.SearchStatsView.view2
|
||||
texts.statsView
|
||||
flag
|
||||
""
|
||||
stats
|
||||
viewStats texts model stats
|
||||
|
||||
SummaryShowGeneral ->
|
||||
viewGeneral texts stats
|
||||
|
||||
viewStats : Texts -> Model -> SearchStats -> Html Msg
|
||||
viewStats texts model stats =
|
||||
case model.meta.show of
|
||||
SummaryShowFields flag ->
|
||||
Comp.SearchStatsView.view2
|
||||
texts.statsView
|
||||
flag
|
||||
""
|
||||
stats
|
||||
|
||||
SummaryShowGeneral ->
|
||||
viewGeneral texts stats
|
||||
|
||||
|
||||
viewGeneral : Texts -> SearchStats -> Html Msg
|
||||
@ -158,3 +167,13 @@ mkQuery query =
|
||||
, searchMode = Nothing
|
||||
, withDetails = Nothing
|
||||
}
|
||||
|
||||
|
||||
dataCmd : Flags -> SummaryData -> Cmd Msg
|
||||
dataCmd flags data =
|
||||
case data.query of
|
||||
SearchQueryString q ->
|
||||
Api.itemSearchStats flags (mkQuery q) StatsResp
|
||||
|
||||
SearchQueryBookmark bmId ->
|
||||
Api.itemSearchStatsBookmark flags (mkQuery bmId) StatsResp
|
||||
|
62
modules/webapp/src/main/elm/Comp/BoxUploadView.elm
Normal file
62
modules/webapp/src/main/elm/Comp/BoxUploadView.elm
Normal file
@ -0,0 +1,62 @@
|
||||
module Comp.BoxUploadView exposing (..)
|
||||
|
||||
import Comp.UploadForm
|
||||
import Data.Flags exposing (Flags)
|
||||
import Data.UiSettings exposing (UiSettings)
|
||||
import Html exposing (Html, div)
|
||||
import Html.Attributes exposing (class)
|
||||
import Messages.Comp.BoxUploadView exposing (Texts)
|
||||
|
||||
|
||||
type alias Model =
|
||||
{ uploadForm : Comp.UploadForm.Model
|
||||
, sourceId : Maybe String
|
||||
}
|
||||
|
||||
|
||||
type Msg
|
||||
= UploadMsg Comp.UploadForm.Msg
|
||||
|
||||
|
||||
init : Maybe String -> Model
|
||||
init sourceId =
|
||||
{ uploadForm = Comp.UploadForm.init
|
||||
, sourceId = sourceId
|
||||
}
|
||||
|
||||
|
||||
|
||||
--- Update
|
||||
|
||||
|
||||
update : Flags -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
|
||||
update flags msg model =
|
||||
case msg of
|
||||
UploadMsg lm ->
|
||||
let
|
||||
( um, uc, us ) =
|
||||
Comp.UploadForm.update model.sourceId flags lm model.uploadForm
|
||||
in
|
||||
( { model | uploadForm = um }
|
||||
, Cmd.map UploadMsg uc
|
||||
, Sub.map UploadMsg us
|
||||
)
|
||||
|
||||
|
||||
|
||||
--- View
|
||||
|
||||
|
||||
view : Texts -> Flags -> UiSettings -> Model -> Html Msg
|
||||
view texts flags settings model =
|
||||
let
|
||||
viewCfg =
|
||||
{ sourceId = model.sourceId
|
||||
, showForm = False
|
||||
, lightForm = True
|
||||
}
|
||||
in
|
||||
div [ class "" ]
|
||||
[ Html.map UploadMsg
|
||||
(Comp.UploadForm.view texts.uploadForm viewCfg flags settings model.uploadForm)
|
||||
]
|
@ -2,10 +2,12 @@ module Comp.BoxView exposing (..)
|
||||
|
||||
import Comp.BoxQueryView
|
||||
import Comp.BoxSummaryView
|
||||
import Comp.BoxUploadView
|
||||
import Data.Box exposing (Box)
|
||||
import Data.BoxContent exposing (BoxContent(..), MessageData)
|
||||
import Data.Flags exposing (Flags)
|
||||
import Html exposing (Html, div, text)
|
||||
import Data.UiSettings exposing (UiSettings)
|
||||
import Html exposing (Html, div, i, text)
|
||||
import Html.Attributes exposing (class, classList)
|
||||
import Markdown
|
||||
import Messages.Comp.BoxView exposing (Texts)
|
||||
@ -15,12 +17,13 @@ import Styles as S
|
||||
type alias Model =
|
||||
{ box : Box
|
||||
, content : ContentModel
|
||||
, reloading : Bool
|
||||
}
|
||||
|
||||
|
||||
type ContentModel
|
||||
= ContentMessage Data.BoxContent.MessageData
|
||||
| ContentUpload (Maybe String)
|
||||
| ContentUpload Comp.BoxUploadView.Model
|
||||
| ContentQuery Comp.BoxQueryView.Model
|
||||
| ContentSummary Comp.BoxSummaryView.Model
|
||||
|
||||
@ -28,6 +31,8 @@ type ContentModel
|
||||
type Msg
|
||||
= QueryMsg Comp.BoxQueryView.Msg
|
||||
| SummaryMsg Comp.BoxSummaryView.Msg
|
||||
| UploadMsg Comp.BoxUploadView.Msg
|
||||
| ReloadData
|
||||
|
||||
|
||||
init : Flags -> Box -> ( Model, Cmd Msg )
|
||||
@ -38,11 +43,17 @@ init flags box =
|
||||
in
|
||||
( { box = box
|
||||
, content = cm
|
||||
, reloading = False
|
||||
}
|
||||
, cc
|
||||
)
|
||||
|
||||
|
||||
reloadData : Msg
|
||||
reloadData =
|
||||
ReloadData
|
||||
|
||||
|
||||
contentInit : Flags -> BoxContent -> ( ContentModel, Cmd Msg )
|
||||
contentInit flags content =
|
||||
case content of
|
||||
@ -50,7 +61,11 @@ contentInit flags content =
|
||||
( ContentMessage data, Cmd.none )
|
||||
|
||||
BoxUpload source ->
|
||||
( ContentUpload source, Cmd.none )
|
||||
let
|
||||
qm =
|
||||
Comp.BoxUploadView.init source
|
||||
in
|
||||
( ContentUpload qm, Cmd.none )
|
||||
|
||||
BoxQuery data ->
|
||||
let
|
||||
@ -71,17 +86,20 @@ contentInit flags content =
|
||||
--- Update
|
||||
|
||||
|
||||
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||
update msg model =
|
||||
update : Flags -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
|
||||
update flags msg model =
|
||||
case msg of
|
||||
QueryMsg lm ->
|
||||
case model.content of
|
||||
ContentQuery qm ->
|
||||
let
|
||||
( cm, cc ) =
|
||||
Comp.BoxQueryView.update lm qm
|
||||
( cm, cc, reloading ) =
|
||||
Comp.BoxQueryView.update flags lm qm
|
||||
in
|
||||
( { model | content = ContentQuery cm }, Cmd.map QueryMsg cc )
|
||||
( { model | content = ContentQuery cm, reloading = reloading }
|
||||
, Cmd.map QueryMsg cc
|
||||
, Sub.none
|
||||
)
|
||||
|
||||
_ ->
|
||||
unit model
|
||||
@ -90,43 +108,84 @@ update msg model =
|
||||
case model.content of
|
||||
ContentSummary qm ->
|
||||
let
|
||||
( cm, cc ) =
|
||||
Comp.BoxSummaryView.update lm qm
|
||||
( cm, cc, reloading ) =
|
||||
Comp.BoxSummaryView.update flags lm qm
|
||||
in
|
||||
( { model | content = ContentSummary cm }, Cmd.map SummaryMsg cc )
|
||||
( { model | content = ContentSummary cm, reloading = reloading }
|
||||
, Cmd.map SummaryMsg cc
|
||||
, Sub.none
|
||||
)
|
||||
|
||||
_ ->
|
||||
unit model
|
||||
|
||||
UploadMsg lm ->
|
||||
case model.content of
|
||||
ContentUpload qm ->
|
||||
let
|
||||
( cm, cc, cs ) =
|
||||
Comp.BoxUploadView.update flags lm qm
|
||||
in
|
||||
( { model | content = ContentUpload cm }
|
||||
, Cmd.map UploadMsg cc
|
||||
, Sub.map UploadMsg cs
|
||||
)
|
||||
|
||||
_ ->
|
||||
unit model
|
||||
|
||||
ReloadData ->
|
||||
case model.content of
|
||||
ContentQuery _ ->
|
||||
update flags (QueryMsg Comp.BoxQueryView.reloadData) model
|
||||
|
||||
ContentSummary _ ->
|
||||
update flags (SummaryMsg Comp.BoxSummaryView.reloadData) model
|
||||
|
||||
_ ->
|
||||
unit model
|
||||
|
||||
|
||||
unit : Model -> ( Model, Cmd Msg )
|
||||
unit : Model -> ( Model, Cmd Msg, Sub Msg )
|
||||
unit model =
|
||||
( model, Cmd.none )
|
||||
( model, Cmd.none, Sub.none )
|
||||
|
||||
|
||||
|
||||
--- View
|
||||
|
||||
|
||||
view : Texts -> Model -> Html Msg
|
||||
view texts model =
|
||||
view : Texts -> Flags -> UiSettings -> Model -> Html Msg
|
||||
view texts flags settings model =
|
||||
div
|
||||
[ classList [ ( S.box ++ "rounded", model.box.decoration ) ]
|
||||
, class (spanStyle model.box)
|
||||
, class "relative h-full"
|
||||
, classList [ ( "hidden", not model.box.visible ) ]
|
||||
]
|
||||
[ boxHeader model
|
||||
[ boxLoading model
|
||||
, boxHeader model
|
||||
, div [ class "px-2 py-1 h-5/6" ]
|
||||
[ boxContent texts model
|
||||
[ boxContent texts flags settings model
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
boxLoading : Model -> Html Msg
|
||||
boxLoading model =
|
||||
if not model.reloading then
|
||||
div [ class "hidden" ] []
|
||||
|
||||
else
|
||||
div [ class "absolute right-0 top-1 h-6 w-6" ]
|
||||
[ i [ class "fa fa-spinner animate-spin" ] []
|
||||
]
|
||||
|
||||
|
||||
boxHeader : Model -> Html Msg
|
||||
boxHeader model =
|
||||
div
|
||||
[ class "border-b dark:border-slate-500 flex flex-row py-1 bg-blue-50 dark:bg-slate-700 rounded-t"
|
||||
[ class "flex flex-row py-1 bg-blue-50 dark:bg-slate-700 rounded-t"
|
||||
, classList [ ( "hidden", not model.box.decoration || model.box.name == "" ) ]
|
||||
]
|
||||
[ div [ class "flex text-lg tracking-medium italic px-2" ]
|
||||
@ -135,14 +194,15 @@ boxHeader model =
|
||||
]
|
||||
|
||||
|
||||
boxContent : Texts -> Model -> Html Msg
|
||||
boxContent texts model =
|
||||
boxContent : Texts -> Flags -> UiSettings -> Model -> Html Msg
|
||||
boxContent texts flags settings model =
|
||||
case model.content of
|
||||
ContentMessage m ->
|
||||
messageContent m
|
||||
|
||||
ContentUpload sourceId ->
|
||||
Debug.todo "not implemented"
|
||||
ContentUpload qm ->
|
||||
Html.map UploadMsg
|
||||
(Comp.BoxUploadView.view texts.uploadView flags settings qm)
|
||||
|
||||
ContentQuery qm ->
|
||||
Html.map QueryMsg
|
||||
|
@ -1,13 +1,15 @@
|
||||
module Comp.DashboardView exposing (Model, Msg, init, update, view, viewBox)
|
||||
module Comp.DashboardView exposing (Model, Msg, init, reloadData, update, view, viewBox)
|
||||
|
||||
import Comp.BoxView
|
||||
import Data.Box exposing (Box)
|
||||
import Data.Dashboard exposing (Dashboard)
|
||||
import Data.Flags exposing (Flags)
|
||||
import Data.UiSettings exposing (UiSettings)
|
||||
import Dict exposing (Dict)
|
||||
import Html exposing (Html, div)
|
||||
import Html.Attributes exposing (class)
|
||||
import Messages.Comp.DashboardView exposing (Texts)
|
||||
import Util.Update
|
||||
|
||||
|
||||
type alias Model =
|
||||
@ -18,6 +20,7 @@ type alias Model =
|
||||
|
||||
type Msg
|
||||
= BoxMsg Int Comp.BoxView.Msg
|
||||
| ReloadData
|
||||
|
||||
|
||||
init : Flags -> Dashboard -> ( Model, Cmd Msg )
|
||||
@ -37,49 +40,64 @@ init flags db =
|
||||
)
|
||||
|
||||
|
||||
reloadData : Msg
|
||||
reloadData =
|
||||
ReloadData
|
||||
|
||||
|
||||
|
||||
--- Update
|
||||
|
||||
|
||||
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||
update msg model =
|
||||
update : Flags -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
|
||||
update flags msg model =
|
||||
case msg of
|
||||
BoxMsg index lm ->
|
||||
case Dict.get index model.boxModels of
|
||||
Just bm ->
|
||||
let
|
||||
( cm, cc ) =
|
||||
Comp.BoxView.update lm bm
|
||||
( cm, cc, cs ) =
|
||||
Comp.BoxView.update flags lm bm
|
||||
in
|
||||
( { model | boxModels = Dict.insert index cm model.boxModels }
|
||||
, Cmd.map (BoxMsg index) cc
|
||||
, Sub.map (BoxMsg index) cs
|
||||
)
|
||||
|
||||
Nothing ->
|
||||
unit model
|
||||
|
||||
ReloadData ->
|
||||
let
|
||||
updateAll =
|
||||
List.map (\index -> BoxMsg index Comp.BoxView.reloadData) (Dict.keys model.boxModels)
|
||||
|> List.map (\m -> update flags m)
|
||||
|> Util.Update.andThen2
|
||||
in
|
||||
updateAll model
|
||||
|
||||
unit : Model -> ( Model, Cmd Msg )
|
||||
|
||||
unit : Model -> ( Model, Cmd Msg, Sub Msg )
|
||||
unit model =
|
||||
( model, Cmd.none )
|
||||
( model, Cmd.none, Sub.none )
|
||||
|
||||
|
||||
|
||||
--- View
|
||||
|
||||
|
||||
view : Texts -> Model -> Html Msg
|
||||
view texts model =
|
||||
view : Texts -> Flags -> UiSettings -> Model -> Html Msg
|
||||
view texts flags settings model =
|
||||
div
|
||||
[ class (gridStyle model.dashboard)
|
||||
]
|
||||
(List.indexedMap (viewBox texts) <| Dict.values model.boxModels)
|
||||
(List.indexedMap (viewBox texts flags settings) <| Dict.values model.boxModels)
|
||||
|
||||
|
||||
viewBox : Texts -> Int -> Comp.BoxView.Model -> Html Msg
|
||||
viewBox texts index box =
|
||||
viewBox : Texts -> Flags -> UiSettings -> Int -> Comp.BoxView.Model -> Html Msg
|
||||
viewBox texts flags settings index box =
|
||||
Html.map (BoxMsg index)
|
||||
(Comp.BoxView.view texts.boxView box)
|
||||
(Comp.BoxView.view texts.boxView flags settings box)
|
||||
|
||||
|
||||
|
||||
|
@ -3,8 +3,6 @@
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
-}
|
||||
|
||||
|
||||
-- inspired from here: https://ellie-app.com/3T5mNms7SwKa1
|
||||
|
||||
|
||||
@ -132,15 +130,21 @@ filterMime model files =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Texts -> Model -> Html Msg
|
||||
view2 texts model =
|
||||
type alias ViewSettings =
|
||||
{ light : Bool
|
||||
}
|
||||
|
||||
|
||||
view2 : Texts -> ViewSettings -> Model -> Html Msg
|
||||
view2 texts cfg model =
|
||||
div
|
||||
[ classList
|
||||
[ ( "bg-opacity-100 bg-blue-100 dark:bg-sky-800", model.state.hover )
|
||||
, ( "bg-blue-100 dark:bg-sky-900 bg-opacity-50", not model.state.hover )
|
||||
, ( "bg-indigo-100 dark:bg-sky-900 bg-opacity-50", not model.state.hover )
|
||||
, ( "disabled", not model.state.active )
|
||||
]
|
||||
, class "flex flex-col justify-center items-center py-2 md:py-12 border-0 border-t-2 border-blue-500 dark:border-sky-500 dropzone"
|
||||
, class "flex flex-col justify-center items-center py-2 md:py-12 dropzone"
|
||||
, classList [ ( " border-0 border-t-2 border-blue-500 dark:border-sky-500", not cfg.light ) ]
|
||||
, onDragEnter DragEnter
|
||||
, onDragOver DragEnter
|
||||
, onDragLeave DragLeave
|
||||
@ -168,7 +172,10 @@ view2 texts model =
|
||||
, attrs = [ href "#" ]
|
||||
, disabled = not model.state.active
|
||||
}
|
||||
, div [ class "text-center opacity-75 text-sm mt-4" ]
|
||||
, div
|
||||
[ class "text-center opacity-75 text-sm mt-4"
|
||||
, classList [ ( "hidden", cfg.light ) ]
|
||||
]
|
||||
[ text texts.selectInfo
|
||||
]
|
||||
]
|
||||
|
@ -24,6 +24,11 @@ import Util.Size
|
||||
|
||||
view : Texts -> Model -> Html Msg
|
||||
view texts model =
|
||||
let
|
||||
dropzoneCfg =
|
||||
{ light = True
|
||||
}
|
||||
in
|
||||
div
|
||||
[ classList
|
||||
[ ( "hidden", not model.addFilesOpen )
|
||||
@ -35,7 +40,7 @@ view texts model =
|
||||
[ text texts.addMoreFilesToItem
|
||||
]
|
||||
, Html.map AddFilesMsg
|
||||
(Comp.Dropzone.view2 texts.dropzone model.addFilesModel)
|
||||
(Comp.Dropzone.view2 texts.dropzone dropzoneCfg model.addFilesModel)
|
||||
, div [ class "flex flex-row space-x-2 mt-2" ]
|
||||
[ button
|
||||
[ class S.primaryButton
|
||||
|
@ -294,47 +294,57 @@ setErrored model fileid =
|
||||
--- View
|
||||
|
||||
|
||||
view : Texts -> Maybe String -> Flags -> UiSettings -> Model -> Html Msg
|
||||
view texts mid _ _ model =
|
||||
div
|
||||
[ id "content"
|
||||
, class Styles.content
|
||||
]
|
||||
[ div [ class "container mx-auto" ]
|
||||
[ div [ class "px-0 flex flex-col" ]
|
||||
[ div [ class "py-4" ]
|
||||
[ if mid == Nothing then
|
||||
renderForm texts model
|
||||
type alias ViewSettings =
|
||||
{ showForm : Bool
|
||||
, sourceId : Maybe String
|
||||
, lightForm : Bool
|
||||
}
|
||||
|
||||
else
|
||||
span [ class "hidden" ] []
|
||||
|
||||
view : Texts -> ViewSettings -> Flags -> UiSettings -> Model -> Html Msg
|
||||
view texts viewCfg _ _ model =
|
||||
let
|
||||
showForm =
|
||||
viewCfg.sourceId == Nothing && viewCfg.showForm
|
||||
|
||||
dropzoneCfg =
|
||||
{ light = viewCfg.lightForm
|
||||
}
|
||||
in
|
||||
div [ class "mx-auto" ]
|
||||
[ div [ class "px-0 flex flex-col" ]
|
||||
[ if showForm then
|
||||
div [ class "mb-4" ]
|
||||
[ renderForm texts model
|
||||
]
|
||||
, div [ class "py-0" ]
|
||||
[ Html.map DropzoneMsg
|
||||
(Comp.Dropzone.view2 texts.dropzone model.dropzone)
|
||||
|
||||
else
|
||||
span [ class "hidden" ] []
|
||||
, div [ class "py-0" ]
|
||||
[ Html.map DropzoneMsg
|
||||
(Comp.Dropzone.view2 texts.dropzone dropzoneCfg model.dropzone)
|
||||
]
|
||||
, div [ class "py-4" ]
|
||||
[ a
|
||||
[ class Styles.primaryButton
|
||||
, href "#"
|
||||
, onClick SubmitUpload
|
||||
]
|
||||
, div [ class "py-4" ]
|
||||
[ a
|
||||
[ class Styles.primaryButton
|
||||
, href "#"
|
||||
, onClick SubmitUpload
|
||||
]
|
||||
[ text texts.basics.submit
|
||||
]
|
||||
, a
|
||||
[ class Styles.secondaryButton
|
||||
, class "ml-2"
|
||||
, href "#"
|
||||
, onClick Clear
|
||||
]
|
||||
[ text texts.reset
|
||||
]
|
||||
[ text texts.basics.submit
|
||||
]
|
||||
, a
|
||||
[ class Styles.secondaryButton
|
||||
, class "ml-2"
|
||||
, href "#"
|
||||
, onClick Clear
|
||||
]
|
||||
[ text texts.reset
|
||||
]
|
||||
]
|
||||
, renderErrorMsg texts model
|
||||
, renderSuccessMsg texts (Util.Maybe.nonEmpty mid) model
|
||||
, renderUploads texts model
|
||||
]
|
||||
, renderErrorMsg texts model
|
||||
, renderSuccessMsg texts (Util.Maybe.nonEmpty viewCfg.sourceId) model
|
||||
, renderUploads texts model
|
||||
]
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user