Browse Source

fix cargo check

Evan Almloff 1 year ago
parent
commit
0b40878fce
4 changed files with 28 additions and 63 deletions
  1. 24 58
      examples/crm.rs
  2. 0 1
      packages/core/src/scopes.rs
  3. 0 1
      packages/desktop/src/webview.rs
  4. 4 3
      packages/web/src/dom.rs

+ 24 - 58
examples/crm.rs

@@ -35,14 +35,16 @@ fn App(cx: Scope) -> Element {
             rel: "stylesheet",
             rel: "stylesheet",
             href: "https://unpkg.com/purecss@2.0.6/build/pure-min.css",
             href: "https://unpkg.com/purecss@2.0.6/build/pure-min.css",
             integrity: "sha384-Uu6IeWbM+gzNVXJcM9XV3SohHtmWE+3VGi496jvgX1jyvDTXfdK+rfZc8C1Aehk5",
             integrity: "sha384-Uu6IeWbM+gzNVXJcM9XV3SohHtmWE+3VGi496jvgX1jyvDTXfdK+rfZc8C1Aehk5",
-            crossorigin: "anonymous",
+            crossorigin: "anonymous"
         }
         }
 
 
-        style { "
+        style {
+            "
             .red {{
             .red {{
                 background-color: rgb(202, 60, 60) !important;
                 background-color: rgb(202, 60, 60) !important;
             }}
             }}
-        " }
+        "
+        }
 
 
         h1 { "Dioxus CRM Example" }
         h1 { "Dioxus CRM Example" }
 
 
@@ -57,22 +59,14 @@ fn ClientList(cx: Scope) -> Element {
     cx.render(rsx! {
     cx.render(rsx! {
         h2 { "List of Clients" }
         h2 { "List of Clients" }
 
 
-        Link {
-            to: Route::ClientAdd {},
-            class: "pure-button pure-button-primary",
-            "Add Client"
-        }
-        Link {
-            to: Route::Settings {},
-            class: "pure-button",
-            "Settings"
-        }
+        Link { to: Route::ClientAdd {}, class: "pure-button pure-button-primary", "Add Client" }
+        Link { to: Route::Settings {}, class: "pure-button", "Settings" }
 
 
         clients.read().iter().map(|client| rsx! {
         clients.read().iter().map(|client| rsx! {
             div {
             div {
                 class: "client",
                 class: "client",
                 style: "margin-bottom: 50px",
                 style: "margin-bottom: 50px",
-
+        
                 p { "Name: {client.first_name} {client.last_name}" }
                 p { "Name: {client.first_name} {client.last_name}" }
                 p { "Description: {client.description}" }
                 p { "Description: {client.description}" }
             }
             }
@@ -94,23 +88,18 @@ fn ClientAdd(cx: Scope) -> Element {
             class: "pure-form pure-form-aligned",
             class: "pure-form pure-form-aligned",
             onsubmit: move |_| {
             onsubmit: move |_| {
                 let mut clients = clients.write();
                 let mut clients = clients.write();
-
-                clients.push(Client {
-                    first_name: first_name.to_string(),
-                    last_name: last_name.to_string(),
-                    description: description.to_string(),
-                });
-
+                clients
+                    .push(Client {
+                        first_name: first_name.to_string(),
+                        last_name: last_name.to_string(),
+                        description: description.to_string(),
+                    });
                 dioxus_router::router().push(Route::ClientList {});
                 dioxus_router::router().push(Route::ClientList {});
             },
             },
 
 
             fieldset {
             fieldset {
-                div {
-                    class: "pure-control-group",
-                    label {
-                        "for": "first_name",
-                        "First Name"
-                    }
+                div { class: "pure-control-group",
+                    label { "for": "first_name", "First Name" }
                     input {
                     input {
                         id: "first_name",
                         id: "first_name",
                         "type": "text",
                         "type": "text",
@@ -121,12 +110,8 @@ fn ClientAdd(cx: Scope) -> Element {
                     }
                     }
                 }
                 }
 
 
-                div {
-                    class: "pure-control-group",
-                    label {
-                        "for": "last_name",
-                        "Last Name"
-                    }
+                div { class: "pure-control-group",
+                    label { "for": "last_name", "Last Name" }
                     input {
                     input {
                         id: "last_name",
                         id: "last_name",
                         "type": "text",
                         "type": "text",
@@ -137,12 +122,8 @@ fn ClientAdd(cx: Scope) -> Element {
                     }
                     }
                 }
                 }
 
 
-                div {
-                    class: "pure-control-group",
-                    label {
-                        "for": "description",
-                        "Description"
-                    }
+                div { class: "pure-control-group",
+                    label { "for": "description", "Description" }
                     textarea {
                     textarea {
                         id: "description",
                         id: "description",
                         placeholder: "Description…",
                         placeholder: "Description…",
@@ -151,22 +132,11 @@ fn ClientAdd(cx: Scope) -> Element {
                     }
                     }
                 }
                 }
 
 
-                div {
-                    class: "pure-controls",
-                    button {
-                        "type": "submit",
-                        class: "pure-button pure-button-primary",
-                        "Save"
-                    }
-                    Link {
-                        to: Route::ClientList {},
-                        class: "pure-button pure-button-primary red",
-                        "Cancel"
-                    }
+                div { class: "pure-controls",
+                    button { "type": "submit", class: "pure-button pure-button-primary", "Save" }
+                    Link { to: Route::ClientList {}, class: "pure-button pure-button-primary red", "Cancel" }
                 }
                 }
             }
             }
-
-
         }
         }
     })
     })
 }
 }
@@ -187,10 +157,6 @@ fn Settings(cx: Scope) -> Element {
             "Remove all Clients"
             "Remove all Clients"
         }
         }
 
 
-        Link {
-            to: Route::ClientList {},
-            class: "pure-button",
-            "Go back"
-        }
+        Link { to: Route::ClientList {}, class: "pure-button", "Go back" }
     })
     })
 }
 }

+ 0 - 1
packages/core/src/scopes.rs

@@ -2,7 +2,6 @@ use crate::{
     any_props::AnyProps,
     any_props::AnyProps,
     any_props::VProps,
     any_props::VProps,
     bump_frame::BumpFrame,
     bump_frame::BumpFrame,
-    innerlude::ErrorBoundary,
     innerlude::{DynamicNode, EventHandler, VComponent, VNodeId, VText},
     innerlude::{DynamicNode, EventHandler, VComponent, VNodeId, VText},
     lazynodes::LazyNodes,
     lazynodes::LazyNodes,
     nodes::{IntoAttributeValue, IntoDynNode, RenderReturn},
     nodes::{IntoAttributeValue, IntoDynNode, RenderReturn},

+ 0 - 1
packages/desktop/src/webview.rs

@@ -5,7 +5,6 @@ use tao::event_loop::{EventLoopProxy, EventLoopWindowTarget};
 pub use wry;
 pub use wry;
 pub use wry::application as tao;
 pub use wry::application as tao;
 use wry::application::window::Window;
 use wry::application::window::Window;
-use wry::http::Response;
 use wry::webview::{WebContext, WebView, WebViewBuilder};
 use wry::webview::{WebContext, WebView, WebViewBuilder};
 
 
 pub(crate) fn build(
 pub(crate) fn build(

+ 4 - 3
packages/web/src/dom.rs

@@ -6,10 +6,11 @@
 //! - tests to ensure dyn_into works for various event types.
 //! - tests to ensure dyn_into works for various event types.
 //! - Partial delegation?
 //! - Partial delegation?
 
 
+use dioxus_interpreter_js::get_node;
 use dioxus_core::{
 use dioxus_core::{
     BorrowedAttributeValue, ElementId, Mutation, Template, TemplateAttribute, TemplateNode,
     BorrowedAttributeValue, ElementId, Mutation, Template, TemplateAttribute, TemplateNode,
 };
 };
-use dioxus_html::{event_bubbles, PlatformEventData};
+use dioxus_html::{event_bubbles, PlatformEventData, MountedData};
 use dioxus_interpreter_js::{minimal_bindings, save_template, Channel};
 use dioxus_interpreter_js::{minimal_bindings, save_template, Channel};
 use futures_channel::mpsc;
 use futures_channel::mpsc;
 use rustc_hash::FxHashMap;
 use rustc_hash::FxHashMap;
@@ -267,12 +268,12 @@ impl WebsysDom {
         let node = get_node(id.0 as u32);
         let node = get_node(id.0 as u32);
         if let Some(element) = node.dyn_ref::<Element>() {
         if let Some(element) = node.dyn_ref::<Element>() {
             let data: MountedData = element.into();
             let data: MountedData = element.into();
-            let data = Rc::new(data);
+            let data = Box::new(data);
             let _ = self.event_channel.unbounded_send(UiEvent {
             let _ = self.event_channel.unbounded_send(UiEvent {
                 name: "mounted".to_string(),
                 name: "mounted".to_string(),
                 bubbles: false,
                 bubbles: false,
                 element: id,
                 element: id,
-                data,
+                data: PlatformEventData::new(data),
             });
             });
         }
         }
     }
     }