Show a message when a new document arrived

This commit is contained in:
eikek 2021-11-07 17:14:02 +01:00
parent 8ae314bead
commit 62d02d75b4
5 changed files with 37 additions and 4 deletions

View File

@ -64,6 +64,7 @@ type alias Model =
, anonymousTheme : UiTheme
, anonymousUiLang : UiLanguage
, langMenuOpen : Bool
, showNewItemsArrived : Bool
}
@ -126,6 +127,7 @@ init key url flags_ settings =
, anonymousTheme = Data.UiTheme.Light
, anonymousUiLang = Messages.UiLanguage.English
, langMenuOpen = False
, showNewItemsArrived = False
}
, Cmd.batch
[ Cmd.map UserSettingsMsg uc
@ -191,6 +193,7 @@ type Msg
| ClientSettingsSaveResp UiSettings (Result Http.Error BasicResult)
| ReceiveBrowserSettings StoredUiSettings
| ReceiveWsMessage String
| ToggleShowNewItemsArrived
defaultPage : Flags -> Page

View File

@ -316,16 +316,26 @@ updateWithSub msg model =
in
case se of
Just ItemProcessed ->
let
newModel =
{ model | showNewItemsArrived = True }
in
case model.page of
HomePage ->
updateHome texts Page.Home.Data.RefreshView model
updateHome texts Page.Home.Data.RefreshView newModel
_ ->
( model, Cmd.none, Sub.none )
( newModel, Cmd.none, Sub.none )
Nothing ->
( model, Cmd.none, Sub.none )
ToggleShowNewItemsArrived ->
( { model | showNewItemsArrived = not model.showNewItemsArrived }
, Cmd.none
, Sub.none
)
applyClientSettings : Messages -> Model -> UiSettings -> ( Model, Cmd Msg, Sub Msg )
applyClientSettings texts model settings =

View File

@ -71,7 +71,19 @@ topNavUser auth model =
, activeStyle = "hover:bg-blue-200 dark:hover:bg-bluegray-800 w-12"
}
, headerNavItem True model
, div [ class "flex flex-grow justify-end" ]
, div [ class "flex flex-grow justify-center" ]
[ a
[ class S.infoMessageBase
, class "my-2 px-1 py-1 rounded-lg inline-block hover:opacity-50"
, classList [ ( "hidden", not model.showNewItemsArrived ) ]
, href "#"
, onClick ToggleShowNewItemsArrived
]
[ i [ class "fa fa-exclamation-circle mr-1" ] []
, text texts.app.newItemsArrived
]
]
, div [ class "flex justify-end" ]
[ userMenu texts.app auth model
, dataMenu texts.app auth model
]

View File

@ -23,6 +23,7 @@ type alias Texts =
, processingQueue : String
, newInvites : String
, help : String
, newItemsArrived : String
}
@ -38,6 +39,7 @@ gb =
, processingQueue = "Processing Queue"
, newInvites = "New Invites"
, help = "Help"
, newItemsArrived = "New items arrived!"
}
@ -53,4 +55,5 @@ de =
, processingQueue = "Verarbeitung"
, newInvites = "Neue Einladung"
, help = "Hilfe (English)"
, newItemsArrived = "Neue Dokumente eingetroffen!"
}

View File

@ -63,9 +63,14 @@ warnMessageColors =
" border-yellow-800 bg-yellow-50 text-yellow-800 dark:border-amber-200 dark:bg-amber-800 dark:text-amber-200 "
infoMessageBase : String
infoMessageBase =
" border border-blue-800 bg-blue-100 text-blue-800 dark:border-lightblue-200 dark:bg-lightblue-800 dark:text-lightblue-200 dark:bg-opacity-25 "
infoMessage : String
infoMessage =
" border border-blue-800 bg-blue-100 text-blue-800 dark:border-lightblue-200 dark:bg-lightblue-800 dark:text-lightblue-200 dark:bg-opacity-25 px-2 py-2 rounded "
infoMessageBase ++ " px-2 py-2 rounded "
message : String