From 8acf33589d6b37021be7dc653d2583c47c6bba42 Mon Sep 17 00:00:00 2001 From: soup Date: Sat, 6 May 2023 18:19:43 +0200 Subject: [PATCH] enhancement(web): mutation improvements and toast updates (#913) * make notification switch take onToggleMutation Instead of opening it like the edit button, it now enables/disables it directly. * improved toast for update checks * improved toast for download clients it now mentions what client is enabled/disabled * improved irc network toast * added toast when copying apikey * added toast to log download implemented an info variant for the toasts * improved feed toast * improved toast for update checks * Merge branch 'develop' into enhancement/mutation-improvements-toast-updates --- web/src/components/fields/text.tsx | 19 ++++++++++++++++ web/src/components/notifications/Toast.tsx | 6 +++-- web/src/screens/Logs.tsx | 13 +++++++++++ web/src/screens/settings/Application.tsx | 9 +++----- web/src/screens/settings/DownloadClient.tsx | 7 +++--- web/src/screens/settings/Feed.tsx | 2 +- web/src/screens/settings/Irc.tsx | 7 +++--- web/src/screens/settings/Notifications.tsx | 25 ++++++++++++++++++--- 8 files changed, 68 insertions(+), 20 deletions(-) diff --git a/web/src/components/fields/text.tsx b/web/src/components/fields/text.tsx index 1ff15a7..cb7ec5e 100644 --- a/web/src/components/fields/text.tsx +++ b/web/src/components/fields/text.tsx @@ -6,6 +6,8 @@ import { useToggle } from "@hooks/hooks"; import { CheckIcon, DocumentDuplicateIcon, EyeIcon, EyeSlashIcon } from "@heroicons/react/24/outline"; import { useState } from "react"; +import { toast } from "react-hot-toast"; +import Toast from "@components/notifications/Toast"; interface KeyFieldProps { value: string; @@ -30,12 +32,29 @@ export const KeyField = ({ value }: KeyFieldProps) => { .then(() => { // If successful, update the isCopied state value setIsCopied(true); + + toast.custom(t => ( + + )); + setTimeout(() => { setIsCopied(false); }, 1500); }) .catch((err) => { console.error(err); + + toast.custom(t => ( + + )); }); }; diff --git a/web/src/components/notifications/Toast.tsx b/web/src/components/notifications/Toast.tsx index 1b58d1a..27fd449 100644 --- a/web/src/components/notifications/Toast.tsx +++ b/web/src/components/notifications/Toast.tsx @@ -4,12 +4,12 @@ */ import { FC } from "react"; -import { CheckCircleIcon, ExclamationCircleIcon, ExclamationTriangleIcon, XMarkIcon } from "@heroicons/react/24/solid"; +import { CheckCircleIcon, ExclamationCircleIcon, ExclamationTriangleIcon, InformationCircleIcon, XMarkIcon } from "@heroicons/react/24/solid"; import { toast, Toast as Tooast } from "react-hot-toast"; import { classNames } from "@utils"; type Props = { - type: "error" | "success" | "warning" + type: "error" | "success" | "warning" | "info"; body?: string t?: Tooast; }; @@ -24,12 +24,14 @@ const Toast: FC = ({ type, body, t }) => ( {type === "success" &&