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 + + ); +}