diff --git a/src/app.rs b/src/app.rs
index 27d79fa..1a00648 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -3,6 +3,7 @@ use leptos::prelude::*;
use leptos_meta::{MetaTags, Stylesheet, Title, provide_meta_context};
use leptos_oidc::{Auth, AuthParameters, AuthSignal, Challenge};
use leptos_router::{components::{Route, Router, Routes, ParentRoute}, path};
+use crate::components::ToastList;
pub fn shell(options: LeptosOptions) -> impl IntoView {
view! {
@@ -94,23 +95,25 @@ pub fn AppWithRoutes() -> impl IntoView {
- // TODO Create a 404 page
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ // TODO Create a 404 page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
}
}
diff --git a/src/components/toasts/toast_list.rs b/src/components/toasts/toast_list.rs
index c7f4639..94f9dcc 100644
--- a/src/components/toasts/toast_list.rs
+++ b/src/components/toasts/toast_list.rs
@@ -4,6 +4,7 @@ use crate::components::toasts::toast::Toast;
#[derive(Clone, Debug)]
pub struct Toast {
id: String,
+ header: String,
message: String,
}
@@ -11,10 +12,16 @@ impl Toast {
pub fn new() -> Self {
Toast {
id: "".to_owned(),
+ header: "".to_owned(),
message: "".to_owned(),
}
}
+ pub fn header(mut self, header: impl Into) -> Self {
+ self.header = header.into();
+ self
+ }
+
pub fn msg(mut self, msg: impl Into) -> Self {
self.message = msg.into();
self
@@ -61,11 +68,11 @@ pub fn ToastList(
- "Submit form (but actually)"
+ "Submit"
}
diff --git a/src/pages/provider_contact.rs b/src/pages/provider_contact.rs
index 775d3c3..6bffcf6 100644
--- a/src/pages/provider_contact.rs
+++ b/src/pages/provider_contact.rs
@@ -3,7 +3,7 @@ use leptos::logging::log;
use leptos::prelude::*;
use leptos_oidc::{AuthLoaded, Authenticated};
use crate::common::ValueType;
-use crate::components::{Banner, Loading, OutlinedTextField, Panel, Row, TextFieldType, ValidatedForm};
+use crate::components::{Banner, Loading, OutlinedTextField, Panel, Row, TextFieldType, Toast, ToastContext, ToastList, ValidatedForm};
use crate::pages::UnauthenticatedPage;
use crate::pages::utils::get_user_claims;
@@ -120,86 +120,101 @@ pub fn ProviderContactPage() -> impl IntoView {
submit_action.pending().get()
});
+ let mut toasts_context = expect_context::();
+ Effect::new(move || {
+ submit_action.value().get().is_some()
+ .then(|| {
+ toasts_context.toast(
+ Toast::new()
+ .id(uuid::Uuid::new_v4())
+ .header("Submission Successful")
+ .msg("You can go back or continue editing your responses.")
+ );
+ });
+ });
+
// Display contact form.
view! {
-
+
-
-
- {move || contact_resource.get()
- .map(|_| {
- view! {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
- })
- }
-
-
+
+
+
+
+ {move || {
+ contact_resource
+ .get()
+ .map(|_| {
+ view! {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ }
+ })
+ }}
+
+
+
+