From 8fecebc254e1afdd839510b40c950315da3279cf Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Sun, 10 Nov 2024 20:00:19 +0800 Subject: [PATCH] feat: show loading button when pushing test notifications --- ui/src/components/notify/Bark.tsx | 8 ++++++ ui/src/components/notify/DingTalk.tsx | 8 ++++++ ui/src/components/notify/Email.tsx | 8 ++++++ ui/src/components/notify/Lark.tsx | 8 ++++++ ui/src/components/notify/ServerChan.tsx | 8 ++++++ ui/src/components/notify/Telegram.tsx | 8 ++++++ ui/src/components/notify/Webhook.tsx | 8 ++++++ ui/src/components/ui/button.tsx | 34 ++++++++++++++++++++++--- 8 files changed, 87 insertions(+), 3 deletions(-) diff --git a/ui/src/components/notify/Bark.tsx b/ui/src/components/notify/Bark.tsx index 6584b542..0b651cb6 100644 --- a/ui/src/components/notify/Bark.tsx +++ b/ui/src/components/notify/Bark.tsx @@ -123,8 +123,13 @@ const Bark = () => { } }; + const [testing, setTesting] = useState(false); const handlePushTestClick = async () => { + if (testing) return; + try { + setTesting(true); + await notifyTest("bark"); toast({ @@ -139,6 +144,8 @@ const Bark = () => { description: `${t("settings.notification.push_test_message.failed.message")}: ${msg}`, variant: "destructive", }); + } finally { + setTesting(false); } }; @@ -238,6 +245,7 @@ const Bark = () => { + ); }); Button.displayName = "Button";