feat(admin): 管理端 UI/UX 深度优化——错误/加载/空状态、表单快捷键、移动端适配与无障碍
This commit is contained in:
@@ -5,6 +5,7 @@ import { useNavigate } from 'react-router';
|
||||
import dayjs from 'dayjs';
|
||||
import { useInterval } from 'usehooks-ts';
|
||||
import api from '../api';
|
||||
import { message } from '../ui/app-message';
|
||||
import { formatNotificationText, notificationTypeLabels } from '../utils/notification-display';
|
||||
import { useUserStore } from '../store/user/userStore';
|
||||
|
||||
@@ -33,8 +34,9 @@ const NotificationBell: React.FC = () => {
|
||||
try {
|
||||
const data = await api.get<NotificationItem[]>('/notifications?limit=20');
|
||||
setNotifications(data);
|
||||
} catch {
|
||||
/* ignore */
|
||||
} catch (error) {
|
||||
console.error('全部已读失败', error);
|
||||
message.error('全部已读失败,请重试');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -118,7 +120,7 @@ const NotificationBell: React.FC = () => {
|
||||
}}
|
||||
>
|
||||
<Typography.Text strong>通知中心</Typography.Text>
|
||||
<Button type="link" size="small" onClick={handleMarkAll}>
|
||||
<Button type="link" size="small" disabled={unreadCount === 0} onClick={handleMarkAll}>
|
||||
全部已读
|
||||
</Button>
|
||||
</div>
|
||||
@@ -199,7 +201,12 @@ const NotificationBell: React.FC = () => {
|
||||
placement="bottomRight"
|
||||
>
|
||||
<Badge count={unreadCount} size="small" offset={[-2, 2]}>
|
||||
<BellOutlined style={{ fontSize: 18, cursor: 'pointer' }} />
|
||||
<Button
|
||||
type="text"
|
||||
shape="circle"
|
||||
icon={<BellOutlined />}
|
||||
aria-label="通知中心"
|
||||
/>
|
||||
</Badge>
|
||||
</Popover>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user