mirror of
https://github.com/lencx/ChatGPT.git
synced 2024-10-01 01:06:13 -04:00
chore: style
This commit is contained in:
parent
d982a09870
commit
9f3c72ec6d
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@ -57,8 +57,8 @@ jobs:
|
|||||||
- name: Install app dependencies and build it
|
- name: Install app dependencies and build it
|
||||||
run: yarn && yarn build:fe
|
run: yarn && yarn build:fe
|
||||||
|
|
||||||
- name: Rewrite tauri.conf.json
|
# - name: Rewrite tauri.conf.json
|
||||||
run: yarn fix:conf
|
# run: yarn fix:conf
|
||||||
|
|
||||||
- name: fix tray icon
|
- name: fix tray icon
|
||||||
if: matrix.platform != 'macos-latest'
|
if: matrix.platform != 'macos-latest'
|
||||||
|
@ -103,14 +103,13 @@ pub fn init() -> Menu {
|
|||||||
update_silent.selected()
|
update_silent.selected()
|
||||||
} else {
|
} else {
|
||||||
update_silent
|
update_silent
|
||||||
})
|
}), // .add_item(if chat_conf.auto_update == "Disable" {
|
||||||
// .add_item(if chat_conf.auto_update == "Disable" {
|
// update_disable.selected()
|
||||||
// update_disable.selected()
|
// } else {
|
||||||
// } else {
|
// update_disable
|
||||||
// update_disable
|
// })
|
||||||
// })
|
)
|
||||||
,
|
.into(),
|
||||||
).into(),
|
|
||||||
stay_on_top_menu.into(),
|
stay_on_top_menu.into(),
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
titlebar_menu.into(),
|
titlebar_menu.into(),
|
||||||
@ -273,22 +272,31 @@ pub fn menu_handler(event: WindowMenuEvent<tauri::Wry>) {
|
|||||||
ChatConfJson::amend(&serde_json::json!({ "theme": theme }), Some(app)).unwrap();
|
ChatConfJson::amend(&serde_json::json!({ "theme": theme }), Some(app)).unwrap();
|
||||||
}
|
}
|
||||||
"update_prompt" | "update_silent" | "update_disable" => {
|
"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();
|
menu_handle.get_item(id).set_selected(false).unwrap();
|
||||||
}
|
}
|
||||||
let auto_update = match menu_id {
|
let auto_update = match menu_id {
|
||||||
"update_silent" => {
|
"update_silent" => {
|
||||||
menu_handle.get_item("update_silent").set_selected(true).unwrap();
|
menu_handle
|
||||||
|
.get_item("update_silent")
|
||||||
|
.set_selected(true)
|
||||||
|
.unwrap();
|
||||||
"Silent"
|
"Silent"
|
||||||
},
|
}
|
||||||
"update_disable" => {
|
"update_disable" => {
|
||||||
menu_handle.get_item("update_disable").set_selected(true).unwrap();
|
menu_handle
|
||||||
|
.get_item("update_disable")
|
||||||
|
.set_selected(true)
|
||||||
|
.unwrap();
|
||||||
"Disable"
|
"Disable"
|
||||||
},
|
}
|
||||||
_ => {
|
_ => {
|
||||||
menu_handle.get_item("update_prompt").set_selected(true).unwrap();
|
menu_handle
|
||||||
|
.get_item("update_prompt")
|
||||||
|
.set_selected(true)
|
||||||
|
.unwrap();
|
||||||
"Prompt"
|
"Prompt"
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
ChatConfJson::amend(&serde_json::json!({ "auto_update": auto_update }), None).unwrap();
|
ChatConfJson::amend(&serde_json::json!({ "auto_update": auto_update }), None).unwrap();
|
||||||
}
|
}
|
||||||
|
16
src/layout/index.scss
vendored
16
src/layout/index.scss
vendored
@ -1,16 +1,23 @@
|
|||||||
.chat-logo {
|
.chat-logo {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 5px 0;
|
height: 48px;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 48px;
|
width: 44px;
|
||||||
height: 48px;
|
height: 44px;
|
||||||
|
margin-top: 4px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-info {
|
.chat-info {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
||||||
|
.ant-tag {
|
||||||
|
margin: 2px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-layout-sider-trigger {
|
.ant-layout-sider-trigger {
|
||||||
user-select: none;
|
user-select: none;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
@ -24,9 +31,6 @@
|
|||||||
.ant-menu {
|
.ant-menu {
|
||||||
user-select: none;
|
user-select: none;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
.ant-menu-item {
|
|
||||||
background-color: #f8f8f8;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-layout-footer {
|
.ant-layout-footer {
|
||||||
|
28
src/layout/index.tsx
vendored
28
src/layout/index.tsx
vendored
@ -1,5 +1,5 @@
|
|||||||
import { FC, useState } from 'react';
|
import { useState } from 'react';
|
||||||
import {Layout, Menu, Button, Tooltip, message, ConfigProvider, theme, Tag} from 'antd';
|
import {Layout, Menu, Tooltip, ConfigProvider, theme, Tag } from 'antd';
|
||||||
import { SyncOutlined } from '@ant-design/icons';
|
import { SyncOutlined } from '@ant-design/icons';
|
||||||
import { useNavigate, useLocation } from 'react-router-dom';
|
import { useNavigate, useLocation } from 'react-router-dom';
|
||||||
import { getName, getVersion } from '@tauri-apps/api/app';
|
import { getName, getVersion } from '@tauri-apps/api/app';
|
||||||
@ -13,25 +13,21 @@ const { Content, Footer, Sider } = Layout;
|
|||||||
const appName = await getName();
|
const appName = await getName();
|
||||||
const appVersion = await getVersion();
|
const appVersion = await getVersion();
|
||||||
const appTheme = await invoke("get_theme");
|
const appTheme = await invoke("get_theme");
|
||||||
console.log("theme:"+appTheme);
|
|
||||||
interface ChatLayoutProps {
|
|
||||||
children?: React.ReactNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
const ChatLayout: FC<ChatLayoutProps> = ({ children }) => {
|
export default function ChatLayout() {
|
||||||
const [collapsed, setCollapsed] = useState(false);
|
const [collapsed, setCollapsed] = useState(false);
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const go = useNavigate();
|
const go = useNavigate();
|
||||||
|
|
||||||
const checkAppUpdate = async () => {
|
const checkAppUpdate = async () => {
|
||||||
await invoke('run_check_update', {silent: false});
|
await invoke('run_check_update', { silent: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ConfigProvider theme={{algorithm: appTheme === "dark" ? theme.darkAlgorithm : theme.defaultAlgorithm}}>
|
<ConfigProvider theme={{algorithm: appTheme === "dark" ? theme.darkAlgorithm : theme.defaultAlgorithm}}>
|
||||||
<Layout style={{ minHeight: '100vh' }} hasSider>
|
<Layout style={{ minHeight: '100vh' }} hasSider>
|
||||||
<Sider
|
<Sider
|
||||||
theme={ appTheme === "dark" ? "dark" : "light" }
|
theme={appTheme === "dark" ? "dark" : "light"}
|
||||||
collapsible
|
collapsible
|
||||||
collapsed={collapsed}
|
collapsed={collapsed}
|
||||||
onCollapse={(value) => setCollapsed(value)}
|
onCollapse={(value) => setCollapsed(value)}
|
||||||
@ -47,19 +43,13 @@ const ChatLayout: FC<ChatLayoutProps> = ({ children }) => {
|
|||||||
>
|
>
|
||||||
<div className="chat-logo"><img src="/logo.png" /></div>
|
<div className="chat-logo"><img src="/logo.png" /></div>
|
||||||
<div className="chat-info">
|
<div className="chat-info">
|
||||||
<Tag>{appName}</Tag>
|
<Tag>{appName}</Tag>
|
||||||
</div>
|
|
||||||
<div className="chat-info">
|
|
||||||
<Tag>
|
<Tag>
|
||||||
<span>{appVersion}</span>
|
<span style={{ marginRight: 5 }}>{appVersion}</span>
|
||||||
<span> </span>
|
|
||||||
{
|
|
||||||
<Tooltip title="click to check update">
|
<Tooltip title="click to check update">
|
||||||
<a onClick={checkAppUpdate}><SyncOutlined /></a>
|
<a onClick={checkAppUpdate}><SyncOutlined /></a>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
}
|
|
||||||
</Tag>
|
</Tag>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Menu
|
<Menu
|
||||||
@ -87,6 +77,4 @@ const ChatLayout: FC<ChatLayoutProps> = ({ children }) => {
|
|||||||
</Layout>
|
</Layout>
|
||||||
</ConfigProvider>
|
</ConfigProvider>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ChatLayout;
|
|
2
src/main.scss
vendored
2
src/main.scss
vendored
@ -63,7 +63,7 @@ html, body {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
color: #2a2a2a;
|
// color: #2a2a2a;
|
||||||
}
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
|
24
src/view/General.tsx
vendored
24
src/view/General.tsx
vendored
@ -114,20 +114,23 @@ export default function General() {
|
|||||||
labelCol={{ span: 8 }}
|
labelCol={{ span: 8 }}
|
||||||
wrapperCol={{ span: 15, offset: 1 }}
|
wrapperCol={{ span: 15, offset: 1 }}
|
||||||
>
|
>
|
||||||
|
<Form.Item label="Stay On Top" name="stay_on_top" valuePropName="checked">
|
||||||
|
<Switch />
|
||||||
|
</Form.Item>
|
||||||
|
{platformInfo === 'darwin' && (
|
||||||
|
<Form.Item label="Titlebar" name="titlebar" valuePropName="checked">
|
||||||
|
<Switch />
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
<Form.Item label="Theme" name="theme">
|
<Form.Item label="Theme" name="theme">
|
||||||
<Radio.Group>
|
<Radio.Group>
|
||||||
<Radio value="Light">Light</Radio>
|
<Radio value="Light">Light</Radio>
|
||||||
<Radio value="Dark">Dark</Radio>
|
<Radio value="Dark">Dark</Radio>
|
||||||
{
|
{["darwin", "windows"].includes(platformInfo) && (
|
||||||
(["darwin", "windows"].includes(platformInfo) ) && (
|
<Radio value="System">System</Radio>
|
||||||
<Radio value="System">System</Radio>
|
)}
|
||||||
)
|
|
||||||
}
|
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="Stay On Top" name="stay_on_top" valuePropName="checked">
|
|
||||||
<Switch />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item label={<AutoUpdateLabel />} name="auto_update">
|
<Form.Item label={<AutoUpdateLabel />} name="auto_update">
|
||||||
<Radio.Group>
|
<Radio.Group>
|
||||||
<Radio value="Prompt">Prompt</Radio>
|
<Radio value="Prompt">Prompt</Radio>
|
||||||
@ -138,11 +141,6 @@ export default function General() {
|
|||||||
<Form.Item label={<GlobalShortcut />} name="global_shortcut">
|
<Form.Item label={<GlobalShortcut />} name="global_shortcut">
|
||||||
<Input placeholder="CmdOrCtrl+Shift+O" {...DISABLE_AUTO_COMPLETE} />
|
<Input placeholder="CmdOrCtrl+Shift+O" {...DISABLE_AUTO_COMPLETE} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{platformInfo === 'darwin' && (
|
|
||||||
<Form.Item label="Titlebar" name="titlebar" valuePropName="checked">
|
|
||||||
<Switch />
|
|
||||||
</Form.Item>
|
|
||||||
)}
|
|
||||||
<Form.Item label={<OriginLabel url={chatConf?.default_origin} />} name="origin">
|
<Form.Item label={<OriginLabel url={chatConf?.default_origin} />} name="origin">
|
||||||
<Input placeholder="https://chat.openai.com" {...DISABLE_AUTO_COMPLETE} />
|
<Input placeholder="https://chat.openai.com" {...DISABLE_AUTO_COMPLETE} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
Loading…
Reference in New Issue
Block a user