Browse Source

feat: 增加无消息时的样式&窗口始终显示在最上面

banxia 1 month ago
parent
commit
396e08f3a7
2 changed files with 10 additions and 1 deletions
  1. 1 0
      electron/win/mainWin.ts
  2. 9 1
      src/components/MessageModal/MessageModal.tsx

+ 1 - 0
electron/win/mainWin.ts

@@ -33,6 +33,7 @@ const createWindow = (): BrowserWindow => {
     frame: false,
     show: false,
     // transparent: true,
+    alwaysOnTop: true, // 始终在顶部
     backgroundColor: "#fff",
     webPreferences: {
       preload,

+ 9 - 1
src/components/MessageModal/MessageModal.tsx

@@ -1,5 +1,5 @@
 import React, { useState } from "react";
-import { Modal, Button, Tabs } from "antd";
+import { Modal, Button, Tabs, Empty } from "antd";
 import { CheckCircleOutlined, EyeOutlined } from "@ant-design/icons";
 import type { TabsProps } from "antd";
 import { MESSAGE_TAB } from "@/constants";
@@ -80,6 +80,14 @@ const MessageModal: React.FC<MessageModalProps> = ({
           }}
         />
         <div className="space-y-4 max-h-[70vh] overflow-auto">
+          {notifications.filter(
+            (notification) =>
+              activeKey === MESSAGE_TAB.ALL || notification.status === activeKey
+          ).length === 0 && (
+            <div className="flex justify-center items-center h-full">
+              <Empty description="暂无消息" />
+            </div>
+          )}
           {notifications
             .filter(
               (notification) =>