From 09a83922cd93644c296065a7b198c7efdba368d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=BAt?= Date: Thu, 8 Aug 2024 23:44:46 +0700 Subject: [PATCH] fix: fix toast done --- .../@component/crud/c.review.comments.tsx | 14 ++++++++++--- src/components/icon/icon.error.tsx | 20 +++++++++++++++++++ src/components/icon/icon.loading.tsx | 6 +++--- src/components/icon/icon.success.tsx | 6 +++--- src/components/ui/toaster.tsx | 4 ++-- 5 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 src/components/icon/icon.error.tsx diff --git a/src/app/title/[slug]/reviews/@component/crud/c.review.comments.tsx b/src/app/title/[slug]/reviews/@component/crud/c.review.comments.tsx index b10273a..27d548e 100644 --- a/src/app/title/[slug]/reviews/@component/crud/c.review.comments.tsx +++ b/src/app/title/[slug]/reviews/@component/crud/c.review.comments.tsx @@ -1,5 +1,6 @@ "use client"; import Rating from "@/app/title/[slug]/reviews/@component/rating"; +import IconError from "@/components/icon/icon.error"; import IconLoading from "@/components/icon/icon.loading"; import IconSend from "@/components/icon/icon.send"; import IconSuccess from "@/components/icon/icon.success"; @@ -16,10 +17,17 @@ const CReviewComments = (props: any) => { const handleSubmit = async () => { toast({ - title: "Please wait...", - description: "Posting review", - icon: , + title: "Error!", + description: "Please rating", + icon: , }); + if(rating != null) { + toast({ + title: "Please wait...", + description: "Posting review", + icon: , + }); + } if (rating != null && !hasReviewId) { const data = await sendRequest({ url: `${process.env.NEXT_PUBLIC_WEB_COMIC_API}/api/reviews`, diff --git a/src/components/icon/icon.error.tsx b/src/components/icon/icon.error.tsx new file mode 100644 index 0000000..7b2b51f --- /dev/null +++ b/src/components/icon/icon.error.tsx @@ -0,0 +1,20 @@ +import { ComponentProps } from "react"; + +const IconError = (props: ComponentProps<"svg">) => { + return ( + + + + ); +}; + +export default IconError; diff --git a/src/components/icon/icon.loading.tsx b/src/components/icon/icon.loading.tsx index 7d24171..bcc6d5a 100644 --- a/src/components/icon/icon.loading.tsx +++ b/src/components/icon/icon.loading.tsx @@ -4,15 +4,15 @@ const IconLoading = (props: ComponentProps<"svg">) => { return ( diff --git a/src/components/icon/icon.success.tsx b/src/components/icon/icon.success.tsx index c434eca..9bf4923 100644 --- a/src/components/icon/icon.success.tsx +++ b/src/components/icon/icon.success.tsx @@ -4,15 +4,15 @@ const IconSuccess = (props: ComponentProps<"svg">) => { return ( diff --git a/src/components/ui/toaster.tsx b/src/components/ui/toaster.tsx index 36c8d0c..93a7abf 100644 --- a/src/components/ui/toaster.tsx +++ b/src/components/ui/toaster.tsx @@ -26,12 +26,12 @@ export function Toaster() { return (
-
+
{icon &&
{icon}
} {title && {title}}
{description && ( - + {description} )}