From 9f3c72ec6d4f1d46f50ee74b77ddff85710ab5ab Mon Sep 17 00:00:00 2001 From: lencx Date: Thu, 5 Jan 2023 13:18:35 +0800 Subject: [PATCH] chore: style --- .github/workflows/release.yml | 4 ++-- src-tauri/src/app/menu.rs | 38 +++++++++++++++++++++-------------- src/layout/index.scss | 16 +++++++++------ src/layout/index.tsx | 28 ++++++++------------------ src/main.scss | 2 +- src/view/General.tsx | 24 ++++++++++------------ 6 files changed, 55 insertions(+), 57 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7157e56..ce843c4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,8 +57,8 @@ jobs: - name: Install app dependencies and build it run: yarn && yarn build:fe - - name: Rewrite tauri.conf.json - run: yarn fix:conf + # - name: Rewrite tauri.conf.json + # run: yarn fix:conf - name: fix tray icon if: matrix.platform != 'macos-latest' diff --git a/src-tauri/src/app/menu.rs b/src-tauri/src/app/menu.rs index b5ef78d..f39d295 100644 --- a/src-tauri/src/app/menu.rs +++ b/src-tauri/src/app/menu.rs @@ -103,14 +103,13 @@ pub fn init() -> Menu { update_silent.selected() } else { update_silent - }) - // .add_item(if chat_conf.auto_update == "Disable" { - // update_disable.selected() - // } else { - // update_disable - // }) - , - ).into(), + }), // .add_item(if chat_conf.auto_update == "Disable" { + // update_disable.selected() + // } else { + // update_disable + // }) + ) + .into(), stay_on_top_menu.into(), #[cfg(target_os = "macos")] titlebar_menu.into(), @@ -273,22 +272,31 @@ pub fn menu_handler(event: WindowMenuEvent) { ChatConfJson::amend(&serde_json::json!({ "theme": theme }), Some(app)).unwrap(); } "update_prompt" | "update_silent" | "update_disable" => { - for id in ["update_prompt" , "update_silent" , "update_disable"] { + for id in ["update_prompt", "update_silent", "update_disable"] { menu_handle.get_item(id).set_selected(false).unwrap(); } let auto_update = match menu_id { "update_silent" => { - menu_handle.get_item("update_silent").set_selected(true).unwrap(); + menu_handle + .get_item("update_silent") + .set_selected(true) + .unwrap(); "Silent" - }, + } "update_disable" => { - menu_handle.get_item("update_disable").set_selected(true).unwrap(); + menu_handle + .get_item("update_disable") + .set_selected(true) + .unwrap(); "Disable" - }, + } _ => { - menu_handle.get_item("update_prompt").set_selected(true).unwrap(); + menu_handle + .get_item("update_prompt") + .set_selected(true) + .unwrap(); "Prompt" - }, + } }; ChatConfJson::amend(&serde_json::json!({ "auto_update": auto_update }), None).unwrap(); } diff --git a/src/layout/index.scss b/src/layout/index.scss index 00ef8bf..07d5cf5 100644 --- a/src/layout/index.scss +++ b/src/layout/index.scss @@ -1,16 +1,23 @@ .chat-logo { text-align: center; - padding: 5px 0; + height: 48px; img { - width: 48px; - height: 48px; + width: 44px; + height: 44px; + margin-top: 4px; } } + .chat-info { text-align: center; font-weight: bold; + + .ant-tag { + margin: 2px; + } } + .ant-layout-sider-trigger { user-select: none; -webkit-user-select: none; @@ -24,9 +31,6 @@ .ant-menu { user-select: none; -webkit-user-select: none; - .ant-menu-item { - background-color: #f8f8f8; - } } .ant-layout-footer { diff --git a/src/layout/index.tsx b/src/layout/index.tsx index 06ab0ad..99f70d4 100644 --- a/src/layout/index.tsx +++ b/src/layout/index.tsx @@ -1,5 +1,5 @@ -import { FC, useState } from 'react'; -import {Layout, Menu, Button, Tooltip, message, ConfigProvider, theme, Tag} from 'antd'; +import { 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'; import { getName, getVersion } from '@tauri-apps/api/app'; @@ -13,25 +13,21 @@ const { Content, Footer, Sider } = Layout; const appName = await getName(); const appVersion = await getVersion(); const appTheme = await invoke("get_theme"); -console.log("theme:"+appTheme); -interface ChatLayoutProps { - children?: React.ReactNode; -} -const ChatLayout: FC = ({ children }) => { +export default function ChatLayout() { const [collapsed, setCollapsed] = useState(false); const location = useLocation(); const go = useNavigate(); const checkAppUpdate = async () => { - await invoke('run_check_update', {silent: false}); + await invoke('run_check_update', { silent: false }); } return ( setCollapsed(value)} @@ -47,19 +43,13 @@ const ChatLayout: FC = ({ children }) => { >
- {appName} -
-
+ {appName} - {appVersion} - - { + {appVersion} - } -
= ({ children }) => { ); -}; - -export default ChatLayout; \ No newline at end of file +}; \ No newline at end of file diff --git a/src/main.scss b/src/main.scss index 96ebea4..afba087 100644 --- a/src/main.scss +++ b/src/main.scss @@ -63,7 +63,7 @@ html, body { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - color: #2a2a2a; + // color: #2a2a2a; } span { diff --git a/src/view/General.tsx b/src/view/General.tsx index 1291baf..ce4416e 100644 --- a/src/view/General.tsx +++ b/src/view/General.tsx @@ -114,20 +114,23 @@ export default function General() { labelCol={{ span: 8 }} wrapperCol={{ span: 15, offset: 1 }} > + + + + {platformInfo === 'darwin' && ( + + + + )} Light Dark - { - (["darwin", "windows"].includes(platformInfo) ) && ( - System - ) - } + {["darwin", "windows"].includes(platformInfo) && ( + System + )} - - - } name="auto_update"> Prompt @@ -138,11 +141,6 @@ export default function General() { } name="global_shortcut"> - {platformInfo === 'darwin' && ( - - - - )} } name="origin">