diff --git a/src/components/FileBreadcrumb/index.jsx b/src/components/FileBreadcrumb/index.jsx index ab388fa..d6b44c6 100644 --- a/src/components/FileBreadcrumb/index.jsx +++ b/src/components/FileBreadcrumb/index.jsx @@ -14,11 +14,11 @@ const Index = ({path, handlerBreadcrumb}) => {
  • { items.length - 1 !== index ? -
    +
    {" / "}
    : -
    +
    {item}
    } diff --git a/src/components/TileViewFileExplorer/index.css b/src/components/TileViewFileExplorer/index.css index 6bf7b65..39e1c5a 100644 --- a/src/components/TileViewFileExplorer/index.css +++ b/src/components/TileViewFileExplorer/index.css @@ -1,3 +1,3 @@ .text-item { - @apply flex rounded-md items-center w-full text-sm text-gray-700; + @apply flex rounded-md items-center w-full text-sm text-gray-700 dark:text-white; } diff --git a/src/components/TileViewFileExplorer/index.jsx b/src/components/TileViewFileExplorer/index.jsx index 6db2f91..18c6646 100644 --- a/src/components/TileViewFileExplorer/index.jsx +++ b/src/components/TileViewFileExplorer/index.jsx @@ -116,7 +116,7 @@ const Index = ({path, getFileList, items, handlerNextPath}) => { isOpen ?
    { >
    + className="flex flex-col rounded-md w-full p-2 text-sm cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-800 duration-200">
    名称: {selectedItem.name}
    类型: {selectedItem.is_directory ? "文件夹" : "文件"}
    大小: {showFileSize(selectedItem.size)}
    @@ -140,7 +140,7 @@ const Index = ({path, getFileList, items, handlerNextPath}) => { <> @@ -150,7 +150,7 @@ const Index = ({path, getFileList, items, handlerNextPath}) => { <> @@ -158,7 +158,7 @@ const Index = ({path, getFileList, items, handlerNextPath}) => { { } diff --git a/src/main.jsx b/src/main.jsx index 9527f48..b6b9d01 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -7,14 +7,11 @@ import {Provider} from "react-redux"; import router from "@/router/index.jsx"; import store from "@/store/index.js"; -import {ConfigProvider} from "antd"; createRoot(document.getElementById('root')).render( - - - - - + + + ) diff --git a/src/pages/App.jsx b/src/pages/App.jsx index ca3bd43..75fa98e 100644 --- a/src/pages/App.jsx +++ b/src/pages/App.jsx @@ -1,10 +1,33 @@ -import React from 'react'; +import React, {useEffect, useState} from 'react'; import {Outlet} from "react-router-dom"; +import {ConfigProvider, FloatButton, theme} from "antd"; +import {MoonStar, Sun} from "lucide-react"; const App = () => { + + const [darkMode, setDarkMode] = useState(localStorage.getItem("darkMode") === "true"); + + useEffect(() => { + if (darkMode) { + document.documentElement.classList.add('dark'); + } else { + document.documentElement.classList.remove('dark'); + } + localStorage.setItem('darkMode', darkMode.toString()); + }, [darkMode]); + return ( <> - + +
    + + : } + tooltip={
    深色模式
    } + onClick={() => setDarkMode(!darkMode)}/> +
    +
    ); }; diff --git a/src/pages/Dashboard/Folder/index.jsx b/src/pages/Dashboard/Folder/index.jsx index a101dac..b65c7a6 100644 --- a/src/pages/Dashboard/Folder/index.jsx +++ b/src/pages/Dashboard/Folder/index.jsx @@ -29,14 +29,14 @@ const Index = () => { return ( <> -
    +
    -
    +
    { return ( <> -
    - 官方文档: - - [打开] - +
    +
    + 官方文档: + + [打开 ] + +
    ); diff --git a/src/pages/Dashboard/Log/index.jsx b/src/pages/Dashboard/Log/index.jsx index baeb834..4056edd 100644 --- a/src/pages/Dashboard/Log/index.jsx +++ b/src/pages/Dashboard/Log/index.jsx @@ -153,7 +153,7 @@ const Index = () => { return ( <> {contextHolder} -
    +
    @@ -183,7 +183,7 @@ const Index = () => {
    + className="flex-1 mt-8 bg-black dark:bg-gray-800 text-white overflow-auto min-h-[calc(100vh-160px)] max-h-[calc(100vh-160px)]"> { logs.map((item, index) => { return ( diff --git a/src/pages/Dashboard/Overview/index.jsx b/src/pages/Dashboard/Overview/index.jsx index 716c369..ff56a95 100644 --- a/src/pages/Dashboard/Overview/index.jsx +++ b/src/pages/Dashboard/Overview/index.jsx @@ -17,7 +17,7 @@ const Index = () => { return ( <> -
    +
    磁盘使用量
    { return ( <> {contextHolder} -
    - +
    +
    { {contextHolder}
    + className="fixed top-0 left-0 w-full h-full border-r dark:border-gray-900 bg-white dark:bg-gray-950 space-y-8 sm:w-60">
    navigate('/')}> @@ -91,8 +91,8 @@ const Index = () => { return (
  • navigate(item.nav)} - className={`flex items-center gap-x-2 text-gray-600 p-2 rounded-lg cursor-pointer ${isActive ? 'bg-gray-100' : 'hover:bg-gray-50 active:bg-gray-100 duration-150'}`}> -
    {item.icon}
    + className={`flex items-center gap-x-2 text-gray-600 dark:text-white p-2 rounded-lg cursor-pointer ${isActive ? 'bg-gray-100 dark:bg-gray-800' : 'hover:bg-gray-50 dark:hover:bg-gray-900 active:bg-gray-100 dark:active:bg-gray-800 duration-150'}`}> +
    {item.icon}
    {item.name}
  • @@ -108,8 +108,8 @@ const Index = () => { return (
  • navigate(item.nav)} - className={`flex items-center gap-x-2 text-gray-600 p-2 rounded-lg cursor-pointer ${isActive ? 'bg-gray-100' : 'hover:bg-gray-50 active:bg-gray-100 duration-150'}`}> -
    {item.icon}
    + className={`flex items-center gap-x-2 text-gray-600 dark:text-white p-2 rounded-lg cursor-pointer ${isActive ? 'bg-gray-100 dark:bg-gray-800' : 'hover:bg-gray-50 dark:hover:bg-gray-900 active:bg-gray-100 dark:active:bg-gray-800 duration-150'}`}> +
    {item.icon}
    {item.name}
  • @@ -119,18 +119,18 @@ const Index = () => {
  • signOut()} - className={`flex items-center gap-x-2 text-gray-600 p-2 rounded-lg cursor-pointer hover:bg-gray-50 active:bg-gray-100 duration-150}`}> -
    + className={`flex items-center gap-x-2 text-gray-600 dark:text-white p-2 rounded-lg cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-900 active:bg-gray-100 dark:active:bg-gray-800 duration-150}`}> +
    退出登录
  • -
    +
    {/**/} - +
    - ADMIN + ADMIN
    @@ -139,7 +139,7 @@ const Index = () => {
    -
    +
    diff --git a/src/pages/Home/index.jsx b/src/pages/Home/index.jsx index 0fb4d4a..3f8cd03 100644 --- a/src/pages/Home/index.jsx +++ b/src/pages/Home/index.jsx @@ -1,10 +1,14 @@ import {useNavigate} from "react-router-dom"; import {useSelector} from "react-redux"; +import {theme} from "antd"; + +const {useToken} = theme; const Index = () => { const user = useSelector(state => state.user) const navigate = useNavigate(); + const {token} = useToken(); const checkStatus = () => { if (user.token) { @@ -16,12 +20,12 @@ const Index = () => { return ( <> -
    +

    McPatch

    -

    +

    McPatch 是一个给 Minecraft 客户端做文件更新的独立应用程序.只要你想,你可以通过这个程序向你服务器的玩家提供一切内容.

    diff --git a/src/pages/NotFound/index.jsx b/src/pages/NotFound/index.jsx index c6ace77..b7c537b 100644 --- a/src/pages/NotFound/index.jsx +++ b/src/pages/NotFound/index.jsx @@ -9,7 +9,7 @@ const Index = () => {
    McPatch
    -

    +

    404. 对不起,您要查找的页面无法找到或已被删除.

    navigate(-1)} diff --git a/tailwind.config.js b/tailwind.config.js index d37737f..9fc9762 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,5 +1,6 @@ /** @type {import('tailwindcss').Config} */ export default { + darkMode: 'selector', content: [ "./index.html", "./src/**/*.{js,ts,jsx,tsx}",