diff --git a/src/components/posts/AverageRatingStars.tsx b/src/components/posts/AverageRatingStars.tsx index 70a1c0a..9c07aca 100644 --- a/src/components/posts/AverageRatingStars.tsx +++ b/src/components/posts/AverageRatingStars.tsx @@ -75,7 +75,7 @@ export const AverageRatingStars: Component = (props) => { >
= (props) => { } > = (props) => { = 1 && averageRating() < 2) || - (averageRating() >= 2 && averageRating() < 3) || - (averageRating() >= 3 && averageRating() < 4) || - (averageRating() >= 4 && averageRating() < 5) || - averageRating() === 5 + averageRating() >= 2 + // (averageRating() >= 1 && averageRating() < 2) || + // (averageRating() >= 2 && averageRating() < 3) || + // (averageRating() >= 3 && averageRating() < 4) || + // (averageRating() >= 4 && averageRating() < 5) || + // averageRating() === 5 } fallback={
@@ -147,7 +148,7 @@ export const AverageRatingStars: Component = (props) => { } > = (props) => { const [session, setSession] = createSignal(null); const [editRender, setEditRender] = createSignal(false); const [review, setReview] = createSignal(); + const [resourceReviews, setResourceReviews] = createSignal>( + [] + ); + const [loading, setLoading] = createSignal(true); if (UserError) { console.log("User Error: " + UserError.message); @@ -92,6 +98,10 @@ export const ViewFullPost: Component = (props) => { } // setTestImages(test2); + onMount(async () => { + await getResourceReviews(props.postId); + }); + createEffect(() => { if (props.postId === undefined) { location.href = `/${lang}/404`; @@ -137,6 +147,27 @@ export const ViewFullPost: Component = (props) => { } }; + const getResourceReviews = async (postID: any) => { + setLoading(true); + + const { data: reviews, error } = await supabase + .from("reviews") + .select("*") + .eq("resource_id", postID); + + if (error) { + console.log("Reviews Error: " + error.code + " " + error.message); + return; + } + + console.log("reviews data: ", reviews); + + setResourceReviews(reviews); + console.log("resourceReviews signal: ", resourceReviews()); + + setLoading(false); + }; + const fetchOwnedPost = async function (id: number) { const { data, error } = await supabase.from("orders").select("*"); @@ -847,18 +878,6 @@ export const ViewFullPost: Component = (props) => { - - - - {/* */} {/* NOTE: Quantity and AddToCart styles updated/correct in mobile merge */}
diff --git a/src/components/posts/ReviewPurchasedResource.tsx b/src/components/posts/ReviewPurchasedResource.tsx index d3016f0..d22587f 100644 --- a/src/components/posts/ReviewPurchasedResource.tsx +++ b/src/components/posts/ReviewPurchasedResource.tsx @@ -208,7 +208,7 @@ export const ReviewPurchasedResource: Component = (props) => { } > = (props) => { = (props) => { } > = (props) => {
{reviewsArray()?.map((review) => (
-
+
{/*

{ review.overall_rating }

*/}
= (props) => { } > = (props) => { } > = (props) => { } > = (props) => { } >