From d5df706b47d7cdff2c7409976992995bee7f86a9 Mon Sep 17 00:00:00 2001 From: lencx Date: Mon, 23 Jan 2023 10:56:07 +0800 Subject: [PATCH] chore: settings --- src/components/SwitchOrigin/index.tsx | 27 ++++++++++++++++++------ src/layout/index.scss | 4 ++++ src/layout/index.tsx | 9 ++++++-- src/main.scss | 1 - src/view/model/SyncCustom/index.tsx | 7 ++++++- src/view/settings/TrayWindow.tsx | 18 ++++++++++++++-- src/view/settings/index.tsx | 30 ++++++++++++++++++++------- 7 files changed, 76 insertions(+), 20 deletions(-) diff --git a/src/components/SwitchOrigin/index.tsx b/src/components/SwitchOrigin/index.tsx index 70cf883d0..16e6dee88 100644 --- a/src/components/SwitchOrigin/index.tsx +++ b/src/components/SwitchOrigin/index.tsx @@ -1,9 +1,10 @@ import { FC } from 'react'; -import { Form, Select, Tag } from 'antd'; +import { Link } from 'react-router-dom'; +import { Form, Select, Tag, Tooltip } from 'antd'; +import { QuestionCircleOutlined } from '@ant-design/icons'; import useJson from '@/hooks/useJson'; -import { DISABLE_AUTO_COMPLETE, CHAT_CONF_JSON, CHAT_AWESOME_JSON } from '@/utils'; - +import { DISABLE_AUTO_COMPLETE, CHAT_AWESOME_JSON } from '@/utils'; interface SwitchOriginProps { name: string; } @@ -13,13 +14,27 @@ const SwitchOrigin: FC = ({ name }) => { return ( Switch Origin ({name === 'origin' ? 'Main' : 'SystemTray'})} + label={ + + Switch Origin ({name === 'origin' ? 'Main' : 'SystemTray'}){' '} + + If you need to set a new URL as the application loading window, please add the URL + in the Awesome menu and then select it. + + } + > + + + + } name={name} > diff --git a/src/layout/index.scss b/src/layout/index.scss index a908db5f0..df8c0690a 100644 --- a/src/layout/index.scss +++ b/src/layout/index.scss @@ -23,6 +23,10 @@ -webkit-user-select: none; } +.ant-layout-sider-children { + overflow-y: auto; +} + .chat-container { padding: 20px; overflow: hidden; diff --git a/src/layout/index.tsx b/src/layout/index.tsx index eb027ba75..d6fcd9762 100644 --- a/src/layout/index.tsx +++ b/src/layout/index.tsx @@ -1,4 +1,4 @@ -import { useState } from 'react'; +import { useEffect, useState } from 'react'; import { Layout, Menu, Tooltip, ConfigProvider, theme, Tag } from 'antd'; import { SyncOutlined } from '@ant-design/icons'; import { useNavigate, useLocation } from 'react-router-dom'; @@ -15,8 +15,13 @@ export default function ChatLayout() { const [collapsed, setCollapsed] = useState(false); const [appInfo, setAppInfo] = useState>({}); const location = useLocation(); + const [menuKey, setMenuKey] = useState(location.pathname); const go = useNavigate(); + useEffect(() => { + setMenuKey(location.pathname); + }, [location.pathname]); + useInit(async () => { setAppInfo({ appName: await getName(), @@ -65,7 +70,7 @@ export default function ChatLayout() { - { + return ( + + User Agent (SystemTray){' '} + For a better experience, we recommend using the Mobile User-Agent.} + > + + + + ); +}; + export default function General() { return ( <> @@ -10,7 +24,7 @@ export default function General() { - + } name="ua_tray"> (null); + const [filePath, setPath] = useState(''); useInit(async () => { - const chatData = await invoke('get_chat_conf'); - setChatConf(chatData); + setChatConf(await invoke('get_chat_conf')); + setPath(await path.join(await chatRoot(), CHAT_CONF_JSON)); }); useEffect(() => { @@ -78,9 +79,22 @@ export default function Settings() { - + + Are you sure you want to reset the configuration file + shell.open(filePath)} style={{ margin: '0 5px' }}> + {filePath} + + to the default? + + } + onConfirm={onReset} + okText="Yes" + cancelText="No" + > + +