diff --git a/src/app.rs b/src/app.rs index f45dc8b..f883453 100644 --- a/src/app.rs +++ b/src/app.rs @@ -2,8 +2,9 @@ /// Combines the item management components (form and list) to provide a cohesive user interface. use leptos::*; use leptos_meta::*; -use crate::components::{item_form::ItemForm, items_list::ItemsList}; +use crate::components::{item_form::ItemForm, items_list::ItemsList, review_form::ReviewForm, reviews_list::ReviewsList }; use crate::models::item::Item; +use crate::models::review::Review; use crate::nostr::NostrClient; use tokio::sync::mpsc; use uuid::Uuid; @@ -37,6 +38,7 @@ pub fn App() -> impl IntoView { name: name.clone(), description: description.clone(), tags: tags.clone(), + reviews: vec![], }; items.push(item); }); @@ -47,6 +49,11 @@ pub fn App() -> impl IntoView { }); }; + // Handle review submission + let submit_review = move |content: String| { + // Handle the review submission logic + }; + view! { <> @@ -56,6 +63,9 @@ pub fn App() -> impl IntoView { // Component to display the list of items. + // Reviews form and list + + } diff --git a/src/components/mod.rs b/src/components/mod.rs index 6d4b027..7ac9a5a 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -1,2 +1,4 @@ pub mod item_form; pub mod items_list; +pub mod review_form; +pub mod reviews_list; diff --git a/src/components/review_form.rs b/src/components/review_form.rs new file mode 100644 index 0000000..83be251 --- /dev/null +++ b/src/components/review_form.rs @@ -0,0 +1,25 @@ +use leptos::*; +use crate::models::item::Item; +use leptos::ev::Event; + + +#[component] +pub fn ReviewForm(item_id: String, on_submit: impl Fn(String) + 'static) -> impl IntoView { + let (review_content, set_review_content) = create_signal(String::new()); + + let submit_review = move |e| { + on_submit(review_content.get()); + }; + + view! { +
+

{ "Submit Review" }

+