Skip to content

Commit

Permalink
Fix BalanceReminder
Browse files Browse the repository at this point in the history
  • Loading branch information
lq0-github committed Jan 21, 2025
1 parent 99f2aa5 commit a30d346
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions components/BalanceReminder/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ const BalanceReminder = () => {
...accountSupplied.map((token) => ({ ...token, type: "main" })),
...accountSuppliedMEME.map((token) => ({ ...token, type: "meme" })),
];
const [lastClosedDate, setLastClosedDate] = useState(() =>
localStorage.getItem("balanceReminderLastClosed"),
);

const Unreminded = useMemo(() => {
const lastClosedDate = localStorage.getItem("balanceReminderLastClosed");
const today = new Date().toDateString();
return !lastClosedDate || lastClosedDate !== today;
}, []);
}, [lastClosedDate]);
const dispatch = useDispatch();
useEffect(() => {
const hasValidAccountSupplied =
Expand Down Expand Up @@ -54,6 +57,7 @@ const BalanceReminder = () => {
function closeTip() {
const today = new Date().toDateString();
localStorage.setItem("balanceReminderLastClosed", today);
setLastClosedDate(today);
setShouldShow(false);
}
if (!shouldShow) {
Expand Down

0 comments on commit a30d346

Please sign in to comment.