Przeglądaj źródła

update HeaderBar

GuoRuqiang 1 rok temu
rodzic
commit
016e071d50
2 zmienionych plików z 34 dodań i 9 usunięć
  1. 24 0
      web/src/components/HeaderBar.js
  2. 10 9
      web/src/components/SiderBar.js

+ 24 - 0
web/src/components/HeaderBar.js

@@ -12,6 +12,7 @@ import {
   IconHelpCircle,
   IconHome,
   IconHomeStroked,
+  IconComment,
   IconKey,
   IconNoteMoneyStroked,
   IconPriceTag,
@@ -37,6 +38,28 @@ let buttons = [
     itemKey: 'home',
     to: '/',
     icon: <IconHomeStroked />,
+    onMouseEnter: (e) => {
+      e.currentTarget.querySelector('svg').style.color = '#0064FA';
+    },
+    onMouseLeave: (e) => {
+      e.currentTarget.querySelector('svg').style.color = 'black';
+    },
+  },
+  // 增加 聊天 按钮
+  {
+    text: '聊天',
+    itemKey: 'chat',
+    to: '/chat',
+    icon: <IconComment />,
+    onMouseEnter: (e) => {
+      e.currentTarget.querySelector('svg').style.color = '#0064FA';
+    },
+    onMouseLeave: (e) => {
+      e.currentTarget.querySelector('svg').style.color = 'black';
+    },
+    className: localStorage.getItem('chat_link')
+      ? 'semi-navigation-item-normal'
+      : 'tableHiddle',
   },
   // {
   //   text: '模型价格',
@@ -115,6 +138,7 @@ const HeaderBar = () => {
                 login: '/login',
                 register: '/register',
                 home: '/',
+                chat: '/chat',
               };
               return (
                 <Link

+ 10 - 9
web/src/components/SiderBar.js

@@ -86,15 +86,16 @@ const SiderBar = () => {
         icon: <IconLayers />,
         className: isAdmin() ? 'semi-navigation-item-normal' : 'tableHiddle',
       },
-      {
-        text: '聊天',
-        itemKey: 'chat',
-        to: '/chat',
-        icon: <IconComment />,
-        className: localStorage.getItem('chat_link')
-          ? 'semi-navigation-item-normal'
-          : 'tableHiddle',
-      },
+      // 去掉侧边栏的聊天,换到HeaderBar
+      // {
+      //   text: '聊天',
+      //   itemKey: 'chat',
+      //   to: '/chat',
+      //   icon: <IconComment />,
+      //   className: localStorage.getItem('chat_link')
+      //     ? 'semi-navigation-item-normal'
+      //     : 'tableHiddle',
+      // },
       {
         text: '令牌',
         itemKey: 'token',