From 74e3f85866550b34bac9a293e9755a9ee5eeb987 Mon Sep 17 00:00:00 2001 From: jubnl Date: Thu, 2 Apr 2026 19:09:43 +0200 Subject: [PATCH] fix: finish rename refactor --- client/src/components/Layout/InAppNotificationBell.tsx | 4 ++-- .../src/components/Notifications/InAppNotificationItem.tsx | 4 ++-- client/src/hooks/useInAppNotificationListener.ts | 6 +++--- client/src/pages/InAppNotificationsPage.tsx | 4 ++-- client/src/store/inAppNotificationStore.ts | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/client/src/components/Layout/InAppNotificationBell.tsx b/client/src/components/Layout/InAppNotificationBell.tsx index ecc409c..fcf14cb 100644 --- a/client/src/components/Layout/InAppNotificationBell.tsx +++ b/client/src/components/Layout/InAppNotificationBell.tsx @@ -3,7 +3,7 @@ import ReactDOM from 'react-dom' import { useNavigate } from 'react-router-dom' import { Bell, Trash2, CheckCheck } from 'lucide-react' import { useTranslation } from '../../i18n' -import { useNotificationStore } from '../../store/notificationStore' +import { useInAppNotificationStore } from '../../store/inAppNotificationStore.ts' import { useSettingsStore } from '../../store/settingsStore' import { useAuthStore } from '../../store/authStore' import InAppNotificationItem from '../Notifications/InAppNotificationItem.tsx' @@ -16,7 +16,7 @@ export default function InAppNotificationBell(): React.ReactElement { const dark = darkMode === true || darkMode === 'dark' || (darkMode === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches) const isAuthenticated = useAuthStore(s => s.isAuthenticated) - const { notifications, unreadCount, isLoading, fetchNotifications, fetchUnreadCount, markAllRead, deleteAll } = useNotificationStore() + const { notifications, unreadCount, isLoading, fetchNotifications, fetchUnreadCount, markAllRead, deleteAll } = useInAppNotificationStore() const [open, setOpen] = useState(false) diff --git a/client/src/components/Notifications/InAppNotificationItem.tsx b/client/src/components/Notifications/InAppNotificationItem.tsx index 8eb9b9d..a791fe7 100644 --- a/client/src/components/Notifications/InAppNotificationItem.tsx +++ b/client/src/components/Notifications/InAppNotificationItem.tsx @@ -2,7 +2,7 @@ import React, { useState } from 'react' import { useNavigate } from 'react-router-dom' import { User, Check, X, ArrowRight, Trash2, CheckCheck } from 'lucide-react' import { useTranslation } from '../../i18n' -import { useNotificationStore, InAppNotification } from '../../store/notificationStore' +import { useInAppNotificationStore, InAppNotification } from '../../store/inAppNotificationStore' import { useSettingsStore } from '../../store/settingsStore' function relativeTime(dateStr: string, locale: string): string { @@ -29,7 +29,7 @@ export default function InAppNotificationItem({ notification, onClose }: Notific const dark = darkMode === true || darkMode === 'dark' || (darkMode === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches) const [responding, setResponding] = useState(false) - const { markRead, markUnread, deleteNotification, respondToBoolean } = useNotificationStore() + const { markRead, markUnread, deleteNotification, respondToBoolean } = useInAppNotificationStore() const handleNavigate = async () => { if (!notification.is_read) await markRead(notification.id) diff --git a/client/src/hooks/useInAppNotificationListener.ts b/client/src/hooks/useInAppNotificationListener.ts index f9796b0..d5fced1 100644 --- a/client/src/hooks/useInAppNotificationListener.ts +++ b/client/src/hooks/useInAppNotificationListener.ts @@ -1,10 +1,10 @@ import { useEffect } from 'react' import { addListener, removeListener } from '../api/websocket' -import { useNotificationStore } from '../store/notificationStore' +import { useInAppNotificationStore } from '../store/inAppNotificationStore.ts' export function useInAppNotificationListener(): void { - const handleNew = useNotificationStore(s => s.handleNewNotification) - const handleUpdated = useNotificationStore(s => s.handleUpdatedNotification) + const handleNew = useInAppNotificationStore(s => s.handleNewNotification) + const handleUpdated = useInAppNotificationStore(s => s.handleUpdatedNotification) useEffect(() => { const listener = (event: Record) => { diff --git a/client/src/pages/InAppNotificationsPage.tsx b/client/src/pages/InAppNotificationsPage.tsx index aa18343..c6a659f 100644 --- a/client/src/pages/InAppNotificationsPage.tsx +++ b/client/src/pages/InAppNotificationsPage.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useRef, useState } from 'react' import { Bell, CheckCheck, Trash2 } from 'lucide-react' import { useTranslation } from '../i18n' -import { useNotificationStore } from '../store/notificationStore' +import { useInAppNotificationStore } from '../store/inAppNotificationStore.ts' import { useSettingsStore } from '../store/settingsStore' import Navbar from '../components/Layout/Navbar' import InAppNotificationItem from '../components/Notifications/InAppNotificationItem.tsx' @@ -12,7 +12,7 @@ export default function InAppNotificationsPage(): React.ReactElement { const darkMode = settings.dark_mode const dark = darkMode === true || darkMode === 'dark' || (darkMode === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches) - const { notifications, unreadCount, total, isLoading, hasMore, fetchNotifications, markAllRead, deleteAll } = useNotificationStore() + const { notifications, unreadCount, total, isLoading, hasMore, fetchNotifications, markAllRead, deleteAll } = useInAppNotificationStore() const [unreadOnly, setUnreadOnly] = useState(false) const loaderRef = useRef(null) diff --git a/client/src/store/inAppNotificationStore.ts b/client/src/store/inAppNotificationStore.ts index b4bbdfb..5f8fc97 100644 --- a/client/src/store/inAppNotificationStore.ts +++ b/client/src/store/inAppNotificationStore.ts @@ -60,7 +60,7 @@ interface NotificationState { const PAGE_SIZE = 20 -export const useNotificationStore = create((set, get) => ({ +export const useInAppNotificationStore = create((set, get) => ({ notifications: [], unreadCount: 0, total: 0,