From d03561d61c0e39f173cdc0d8cb22eacbab3d741f Mon Sep 17 00:00:00 2001 From: martylukyy <35452459+martylukyy@users.noreply.github.com> Date: Mon, 17 Apr 2023 20:54:30 +0200 Subject: [PATCH] enhancement(web): log download spinner icon (#847) replace loading dots with spinner and move text to title for it display at mouseover --- web/src/components/Icons.tsx | 4 ++++ web/src/screens/Logs.tsx | 45 ++++++------------------------------ 2 files changed, 11 insertions(+), 38 deletions(-) diff --git a/web/src/components/Icons.tsx b/web/src/components/Icons.tsx index a5c4da3..be8a93b 100644 --- a/web/src/components/Icons.tsx +++ b/web/src/components/Icons.tsx @@ -15,3 +15,7 @@ export const SortUpIcon = ({ className }: IconProps) => ( export const SortDownIcon = ({ className }: IconProps) => ( ); + +export const RingResizeSpinner = ({ className }: IconProps) => ( + +); diff --git a/web/src/screens/Logs.tsx b/web/src/screens/Logs.tsx index cdd1c60..dafe906 100644 --- a/web/src/screens/Logs.tsx +++ b/web/src/screens/Logs.tsx @@ -14,6 +14,7 @@ import { import { useQuery } from "react-query"; import { Menu, Transition } from "@headlessui/react"; import { baseUrl } from "../utils"; +import { RingResizeSpinner } from "@/components/Icons"; type LogEvent = { @@ -148,7 +149,7 @@ export const Logs = () => {
- +
@@ -208,38 +209,6 @@ interface LogFilesItemProps { file: LogFile; } -const Dots = () => { - const [step, setStep] = useState(1); - - useEffect(() => { - const interval = setInterval(() => { - setStep((prevStep) => (prevStep % 3) + 1); - }, 300); - - return () => clearInterval(interval); - }, []); - - return ( -
-
-
-
-
- ); -}; - const LogFilesItem = ({ file }: LogFilesItemProps) => { const [isDownloading, setIsDownloading] = useState(false); @@ -279,7 +248,7 @@ const LogFilesItem = ({ file }: LogFilesItemProps) => { "text-gray-900 dark:text-gray-300", "font-medium group flex rounded-md items-center px-2 py-2 text-sm" )} - title="Download file" + title={!isDownloading ? "Download file" : "Sanitizing log..."} onClick={handleDownload} > {!isDownloading ? ( @@ -288,10 +257,10 @@ const LogFilesItem = ({ file }: LogFilesItemProps) => { aria-hidden="true" /> ) : ( -
- Sanitizing log - -
+