summary refs log tree commit diff stats
path: root/src/components/catch_errors.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-03-19 07:45:14 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-03-19 07:45:14 +0100
commitf6a3fb9c4d8dd86f78c9f75a23c1ac35bf35d4eb (patch)
tree5f28fbca03d83921b568f7cb1708374456d9ec42 /src/components/catch_errors.rs
parentfeat(treewide): Add further buttons (diff)
downloadweb-client-f6a3fb9c4d8dd86f78c9f75a23c1ac35bf35d4eb.zip
feat(treewide): Commit MVP
Diffstat (limited to 'src/components/catch_errors.rs')
-rw-r--r--src/components/catch_errors.rs40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/components/catch_errors.rs b/src/components/catch_errors.rs
new file mode 100644
index 0000000..d5a452d
--- /dev/null
+++ b/src/components/catch_errors.rs
@@ -0,0 +1,40 @@
+use leptos::{
+    IntoView, component,
+    error::ErrorBoundary,
+    prelude::{Children, ClassAttribute, CollectView, ElementChild, Get},
+    view,
+};
+
+use crate::components::site_header::SiteHeader;
+
+#[component]
+pub(crate) fn CatchErrors(children: Children) -> impl IntoView {
+    view! {
+        <ErrorBoundary fallback=|errors| {
+            view! {
+                <SiteHeader
+                    logo=icondata_io::IoRoseSharp
+                    back_location="/"
+                    name="Errors occurred"
+                />
+
+                <h1>"Uh oh! Something went wrong!"</h1>
+
+                <p>"Errors: "</p>
+                <ul class="flex flex-col gap-1">
+                    {move || {
+                        errors
+                            .get()
+                            .into_iter()
+                            .map(|(_, e)| {
+                                view! {
+                                    <li class="bg-gray-200 rounded-lg m-2 p-1">{e.to_string()}</li>
+                                }
+                            })
+                            .collect_view()
+                    }}
+                </ul>
+            }
+        }>{children()}</ErrorBoundary>
+    }
+}