Pārlūkot izejas kodu

feat: 更新电池状态显示,支持主题化图标 - src/layouts/StateBar.tsx, src/assets/Icons/base/module-device/theme-dark/1x/battery-full.svg

sw 5 dienas atpakaļ
vecāks
revīzija
3524892fdc

+ 87 - 0
src/assets/Icons/base/module-device/theme-dark/1x/battery-full.svg

@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   width="24"
+   height="24"
+   viewBox="0 0 24 24"
+   fill="none"
+   version="1.1"
+   id="svg5"
+   sodipodi:docname="battery-full.svg"
+   inkscape:version="1.4.2 (f4327f4, 2025-05-13)"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:svg="http://www.w3.org/2000/svg">
+  <defs
+     id="defs5" />
+  <sodipodi:namedview
+     id="namedview5"
+     pagecolor="#ffffff"
+     bordercolor="#000000"
+     borderopacity="0.25"
+     inkscape:showpageshadow="2"
+     inkscape:pageopacity="0.0"
+     inkscape:pagecheckerboard="0"
+     inkscape:deskcolor="#d1d1d1"
+     inkscape:zoom="33.625"
+     inkscape:cx="12"
+     inkscape:cy="12"
+     inkscape:window-width="1920"
+     inkscape:window-height="1009"
+     inkscape:window-x="1912"
+     inkscape:window-y="-8"
+     inkscape:window-maximized="1"
+     inkscape:current-layer="svg5" />
+  <path
+     d="M6 9L6 15"
+     stroke="black"
+     stroke-width="2"
+     stroke-linecap="round"
+     stroke-linejoin="round"
+     id="path1"
+     style="stroke:#ffff00;stroke-opacity:1" />
+  <path
+     d="M9 9L9 15"
+     stroke="black"
+     stroke-width="2"
+     stroke-linecap="round"
+     stroke-linejoin="round"
+     id="path2"
+     style="stroke:#ffff00;stroke-opacity:0.35390949" />
+  <path
+     d="M12 9L12 15"
+     stroke="black"
+     stroke-width="2"
+     stroke-linecap="round"
+     stroke-linejoin="round"
+     id="path3"
+     style="stroke:#ffff00;stroke-opacity:1" />
+  <path
+     d="M15 9L15 15"
+     stroke="black"
+     stroke-width="2"
+     stroke-linecap="round"
+     stroke-linejoin="round"
+     id="path4"
+     style="fill:#808000;stroke:#ffff00;stroke-opacity:1" />
+  <path
+     d="M21 10L21 14"
+     stroke="black"
+     stroke-width="2"
+     stroke-linecap="round"
+     stroke-linejoin="round"
+     id="path5"
+     style="stroke:#ffff00;stroke-opacity:1" />
+  <rect
+     x="3"
+     y="6"
+     width="15"
+     height="12"
+     rx="1"
+     stroke="black"
+     stroke-width="2"
+     stroke-linecap="round"
+     stroke-linejoin="round"
+     id="rect5"
+     style="stroke:#ffff6c;stroke-opacity:1" />
+</svg>

+ 3 - 1
src/layouts/StateBar.tsx

@@ -7,6 +7,7 @@ import { setQuota } from '../states/security/quotaSlice';
 import { getQuota } from '../API/security/quotaActions';
 import { HddOutlined, WifiOutlined, FireOutlined } from '@ant-design/icons';
 import Icon from '@/components/Icon';
+import { useAppSelector } from '@/states/store';
 
 // 定义状态类型
 interface StatusBarProps {
@@ -50,6 +51,7 @@ const DiskStatus: React.FC<{ status: StatusBarProps['diskStatus'] }> = ({
 
 // 电量组件
 const BatteryStatus: React.FC<{ level: number }> = ({ level }) => {
+  const themeType = useAppSelector((state) => state.theme.themeType);
   const color =
     level <= 20
       ? 'text-red-500'
@@ -65,7 +67,7 @@ const BatteryStatus: React.FC<{ level: number }> = ({ level }) => {
         module="module-device"
         name="battery-full"
         userId="base"
-        theme="default"
+        theme={themeType}
         size="2x"
         state="normal"
         useAntdIcon={false}