diff --git a/napcat.webui/src/components/audio_player.tsx b/napcat.webui/src/components/audio_player.tsx index 72d81374..e884ef0c 100644 --- a/napcat.webui/src/components/audio_player.tsx +++ b/napcat.webui/src/components/audio_player.tsx @@ -187,7 +187,7 @@ export default function AudioPlayer(props: AudioPlayerProps) { return (
{ test?: string } diff --git a/napcat.webui/src/components/icons.tsx b/napcat.webui/src/components/icons.tsx index 59f24b2e..0253ee81 100644 --- a/napcat.webui/src/components/icons.tsx +++ b/napcat.webui/src/components/icons.tsx @@ -1125,7 +1125,7 @@ export const WebUIIcon = (props: IconSvgProps) => ( > ( > ( > ( > ( > ( > ( > ( > ( > ( > ( > ( > ( > = React.memo((props) => { onNativeClose() }} classNames={{ - backdrop: 'z-[99999999]', - wrapper: 'z-[999999999]' + backdrop: 'z-[99]', + wrapper: 'z-[99]' }} {...rest} > diff --git a/napcat.webui/src/components/onebot/api/debug.tsx b/napcat.webui/src/components/onebot/api/debug.tsx index 91bf6c72..19d4516f 100644 --- a/napcat.webui/src/components/onebot/api/debug.tsx +++ b/napcat.webui/src/components/onebot/api/debug.tsx @@ -4,7 +4,7 @@ import { Input } from '@heroui/input' import { Snippet } from '@heroui/snippet' import { useLocalStorage } from '@uidotdev/usehooks' import { motion } from 'motion/react' -import { useEffect, useState } from 'react' +import { useEffect, useRef, useState } from 'react' import toast from 'react-hot-toast' import { IoLink, IoSend } from 'react-icons/io5' import { PiCatDuotone } from 'react-icons/pi' @@ -41,6 +41,7 @@ const OneBotApiDebug: React.FC = (props) => { const [isCodeEditorOpen, setIsCodeEditorOpen] = useState(false) const [isResponseOpen, setIsResponseOpen] = useState(false) const [isFetching, setIsFetching] = useState(false) + const responseRef = useRef(null) const parsedRequest = parse(data.request) const parsedResponse = parse(data.response) @@ -69,6 +70,11 @@ const OneBotApiDebug: React.FC = (props) => { }) .finally(() => { setIsFetching(false) + setIsResponseOpen(true) + responseRef.current?.scrollIntoView({ + behavior: 'smooth', + block: 'start' + }) toast.dismiss(r) }) } catch (error) { @@ -84,8 +90,8 @@ const OneBotApiDebug: React.FC = (props) => { }, [path]) return ( -
-

+
+

{data.description}

@@ -93,6 +99,9 @@ const OneBotApiDebug: React.FC = (props) => { } + tooltipProps={{ + content: '点击复制地址' + }} > {path} @@ -125,7 +134,10 @@ const OneBotApiDebug: React.FC = (props) => {

- + 请求体
- + ) } diff --git a/napcat.webui/src/components/onebot/api/nav_list.tsx b/napcat.webui/src/components/onebot/api/nav_list.tsx index ba742a39..5ffac14a 100644 --- a/napcat.webui/src/components/onebot/api/nav_list.tsx +++ b/napcat.webui/src/components/onebot/api/nav_list.tsx @@ -19,9 +19,8 @@ const OneBotApiNavList: React.FC = (props) => { return ( = (props) => { animate={{ width: openSideBar ? '16rem' : '0rem' }} style={{ overflowY: openSideBar ? 'auto' : 'hidden' }} > -
+
= (props) => {
+ + diff --git a/napcat.webui/src/components/xterm.tsx b/napcat.webui/src/components/xterm.tsx index 20be082f..9b2b7a5f 100644 --- a/napcat.webui/src/components/xterm.tsx +++ b/napcat.webui/src/components/xterm.tsx @@ -36,7 +36,9 @@ const XTerm = forwardRef>( allowTransparency: true, fontFamily: '"Fira Code", "Harmony", "Noto Serif SC", monospace', cursorInactiveStyle: 'outline', - drawBoldTextInBrightColors: false + drawBoldTextInBrightColors: false, + letterSpacing: 0, + lineHeight: 1.0 }) terminalRef.current = terminal const fitAddon = new FitAddon() @@ -51,10 +53,6 @@ const XTerm = forwardRef>( terminal.loadAddon(new WebglAddon()) terminal.open(domRef.current) - setTimeout(() => { - fitAddon.fit() - }, 0) - terminal.writeln( gradientText( 'Welcome to NapCat WebUI', @@ -69,16 +67,16 @@ const XTerm = forwardRef>( const resizeObserver = new ResizeObserver(() => { fitAddon.fit() }) - resizeObserver.observe(domRef.current) - const handleFontLoad = () => { - terminal.refresh(0, terminal.rows - 1) - } - document.fonts.addEventListener('loadingdone', handleFontLoad) + // 字体加载完成后重新调整终端大小 + document.fonts.ready.then(() => { + fitAddon.fit() + + resizeObserver.observe(domRef.current!) + }) return () => { resizeObserver.disconnect() - document.fonts.removeEventListener('loadingdone', handleFontLoad) setTimeout(() => { terminal.dispose() }, 0) diff --git a/napcat.webui/src/layouts/default.tsx b/napcat.webui/src/layouts/default.tsx index 622c381d..b4146d0f 100644 --- a/napcat.webui/src/layouts/default.tsx +++ b/napcat.webui/src/layouts/default.tsx @@ -2,7 +2,7 @@ import { BreadcrumbItem, Breadcrumbs } from '@heroui/breadcrumbs' import { Button } from '@heroui/button' import { useLocalStorage } from '@uidotdev/usehooks' import clsx from 'clsx' -import { motion } from 'motion/react' +import { AnimatePresence, motion } from 'motion/react' import { useEffect, useMemo, useRef } from 'react' import { ErrorBoundary } from 'react-error-boundary' import { MdMenu, MdMenuOpen } from 'react-icons/md' @@ -79,7 +79,7 @@ const Layout: React.FC<{ children: React.ReactNode }> = ({ children }) => { }, [location.pathname]) return (
= ({ children }) => {
-
+
= ({ children }) => { {title?.map((item, index) => ( - {item} + + + + {item} + + + ))}
diff --git a/napcat.webui/src/pages/dashboard/debug/http/index.tsx b/napcat.webui/src/pages/dashboard/debug/http/index.tsx index a9bcbaa7..e47faa84 100644 --- a/napcat.webui/src/pages/dashboard/debug/http/index.tsx +++ b/napcat.webui/src/pages/dashboard/debug/http/index.tsx @@ -27,41 +27,36 @@ export default function HttpDebug() { return ( <> HTTP调试 - NapCat WebUI -
- -
+
+ - setOpenSideBar(!openSideBar)} > - - - -
+ + + +
) diff --git a/napcat.webui/src/pages/dashboard/debug/websocket/index.tsx b/napcat.webui/src/pages/dashboard/debug/websocket/index.tsx index 6bd4da5e..d68b1a32 100644 --- a/napcat.webui/src/pages/dashboard/debug/websocket/index.tsx +++ b/napcat.webui/src/pages/dashboard/debug/websocket/index.tsx @@ -7,7 +7,6 @@ import toast from 'react-hot-toast' import key from '@/const/key' -import ChatInputModal from '@/components/chat_input/modal' import OneBotMessageList from '@/components/onebot/message_list' import OneBotSendModal from '@/components/onebot/send_modal' import WSStatus from '@/components/onebot/ws_status' @@ -82,7 +81,6 @@ export default function WSDebug() { {FilterMessagesType}
-
diff --git a/napcat.webui/src/pages/index.tsx b/napcat.webui/src/pages/index.tsx index e6a8bcb2..7fe42c6c 100644 --- a/napcat.webui/src/pages/index.tsx +++ b/napcat.webui/src/pages/index.tsx @@ -1,4 +1,5 @@ -import { Route, Routes } from 'react-router-dom' +import { AnimatePresence, motion } from 'motion/react' +import { Route, Routes, useLocation } from 'react-router-dom' import DefaultLayout from '@/layouts/default' @@ -12,19 +13,30 @@ import LogsPage from './dashboard/logs' import NetworkPage from './dashboard/network' export default function IndexPage() { + const location = useLocation() return ( - - } path="/" /> - } path="/network" /> - } path="/config" /> - } path="/logs" /> - } path="/debug"> - } /> - } /> - - } path="/about" /> - + + + + } path="/" /> + } path="/network" /> + } path="/config" /> + } path="/logs" /> + } path="/debug"> + } /> + } /> + + } path="/about" /> + + + ) } diff --git a/napcat.webui/src/styles/globals.css b/napcat.webui/src/styles/globals.css index 875d2a02..bd8231bc 100644 --- a/napcat.webui/src/styles/globals.css +++ b/napcat.webui/src/styles/globals.css @@ -44,6 +44,7 @@ body { -moz-border-radius: 2em; border-radius: 2em; } + .monaco-editor { outline: none !important; border-radius: 5px !important; @@ -75,6 +76,10 @@ body { border-radius: 5px !important; } +.context-view.monaco-menu-container * { + font-family: PingFang SC,"Harmony",Helvetica Neue,Microsoft YaHei,sans-serif !important; +} + .ql-hidden { @apply hidden; }