From a5bbf867f8037cb71cc8acc3af7162b99f6f0d32 Mon Sep 17 00:00:00 2001 From: Kristaps Berzinch Date: Sun, 20 Oct 2024 16:49:32 -0400 Subject: [PATCH] Add banner about Ramp pilot --- elm/Main.elm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/elm/Main.elm b/elm/Main.elm index 3dd1b33..d5ea5b3 100644 --- a/elm/Main.elm +++ b/elm/Main.elm @@ -209,6 +209,7 @@ type alias Model = , time : Time.Posix , zone : Time.Zone , nextAction : NextAction + , showRampBanner : Bool } @@ -240,6 +241,7 @@ type Msg | GoogleAddressValidationResultReceived (Result Http.Error GoogleAddressValidation) | SetTime Time.Posix | SetZone Time.Zone + | DismissRampBanner @@ -635,6 +637,14 @@ update msg model = , Cmd.none ) + DismissRampBanner -> + ( { model + | showRampBanner = False + , nextAction = NoOpNextAction + } + , saveToLocalStorage (stringifyModel { model | showRampBanner = False }) + ) + subscriptions : Model -> Sub Msg subscriptions _ = @@ -659,6 +669,14 @@ view model = ] , text " to issue corporate credit cards and manage reimbursements. We need some information from you to create your BILL Spend & Expense account." ] + , div [ class "alert", class "alert-primary", class "alert-dismissible", class "mb-4", classList [ ( "d-none", not model.showRampBanner ) ] ] + [ text "RoboJackets is currently piloting " + , a [ href "https://ramp.com", class "alert-link" ] [ text "Ramp" ] + , text " to replace BILL Spend & Expense. Please check with your project manager if you should " + , a [ href "https://ramp.robojackets.org", class "alert-link" ] [ text "request a Ramp account" ] + , text " instead." + , button [ type_ "button", class "btn-close", onClick DismissRampBanner ] [] + ] , Html.form [ class "row" , class "g-3" @@ -1475,6 +1493,7 @@ stringifyModel model = Json.Encode.null ) , ( "zip", Json.Encode.string (String.trim model.zip) ) + , ( "showRampBanner", Json.Encode.bool model.showRampBanner ) ] ) @@ -1702,6 +1721,7 @@ buildInitialModel value = (Time.millisToPosix 0) Time.utc NoOpNextAction + (Result.withDefault True (decodeString (field "showRampBanner" bool) (Result.withDefault "{}" (decodeValue (field "localData" string) value)))) stringStringTupleToMaybeIntStringTuple : ( String, String ) -> Maybe ( Int, String )