fix(reviews): debug errors linked to the reviews
This commit is contained in:
parent
ccd23654e3
commit
a0978e30f9
|
@ -4,7 +4,6 @@ use leptos::*;
|
|||
use leptos_meta::*;
|
||||
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;
|
||||
|
@ -64,7 +63,7 @@ pub fn App() -> impl IntoView {
|
|||
// Component to display the list of items.
|
||||
<ItemsList items=items_signal />
|
||||
// Reviews form and list
|
||||
<ReviewForm item_id={items_signal.get().first().unwrap().id.clone()} on_submit={submit_review} />
|
||||
<ReviewForm item_id={items_signal.get().first().unwrap().id.clone()} on_submit={Box::new(submit_review)} />
|
||||
<ReviewsList reviews={vec![]} />
|
||||
</div>
|
||||
</>
|
||||
|
|
|
@ -7,11 +7,13 @@ pub fn ReviewsList(reviews: Vec<Review>) -> impl IntoView {
|
|||
<div>
|
||||
<h3>{ "Reviews" }</h3>
|
||||
<ul>
|
||||
{ for review in reviews {
|
||||
view! {
|
||||
<li>{ &review.content }</li>
|
||||
}
|
||||
} }
|
||||
{
|
||||
reviews.into_iter().map(|review| {
|
||||
view! {
|
||||
<li>{ review.content }</li>
|
||||
}
|
||||
}).collect::<Vec<_>>()
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
/// Represents an Item in CompareWare.
|
||||
/// 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,
|
||||
}
|
||||
use crate::models::review::Review;
|
||||
|
||||
#[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<Review>, // Reviews
|
||||
}
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub description: String,
|
||||
pub tags: Vec<(String, String)>,
|
||||
pub reviews: Vec<Review>, // Add reviews field here
|
||||
}
|
Loading…
Reference in New Issue