diff --git a/messages/en-US.json b/messages/en-US.json index 3466edf4..d5521aec 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -1281,6 +1281,7 @@ "sidebarExpand": "Expand", "productUpdateMoreInfo": "{noOfUpdates} more updates", "productUpdateInfo": "{noOfUpdates} updates", + "productUpdateWhatsNew": "What's New", "pangolinUpdateAvailable": "New version available", "pangolinUpdateAvailableInfo": "Version {version} is ready to install", "pangolinUpdateAvailableReleaseNotes": "View release notes", diff --git a/src/components/ProductUpdates.tsx b/src/components/ProductUpdates.tsx index b0b3530a..6243cf88 100644 --- a/src/components/ProductUpdates.tsx +++ b/src/components/ProductUpdates.tsx @@ -5,9 +5,15 @@ import { useLocalStorage } from "@app/hooks/useLocalStorage"; import { cn } from "@app/lib/cn"; import { type ProductUpdate, productUpdatesQueries } from "@app/lib/queries"; import { useQueries } from "@tanstack/react-query"; -import { ArrowRight, BellIcon, ChevronRightIcon, XIcon } from "lucide-react"; +import { + ArrowRight, + BellIcon, + ChevronRightIcon, + RocketIcon, + XIcon +} from "lucide-react"; import { useTranslations } from "next-intl"; -import { Transition } from "@headlessui/react"; +import { Transition, TransitionChild } from "@headlessui/react"; import * as React from "react"; export default function ProductUpdates({ @@ -34,7 +40,7 @@ export default function ProductUpdates({ // we need to delay the initial React.useEffect(() => { - const timeout = setTimeout(() => setShowMoreUpdatesText(true), 500); + const timeout = setTimeout(() => setShowMoreUpdatesText(true), 600); return () => clearTimeout(timeout); }, []); @@ -42,62 +48,63 @@ export default function ProductUpdates({ string | null >("ignored-version", null); - const [showNewVersionPopup, setShowNewVersionPopup] = React.useState(true); - if (!data) return null; - // const showNewVersionPopup = Boolean( - // data?.latestVersion?.data && - // ignoredVersionUpdate !== - // data.latestVersion.data?.pangolin.latestVersion && - // env.app.version !== data.latestVersion.data?.pangolin.latestVersion - // ); + const showNewVersionPopup = Boolean( + data?.latestVersion?.data && + ignoredVersionUpdate !== + data.latestVersion.data?.pangolin.latestVersion && + env.app.version !== data.latestVersion.data?.pangolin.latestVersion + ); return (
+ <> +
+ + {data.updates.length > 0 && ( + <> + + + {showNewVersionPopup + ? t("productUpdateMoreInfo", { + noOfUpdates: data.updates.length + }) + : t("productUpdateInfo", { + noOfUpdates: data.updates.length + })} + + + )} + + 0} + /> +
+ + { - // setIgnoredVersionUpdate( - // data.latestVersion?.data?.pangolin.latestVersion ?? null - // ); - setShowNewVersionPopup(false); + setIgnoredVersionUpdate( + data.latestVersion?.data?.pangolin.latestVersion ?? null + ); }} show={showNewVersionPopup} /> - - - - {data.updates.length > 0 && ( - <> - - - {showNewVersionPopup - ? t("productUpdateMoreInfo", { - noOfUpdates: data.updates.length - }) - : t("productUpdateInfo", { - noOfUpdates: data.updates.length - })} - - - )} - - - 0} - />
); } @@ -119,6 +126,7 @@ function ProductUpdatesPopup({ updates, show }: ProductUpdatesPopupProps) {
-

What's new

+

{t("productUpdateWhatsNew")}

- +