style: clean up code formatting and remove trailing whitespace

refactor: reorganize imports and fix type imports
This commit is contained in:
Evandro Fonseca Junior committed 2025-11-11 03:08:36 -03:00
1 parent d3704602fd
commit 47c04de6fe
232 files changed
+7140 -4798

No files matched your search

+10 -11
View File
@@ -1,16 +1,16 @@
"use client";
import { useState, useEffect, useRef } from "react";
import { Bell } from "lucide-react";
import { Button } from "@/components/ui/button";
import { useEffect, useRef, useState } from "react";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { NotificationDropdown } from "./NotificationDropdown";
import { useSession } from "@/lib/hooks/use-session";
import { NotificationDropdown } from "./NotificationDropdown";
interface Notification {
notification_id: number;
@@ -32,7 +32,7 @@ export function NotificationBell({ userId, className }: NotificationBellProps) {
const [unreadCount, setUnreadCount] = useState(0);
const [notifications, setNotifications] = useState<Notification[]>([]);
const [isOpen, setIsOpen] = useState(false);
const [loading, setLoading] = useState(false);
const [_loading, setLoading] = useState(false);
const rawUnreadRef = useRef(0);
const baselineUnreadRef = useRef(0);
const baselineLoadedRef = useRef(false);
@@ -122,7 +122,7 @@ export function NotificationBell({ userId, className }: NotificationBellProps) {
baselineUnreadRef.current = 0;
baselineLoadedRef.current = false;
}
}, [effectiveUserId]);
}, [effectiveUserId, loadBaselineFromStorage]);
useEffect(() => {
if (!effectiveUserId) return;
@@ -138,7 +138,7 @@ export function NotificationBell({ userId, className }: NotificationBellProps) {
}, 30000); // 30 segundos
return () => clearInterval(interval);
}, [effectiveUserId, isOpen]);
}, [effectiveUserId, isOpen, fetchNotifications, fetchUnreadCount]);
// Atualizar quando abrir popover
useEffect(() => {
@@ -147,7 +147,7 @@ export function NotificationBell({ userId, className }: NotificationBellProps) {
persistBaseline(rawUnreadRef.current);
setUnreadCount(0);
}
}, [isOpen]);
}, [isOpen, fetchNotifications, persistBaseline]);
const handleMarkAsRead = async (notificationId: number) => {
try {
@@ -159,14 +159,14 @@ export function NotificationBell({ userId, className }: NotificationBellProps) {
// Atualizar estado local
setNotifications((prev) =>
prev.map((n) =>
n.notification_id === notificationId ? { ...n, is_read: true } : n
)
n.notification_id === notificationId ? { ...n, is_read: true } : n,
),
);
// Atualizar contagem
rawUnreadRef.current = Math.max(0, rawUnreadRef.current - 1);
const newBaseline = Math.min(
baselineUnreadRef.current,
rawUnreadRef.current
rawUnreadRef.current,
);
persistBaseline(newBaseline);
setUnreadCount((prev) => Math.max(0, prev - 1));
@@ -209,4 +209,3 @@ export function NotificationBell({ userId, className }: NotificationBellProps) {
</DropdownMenu>
);
}