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" }
+
+
+
+ }
+}
diff --git a/src/components/reviews_list.rs b/src/components/reviews_list.rs
new file mode 100644
index 0000000..6916ae6
--- /dev/null
+++ b/src/components/reviews_list.rs
@@ -0,0 +1,18 @@
+use leptos::*;
+use crate::models::review::Review;
+
+#[component]
+pub fn ReviewsList(reviews: Vec) -> impl IntoView {
+ view! {
+
+
{ "Reviews" }
+
+ { for review in reviews {
+ view! {
+ - { &review.content }
+ }
+ } }
+
+
+ }
+}
diff --git a/src/models/item.rs b/src/models/item.rs
index 545e8f8..ddace10 100644
--- a/src/models/item.rs
+++ b/src/models/item.rs
@@ -2,10 +2,18 @@
/// Each item has metadata and key-value tags for categorization.
use serde::{Deserialize, Serialize};
+pub struct Review {
+ pub user_id: String,
+ pub title: String,
+ pub content: String,
+ pub timestamp: i64,
+}
+
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Item {
pub id: String, // Unique ID for the item
pub name: String, // Item name
pub description: String, // Short description of the item
pub tags: Vec<(String, String)>, // Key-value tags (e.g., "type" -> "software")
+ pub reviews: Vec, // Reviews
}
diff --git a/src/models/mod.rs b/src/models/mod.rs
index a35e98d..59d218d 100644
--- a/src/models/mod.rs
+++ b/src/models/mod.rs
@@ -1 +1,2 @@
pub mod item;
+pub mod review;
\ No newline at end of file
diff --git a/src/models/review.rs b/src/models/review.rs
new file mode 100644
index 0000000..4dca725
--- /dev/null
+++ b/src/models/review.rs
@@ -0,0 +1,9 @@
+// src/models/review.rs
+use serde::{Deserialize, Serialize};
+
+#[derive(Serialize, Deserialize, Debug, Clone)]
+pub struct Review {
+ pub item_id: String, // ID of the item the review is associated with
+ pub content: String, // Content of the review
+ pub user_id: String, // ID of the user who submitted the review
+}