Skip to content

Commit

Permalink
Add links to guide
Browse files Browse the repository at this point in the history
  • Loading branch information
janslifka committed Jan 22, 2025
1 parent ab9e896 commit fe9b896
Show file tree
Hide file tree
Showing 64 changed files with 825 additions and 493 deletions.
48 changes: 23 additions & 25 deletions engine-wizard/elm/Wizard/Common/Components/Questionnaire.elm
Original file line number Diff line number Diff line change
Expand Up @@ -4283,20 +4283,19 @@ viewRemoveItemModal appState model =
|> List.map viewLink
|> wrapItemLinks

modalContent =
[ text (gettext "Are you sure you want to remove this item?" appState.locale)
, items
]

cfg =
{ modalTitle = gettext "Remove Item" appState.locale
, modalContent =
[ text (gettext "Are you sure you want to remove this item?" appState.locale)
, items
]
, visible = Maybe.isJust model.removeItem
, actionResult = Unset
, actionName = gettext "Remove" appState.locale
, actionMsg = RemoveItemConfirm
, cancelMsg = Just RemoveItemCancel
, dangerous = True
, dataCy = "remove-item"
}
Modal.confirmConfig (gettext "Remove Item" appState.locale)
|> Modal.confirmConfigContent modalContent
|> Modal.confirmConfigVisible (Maybe.isJust model.removeItem)
|> Modal.confirmConfigAction (gettext "Remove" appState.locale) RemoveItemConfirm
|> Modal.confirmConfigCancelMsg RemoveItemCancel
|> Modal.confirmConfigDangerous True
|> Modal.confirmConfigDataCy "remove-item"
in
Modal.confirm appState cfg

Expand All @@ -4317,19 +4316,18 @@ viewFileDeleteModal appState model =
Nothing ->
""

modalContent =
String.formatHtml (gettext "Are you sure you want to delete %s?" appState.locale)
[ strong [ class "text-break" ] [ text fileName ] ]

cfg =
{ modalTitle = gettext "Delete File" appState.locale
, modalContent =
String.formatHtml (gettext "Are you sure you want to delete %s?" appState.locale)
[ strong [ class "text-break" ] [ text fileName ] ]
, visible = Maybe.isJust model.deleteFile
, actionResult = ActionResult.map (always "") model.deletingFile
, actionName = gettext "Delete" appState.locale
, actionMsg = DeleteFileConfirm
, cancelMsg = Just DeleteFileCancel
, dangerous = True
, dataCy = "delete-file"
}
Modal.confirmConfig (gettext "Delete File" appState.locale)
|> Modal.confirmConfigContent modalContent
|> Modal.confirmConfigVisible (Maybe.isJust model.deleteFile)
|> Modal.confirmConfigAction (gettext "Delete" appState.locale) DeleteFileConfirm
|> Modal.confirmConfigCancelMsg DeleteFileCancel
|> Modal.confirmConfigDangerous True
|> Modal.confirmConfigDataCy "delete-file"
in
Modal.confirm appState cfg

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ view appState model =

Nothing ->
[]

cfg =
Modal.confirmConfig (gettext "Delete version" appState.locale)
|> Modal.confirmConfigContent content
|> Modal.confirmConfigVisible (Maybe.isJust model.mbQuestionnaireVersion)
|> Modal.confirmConfigActionResult (ActionResult.map (always "") model.deleteResult)
|> Modal.confirmConfigAction (gettext "Delete" appState.locale) Delete
|> Modal.confirmConfigCancelMsg Close
|> Modal.confirmConfigDangerous True
|> Modal.confirmConfigDataCy "project-delete-version"
in
Modal.confirm appState
{ modalTitle = gettext "Delete version" appState.locale
, modalContent = content
, visible = Maybe.isJust model.mbQuestionnaireVersion
, actionResult = ActionResult.map (always "") model.deleteResult
, actionName = gettext "Delete" appState.locale
, actionMsg = Delete
, cancelMsg = Just Close
, dangerous = True
, dataCy = "project-delete-version"
}
Modal.confirm appState cfg
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,16 @@ view appState model =
_ ->
( gettext "Send" appState.locale, FeedbackFormMsg Form.Submit, Just <| CloseFeedback )

modalConfig =
{ modalTitle = gettext "Feedback" appState.locale
, modalContent = modalContent
, visible = visible
, actionResult = ActionResult.map (\_ -> gettext "Your feedback has been sent." appState.locale) model.feedbackResult
, actionName = actionName
, actionMsg = actionMsg
, cancelMsg = cancelMsg
, dangerous = False
, dataCy = "questionnaire-feedback"
}
cfg =
Modal.confirmConfig (gettext "Feedback" appState.locale)
|> Modal.confirmConfigContent modalContent
|> Modal.confirmConfigVisible visible
|> Modal.confirmConfigActionResult (ActionResult.map (\_ -> gettext "Your feedback has been sent." appState.locale) model.feedbackResult)
|> Modal.confirmConfigAction actionName actionMsg
|> Modal.confirmConfigMbCancelMsg cancelMsg
|> Modal.confirmConfigDataCy "questionnaire-feedback"
in
Modal.confirm appState modalConfig
Modal.confirm appState cfg


feedbackModalContent : AppState -> Model -> List (Html Msg)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,14 @@ view appState model =

Nothing ->
gettext "New version" appState.locale

cfg =
Modal.confirmConfig modalTitle
|> Modal.confirmConfigContent form
|> Modal.confirmConfigVisible (Maybe.isJust model.mbEventUuid)
|> Modal.confirmConfigActionResult (ActionResult.map (always "") model.versionResult)
|> Modal.confirmConfigAction (gettext "Save" appState.locale) (FormMsg Form.Submit)
|> Modal.confirmConfigCancelMsg Close
|> Modal.confirmConfigDataCy "project-version"
in
Modal.confirm appState
{ modalTitle = modalTitle
, modalContent = form
, visible = Maybe.isJust model.mbEventUuid
, actionResult = ActionResult.map (always "") model.versionResult
, actionName = gettext "Save" appState.locale
, actionMsg = FormMsg Form.Submit
, cancelMsg = Just Close
, dangerous = False
, dataCy = "project-version"
}
Modal.confirm appState cfg
54 changes: 28 additions & 26 deletions engine-wizard/elm/Wizard/Common/Components/SessionModal.elm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module Wizard.Common.Components.SessionModal exposing
, expiresSoonModal
)

import ActionResult
import Gettext exposing (gettext)
import Html exposing (Html, text)
import Shared.Auth.Session as Session
Expand All @@ -24,24 +23,29 @@ expiresSoonModal appState =
|> Routes.publicLogin
|> Wizard.Auth.Msgs.LogoutTo
|> Wizard.Msgs.AuthMsg
in
Modal.confirm appState
{ modalTitle = gettext "Session Expires Soon" appState.locale
, modalContent =

modalContent =
[ text
(String.format
(gettext "Your session expires in less than %s minutes. Log in again to refresh it." appState.locale)
[ String.fromInt Session.expirationWarningMins ]
)
]
, visible = AppState.sessionExpiresSoon appState && not (AppState.sessionExpired appState) && not appState.sessionExpiresSoonModalHidden
, actionResult = ActionResult.Unset
, actionName = gettext "Log in again" appState.locale
, actionMsg = logoutMsg
, cancelMsg = Just Wizard.Msgs.HideSessionExpiresSoonModal
, dangerous = False
, dataCy = "session-modal_expires-soon"
}

visible =
AppState.sessionExpiresSoon appState
&& not (AppState.sessionExpired appState)
&& not appState.sessionExpiresSoonModalHidden

cfg =
Modal.confirmConfig (gettext "Session Expires Soon" appState.locale)
|> Modal.confirmConfigContent modalContent
|> Modal.confirmConfigVisible visible
|> Modal.confirmConfigAction (gettext "Log in again" appState.locale) logoutMsg
|> Modal.confirmConfigCancelMsg Wizard.Msgs.HideSessionExpiresSoonModal
|> Modal.confirmConfigDataCy "session-modal_expires-soon"
in
Modal.confirm appState cfg


expiredModal : AppState -> Html Wizard.Msgs.Msg
Expand All @@ -52,17 +56,15 @@ expiredModal appState =
|> Routes.publicLogin
|> Wizard.Auth.Msgs.LogoutTo
|> Wizard.Msgs.AuthMsg

modalContent =
[ text (gettext "Your session has expired. You need to log in again." appState.locale) ]

cfg =
Modal.confirmConfig (gettext "Session Expired" appState.locale)
|> Modal.confirmConfigContent modalContent
|> Modal.confirmConfigVisible (AppState.sessionExpired appState)
|> Modal.confirmConfigAction (gettext "Log in again" appState.locale) logoutMsg
|> Modal.confirmConfigDataCy "session-modal_expired"
in
Modal.confirm appState
{ modalTitle = gettext "Session Expired" appState.locale
, modalContent =
[ text (gettext "Your session has expired. You need to log in again." appState.locale)
]
, visible = AppState.sessionExpired appState
, actionResult = ActionResult.Unset
, actionName = gettext "Log in again" appState.locale
, actionMsg = logoutMsg
, cancelMsg = Nothing
, dangerous = False
, dataCy = "session-modal_expired"
}
Modal.confirm appState cfg
Loading

0 comments on commit fe9b896

Please sign in to comment.