From c5aac2af7eaf7dce8b01df00040da669100efe44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yusuf=20G=C3=BCne=C5=9F?= Date: Wed, 25 Oct 2023 19:51:25 +0300 Subject: [PATCH 1/2] feat: new dashboard --- .../Feedback/Feedback.constants.tsx | 41 + .../Dashboard/HomeHeader/Feedback/index.tsx | 126 + .../Dashboard/HomeHeader/Navigation.tsx | 63 + .../Layout/Dashboard/HomeHeader/index.tsx | 154 + .../HomeHeader/navigation.constant.tsx | 39 + .../Layout/Dashboard/Navbar/index.tsx | 6 +- .../Layout/Dashboard/Sidebar/Menu.tsx | 27 +- .../Layout/Dashboard/Sidebar/Navigation.tsx | 43 +- .../Sidebar/navigations.constants.tsx | 6 +- .../src/components/Layout/Dashboard/index.tsx | 24 +- package-lock.json | 14339 ++++++++++++++++ yarn.lock | 3850 ++--- 12 files changed, 16576 insertions(+), 2142 deletions(-) create mode 100644 apps/next/src/components/Layout/Dashboard/HomeHeader/Feedback/Feedback.constants.tsx create mode 100644 apps/next/src/components/Layout/Dashboard/HomeHeader/Feedback/index.tsx create mode 100644 apps/next/src/components/Layout/Dashboard/HomeHeader/Navigation.tsx create mode 100644 apps/next/src/components/Layout/Dashboard/HomeHeader/index.tsx create mode 100644 apps/next/src/components/Layout/Dashboard/HomeHeader/navigation.constant.tsx create mode 100644 package-lock.json diff --git a/apps/next/src/components/Layout/Dashboard/HomeHeader/Feedback/Feedback.constants.tsx b/apps/next/src/components/Layout/Dashboard/HomeHeader/Feedback/Feedback.constants.tsx new file mode 100644 index 00000000..6f233e3b --- /dev/null +++ b/apps/next/src/components/Layout/Dashboard/HomeHeader/Feedback/Feedback.constants.tsx @@ -0,0 +1,41 @@ +import { useTranslation } from "next-i18next"; + +export interface IFeedbackType { + title: string; + imageSrc: string; + level: number; +} + +const useFeedbacks = (): IFeedbackType[] => { + const { t } = useTranslation(); + + return [ + { + title: t("general.too_bad"), + imageSrc: "/images/faces/very_bad.svg", + level: 1, + }, + { + title: t("general.bad"), + imageSrc: "/images/faces/very_bad.svg", + level: 2, + }, + { + title: t("general.not_bad"), + imageSrc: "/images/faces/not_bad.svg", + level: 3, + }, + { + title: t("general.good"), + imageSrc: "/images/faces/good.svg", + level: 4, + }, + { + title: t("general.very_good"), + imageSrc: "/images/faces/very_good.svg", + level: 5, + }, + ]; +}; + +export default useFeedbacks; diff --git a/apps/next/src/components/Layout/Dashboard/HomeHeader/Feedback/index.tsx b/apps/next/src/components/Layout/Dashboard/HomeHeader/Feedback/index.tsx new file mode 100644 index 00000000..d2a93aa2 --- /dev/null +++ b/apps/next/src/components/Layout/Dashboard/HomeHeader/Feedback/index.tsx @@ -0,0 +1,126 @@ +import useFeedbacksConstants, { + type IFeedbackType, +} from "./Feedback.constants"; +import CButton from "@/components/UI/Button"; +import { usePostFeedBackMutation } from "@/store/feedback/api"; +import { + Button, + Popover, + PopoverContent, + PopoverTrigger, + Textarea, + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, + toast, +} from "@wordigo/ui"; +import { cn } from "@wordigo/ui/lib/utils"; +import { useTranslation } from "next-i18next"; +import Image from "next/image"; +import { useState } from "react"; + +const Feedback = () => { + const { t } = useTranslation(); + const [active, setActive] = useState(); + const feedbacks = useFeedbacksConstants(); + const [inputValue, setInputValue] = useState(""); + const [isFeedbackShow, setFeedbackShow] = useState(false); + const [FeedBack, { isLoading }] = usePostFeedBackMutation(); + + const handleSubmitFeedback = () => { + void FeedBack({ + description: inputValue, + rate: active, + }) + .then(() => { + toast({ + title: t("notifications.success"), + description: t("feedback.success"), + }); + setFeedbackShow(false); + }) + .catch(() => { + toast({ + title: t("notifications.error"), + description: t("feedback.error"), + }); + }); + }; + + return ( + + + + + +
+
+
+