From 446ab0bb3822f0d4da12d30d45f6e51500fe816f Mon Sep 17 00:00:00 2001 From: Guilherme Bano Date: Fri, 20 Feb 2026 17:56:43 -0300 Subject: [PATCH] =?UTF-8?q?Adicionado=20bot=C3=A3o=20para=20atualizar=20a?= =?UTF-8?q?=20pagina?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/header-dashboard.tsx | 2 ++ components/refresh-page-button.tsx | 56 ++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 components/refresh-page-button.tsx diff --git a/components/header-dashboard.tsx b/components/header-dashboard.tsx index 7df29b9..c9b4f2a 100644 --- a/components/header-dashboard.tsx +++ b/components/header-dashboard.tsx @@ -7,6 +7,7 @@ import { AnimatedThemeToggler } from "./animated-theme-toggler"; import LogoutButton from "./auth/logout-button"; import { CalculatorDialogButton } from "./calculadora/calculator-dialog"; import { PrivacyModeToggle } from "./privacy-mode-toggle"; +import { RefreshPageButton } from "./refresh-page-button"; type SiteHeaderProps = { notificationsSnapshot: DashboardNotificationsSnapshot; @@ -25,6 +26,7 @@ export async function SiteHeader({ notificationsSnapshot }: SiteHeaderProps) { totalCount={notificationsSnapshot.totalCount} /> + | diff --git a/components/refresh-page-button.tsx b/components/refresh-page-button.tsx new file mode 100644 index 0000000..5585235 --- /dev/null +++ b/components/refresh-page-button.tsx @@ -0,0 +1,56 @@ +"use client"; + +import { RiRefreshLine } from "@remixicon/react"; +import { useRouter } from "next/navigation"; +import { useTransition } from "react"; +import { buttonVariants } from "@/components/ui/button"; +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { cn } from "@/lib/utils/ui"; + +type RefreshPageButtonProps = React.ComponentPropsWithoutRef<"button">; + +export function RefreshPageButton({ + className, + ...props +}: RefreshPageButtonProps) { + const router = useRouter(); + const [isPending, startTransition] = useTransition(); + + const handleClick = () => { + startTransition(() => { + router.refresh(); + }); + }; + + return ( + + + + + Atualizar página + + ); +}