forked from git.gladyson/openmonetis
refactor: optimize codebase for React 19 compiler (v1.2.6)
React 19 compiler auto-optimizes memoization, making manual hooks unnecessary. Changes: - Remove ~60 useCallback/useMemo across 16 files - Remove React.memo from nav-button and return-button - Simplify hydration with useSyncExternalStore (privacy-provider) - Add CHANGELOG.md for version tracking No functional changes - internal optimization only. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { RiArrowLeftSLine, RiArrowRightSLine } from "@remixicon/react";
|
||||
import React from "react";
|
||||
|
||||
interface NavigationButtonProps {
|
||||
direction: "left" | "right";
|
||||
@@ -9,25 +8,23 @@ interface NavigationButtonProps {
|
||||
onClick: () => void;
|
||||
}
|
||||
|
||||
const NavigationButton = React.memo(
|
||||
({ direction, disabled, onClick }: NavigationButtonProps) => {
|
||||
const Icon = direction === "left" ? RiArrowLeftSLine : RiArrowRightSLine;
|
||||
export default function NavigationButton({
|
||||
direction,
|
||||
disabled,
|
||||
onClick,
|
||||
}: NavigationButtonProps) {
|
||||
const Icon = direction === "left" ? RiArrowLeftSLine : RiArrowRightSLine;
|
||||
|
||||
return (
|
||||
<button
|
||||
onClick={onClick}
|
||||
className="text-month-picker-foreground transition-all duration-200 cursor-pointer rounded-lg p-1 hover:bg-month-picker-foreground/10 focus:outline-hidden focus:ring-2 focus:ring-month-picker-foreground/30 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent"
|
||||
disabled={disabled}
|
||||
aria-label={`Navegar para o mês ${
|
||||
direction === "left" ? "anterior" : "seguinte"
|
||||
}`}
|
||||
>
|
||||
<Icon className="text-primary" size={18} />
|
||||
</button>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
NavigationButton.displayName = "NavigationButton";
|
||||
|
||||
export default NavigationButton;
|
||||
return (
|
||||
<button
|
||||
onClick={onClick}
|
||||
className="text-month-picker-foreground transition-all duration-200 cursor-pointer rounded-lg p-1 hover:bg-month-picker-foreground/10 focus:outline-hidden focus:ring-2 focus:ring-month-picker-foreground/30 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent"
|
||||
disabled={disabled}
|
||||
aria-label={`Navegar para o mês ${
|
||||
direction === "left" ? "anterior" : "seguinte"
|
||||
}`}
|
||||
>
|
||||
<Icon className="text-primary" size={18} />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user