diff --git a/components/product/ProductInfo.tsx b/components/product/ProductInfo.tsx
index b163344..bf730be 100644
--- a/components/product/ProductInfo.tsx
+++ b/components/product/ProductInfo.tsx
@@ -19,8 +19,11 @@ import Icon from "deco-sites/tools-dna/components/ui/Icon.tsx";
import Image from "https://denopkg.com/deco-cx/apps@0.32.26/website/components/Image.tsx";
import Shipping from "$store/islands/Shipping.tsx";
import { calculate } from "deco-sites/tools-dna/components/product/ProductCardCustom.tsx";
-import ProductReview from "deco-sites/tools-dna/islands/ProductReview.tsx";
+import ProductReview from "$store/islands/ProductReview.tsx";
import Breadcrumb from "deco-sites/tools-dna/components/ui/Breadcrumb.tsx";
+import { useSignal } from "@preact/signals";
+import Modal from "deco-sites/tools-dna/components/ui/Modal.tsx";
+import Button from "$store/components/ui/Button.tsx";
interface Props {
page: ProductDetailsPage | null;
@@ -41,6 +44,7 @@ function range(start: number, end: number) {
function ProductInfo({ page, layout }: Props) {
const platform = usePlatform();
const id = useId();
+ const openReview = useSignal(false);
if (page === null) {
throw new Error("Missing Product Details Page Info");
@@ -519,14 +523,9 @@ function ProductInfo({ page, layout }: Props) {
-
-
- {/*
*/}
+
+
diff --git a/components/product/ProductReview.tsx b/components/product/ProductReview.tsx
index 077206d..23d0f03 100644
--- a/components/product/ProductReview.tsx
+++ b/components/product/ProductReview.tsx
@@ -1,133 +1,99 @@
-import { Signal, useSignal } from "@preact/signals";
-import { useCallback, useState } from "preact/hooks";
+import { useSignal } from "@preact/signals";
import { invoke } from "$store/runtime.ts";
+import type { JSX } from "preact";
+import Button from "deco-sites/tools-dna/components/ui/Button.tsx";
-function ProductReview(productId: number) {
- const reviewRating = 5;
- const reviewName = "";
- const reviewEmail = "";
- const reviewContent = "";
+export interface Form {
+ placeholder?: string;
+ buttonText?: string;
+ /** @format html */
+ helpText?: string;
+}
+
+export interface Props {
+ IDProduct: string;
+ layout?: {
+ tiled?: boolean;
+ };
+}
+
+function ProductReview({ IDProduct, layout = {} }: Props) {
+ const { tiled = false } = layout;
+ const loading = useSignal(false);
+
+ const handleSubmit: JSX.GenericEventHandler = async (e) => {
+ e.preventDefault();
- // const handleReview = useCallback(async () => {
- // try {
- // const createReview = invoke.wake.actions.review.create({
- // email: reviewEmail,
- // name: reviewName,
- // productVariantId: productId,
- // rating: reviewRating,
- // review: reviewContent,
- // });
- // console.log(createReview);
- // } catch (e) {
- // console.log(e);
- // return;
- // } finally {
- // console.log("deu erro total");
- // }
- // }, []);
+ try {
+ loading.value = true;
+
+ const name = (e.currentTarget.elements.namedItem("name") as RadioNodeList)?.value;
+ const email = (e.currentTarget.elements.namedItem("email") as RadioNodeList)?.value;
+ const review = (e.currentTarget.elements.namedItem("review") as RadioNodeList)?.value;
+ const rating = (e.currentTarget.elements.namedItem("ddlNota") as RadioNodeList)?.value;
+
+ await invoke.wake.actions.review.create({
+ email,
+ name,
+ productVariantId: Number(IDProduct),
+ rating: Number(rating),
+ review,
+ })
+ } finally {
+ loading.value = false;
+ }
+ };
return (
- <>
-
- Avalie esse produto
-
-