diff --git a/apps/web/src/components/sidebar/DesktopUpdateCheckIcon.tsx b/apps/web/src/components/sidebar/DesktopUpdateCheckIcon.tsx new file mode 100644 index 0000000000..8d04de8086 --- /dev/null +++ b/apps/web/src/components/sidebar/DesktopUpdateCheckIcon.tsx @@ -0,0 +1,7 @@ +import { RefreshCwIcon } from "lucide-react"; + +import { cn } from "../../lib/utils"; + +export function DesktopUpdateCheckIcon({ isAnimating }: { readonly isAnimating: boolean }) { + return ; +} diff --git a/apps/web/src/components/sidebar/SidebarUpdatePill.test.tsx b/apps/web/src/components/sidebar/SidebarUpdatePill.test.tsx new file mode 100644 index 0000000000..c52861979c --- /dev/null +++ b/apps/web/src/components/sidebar/SidebarUpdatePill.test.tsx @@ -0,0 +1,18 @@ +import { renderToStaticMarkup } from "react-dom/server"; +import { describe, expect, it } from "vite-plus/test"; + +import { DesktopUpdateCheckIcon } from "./DesktopUpdateCheckIcon"; + +describe("DesktopUpdateCheckIcon", () => { + it("keeps the refresh icon spinning while a fast update check settles", () => { + const markup = renderToStaticMarkup(); + + expect(markup).toContain("animate-spin-once"); + }); + + it("does not animate while idle", () => { + const markup = renderToStaticMarkup(); + + expect(markup).not.toContain("animate-spin-once"); + }); +}); diff --git a/apps/web/src/components/sidebar/SidebarUpdatePill.tsx b/apps/web/src/components/sidebar/SidebarUpdatePill.tsx index 191f30438d..f586b4e56a 100644 --- a/apps/web/src/components/sidebar/SidebarUpdatePill.tsx +++ b/apps/web/src/components/sidebar/SidebarUpdatePill.tsx @@ -1,4 +1,4 @@ -import { DownloadIcon, RefreshCwIcon, RotateCwIcon, TriangleAlertIcon } from "lucide-react"; +import { DownloadIcon, RotateCwIcon, TriangleAlertIcon } from "lucide-react"; import { useCallback, useState } from "react"; import { isElectron } from "../../env"; import { cn } from "../../lib/utils"; @@ -21,6 +21,7 @@ import { Alert, AlertDescription, AlertTitle } from "../ui/alert"; import { Separator } from "../ui/separator"; import { SidebarMenuItem } from "../ui/sidebar"; import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; +import { DesktopUpdateCheckIcon } from "./DesktopUpdateCheckIcon"; function keyReleaseNoteItems(items: ReadonlyArray) { const occurrences = new Map(); @@ -110,6 +111,7 @@ export function SidebarUpdatePill() { function SidebarUpdateControl() { const state = useDesktopUpdateState(); const [isActionPending, setIsActionPending] = useState(false); + const [checkAnimationKey, setCheckAnimationKey] = useState(0); const action = state ? resolveDesktopUpdateButtonAction(state) : "none"; const isDownloading = state?.status === "downloading"; @@ -209,6 +211,7 @@ function SidebarUpdateControl() { return; } + setCheckAnimationKey((key) => key + 1); void bridge .checkForUpdate() .then((result) => { @@ -257,8 +260,9 @@ function SidebarUpdateControl() { ) : isUpdateState ? ( ) : ( - 0 || state?.status === "checking"} /> )} diff --git a/apps/web/src/index.css b/apps/web/src/index.css index 340a94d00c..20f1a00c9d 100644 --- a/apps/web/src/index.css +++ b/apps/web/src/index.css @@ -140,6 +140,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil } @theme inline { + --animate-spin-once: spin 1s linear 1; --color-zinc-25: oklch(99.2% 0 0); --animate-skeleton: skeleton 2s infinite linear; /* Duty-cycled indicator animations: long holds with stepped ramps, so the