From ddcbd289673498e7d8104ec9367a12bcf64dbac1 Mon Sep 17 00:00:00 2001 From: zhi Date: Wed, 11 Mar 2026 17:26:37 +0000 Subject: [PATCH] fix: repair monitor sidebar and alert rendering --- src/components/Sidebar.tsx | 28 ++++++++++++++-------------- src/pages/MonitorPage.tsx | 4 +--- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index e8d5eae..5237e4f 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -1,7 +1,7 @@ -import { useState, useEffect } from react -import { Link, useLocation } from react-router-dom -import api from @/services/api -import type { User } from @/types +import { useState, useEffect } from 'react' +import { Link, useLocation } from 'react-router-dom' +import api from '@/services/api' +import type { User } from '@/types' interface Props { user: User | null @@ -17,11 +17,11 @@ export default function Sidebar({ user, onLogout }: Props) { setUnreadCount(0) return } - api.get<{ count: number }>(/notifications/count) + api.get<{ count: number }>('/notifications/count') .then(({ data }) => setUnreadCount(data.count)) .catch(() => {}) const timer = setInterval(() => { - api.get<{ count: number }>(/notifications/count) + api.get<{ count: number }>('/notifications/count') .then(({ data }) => setUnreadCount(data.count)) .catch(() => {}) }, 30000) @@ -29,14 +29,14 @@ export default function Sidebar({ user, onLogout }: Props) { }, [user]) const links = user ? [ - { to: /, icon: ๐Ÿ“Š, label: ไปช่กจ็›˜ }, - { to: /issues, icon: ๐Ÿ“‹, label: Issues }, - { to: /projects, icon: ๐Ÿ“, label: ้กน็›ฎ }, - { to: /milestones, icon: ๐Ÿ, label: ้‡Œ็จ‹็ข‘ }, - { to: /notifications, icon: ๐Ÿ””, label: `้€š็Ÿฅ${unreadCount > 0 ? ` (${unreadCount})` : }` }, - { to: /monitor, icon: ๐Ÿ“ก, label: Monitor }, + { to: '/', icon: '๐Ÿ“Š', label: 'ไปช่กจ็›˜' }, + { to: '/issues', icon: '๐Ÿ“‹', label: 'Issues' }, + { to: '/projects', icon: '๐Ÿ“', label: '้กน็›ฎ' }, + { to: '/milestones', icon: '๐Ÿ', label: '้‡Œ็จ‹็ข‘' }, + { to: '/notifications', icon: '๐Ÿ””', label: '้€š็Ÿฅ' + (unreadCount > 0 ? ' (' + unreadCount + ')' : '') }, + { to: '/monitor', icon: '๐Ÿ“ก', label: 'Monitor' }, ] : [ - { to: /monitor, icon: ๐Ÿ“ก, label: Monitor }, + { to: '/monitor', icon: '๐Ÿ“ก', label: 'Monitor' }, ] return ( @@ -46,7 +46,7 @@ export default function Sidebar({ user, onLogout }: Props) {