mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
chore: dashboard
This commit is contained in:
@@ -235,7 +235,7 @@ pub fn menu_handler(event: WindowMenuEvent<tauri::Wry>) {
|
|||||||
utils::run_check_update(app, false, None);
|
utils::run_check_update(app, false, None);
|
||||||
}
|
}
|
||||||
// Preferences
|
// Preferences
|
||||||
"control_center" => window::control_window(&app),
|
"control_center" => window::control_window(app.clone()),
|
||||||
"restart" => tauri::api::process::restart(&app.env()),
|
"restart" => tauri::api::process::restart(&app.env()),
|
||||||
"inject_script" => open(&app, script_path),
|
"inject_script" => open(&app, script_path),
|
||||||
"go_conf" => utils::open_file(utils::chat_root()),
|
"go_conf" => utils::open_file(utils::chat_root()),
|
||||||
@@ -431,7 +431,7 @@ pub fn tray_handler(handle: &AppHandle, event: SystemTrayEvent) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
SystemTrayEvent::MenuItemClick { id, .. } => match id.as_str() {
|
SystemTrayEvent::MenuItemClick { id, .. } => match id.as_str() {
|
||||||
"control_center" => window::control_window(&app),
|
"control_center" => window::control_window(app),
|
||||||
"restart" => tauri::api::process::restart(&handle.env()),
|
"restart" => tauri::api::process::restart(&handle.env()),
|
||||||
"show_dock_icon" => {
|
"show_dock_icon" => {
|
||||||
ChatConfJson::amend(&serde_json::json!({ "hide_dock_icon": false }), Some(app)).unwrap();
|
ChatConfJson::amend(&serde_json::json!({ "hide_dock_icon": false }), Some(app)).unwrap();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use wry::application::accelerator::Accelerator;
|
|||||||
pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>> {
|
pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>> {
|
||||||
info!("stepup");
|
info!("stepup");
|
||||||
let chat_conf = ChatConfJson::get_chat_conf();
|
let chat_conf = ChatConfJson::get_chat_conf();
|
||||||
let url = chat_conf.origin.to_string();
|
let url = chat_conf.main_origin.to_string();
|
||||||
let theme = ChatConfJson::theme();
|
let theme = ChatConfJson::theme();
|
||||||
let handle = app.app_handle();
|
let handle = app.app_handle();
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
|
|||||||
} else {
|
} else {
|
||||||
let app = app.handle();
|
let app = app.handle();
|
||||||
tauri::async_runtime::spawn(async move {
|
tauri::async_runtime::spawn(async move {
|
||||||
let link = if chat_conf.dashboard {
|
let link = if chat_conf.main_dashboard {
|
||||||
"index.html"
|
"index.html"
|
||||||
} else {
|
} else {
|
||||||
&url
|
&url
|
||||||
@@ -65,7 +65,7 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
|
|||||||
main_win = main_win.hidden_title(true);
|
main_win = main_win.hidden_title(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if url == "https://chat.openai.com" && !chat_conf.dashboard {
|
if url == "https://chat.openai.com" && !chat_conf.main_dashboard {
|
||||||
main_win = main_win
|
main_win = main_win
|
||||||
.initialization_script(include_str!("../vendors/floating-ui-core.js"))
|
.initialization_script(include_str!("../vendors/floating-ui-core.js"))
|
||||||
.initialization_script(include_str!("../vendors/floating-ui-dom.js"))
|
.initialization_script(include_str!("../vendors/floating-ui-dom.js"))
|
||||||
|
|||||||
@@ -93,12 +93,12 @@ pub fn dalle2_window(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn control_window(handle: &tauri::AppHandle) {
|
#[tauri::command]
|
||||||
let app = handle.clone();
|
pub fn control_window(handle: tauri::AppHandle) {
|
||||||
tauri::async_runtime::spawn(async move {
|
tauri::async_runtime::spawn(async move {
|
||||||
if app.app_handle().get_window("main").is_none() {
|
if handle.get_window("main").is_none() {
|
||||||
WindowBuilder::new(
|
WindowBuilder::new(
|
||||||
&app,
|
&handle,
|
||||||
"main",
|
"main",
|
||||||
WindowUrl::App("index.html?type=control".into()),
|
WindowUrl::App("index.html?type=control".into()),
|
||||||
)
|
)
|
||||||
@@ -110,7 +110,7 @@ pub fn control_window(handle: &tauri::AppHandle) {
|
|||||||
.build()
|
.build()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
} else {
|
} else {
|
||||||
let main_win = app.app_handle().get_window("main").unwrap();
|
let main_win = handle.get_window("main").unwrap();
|
||||||
main_win.show().unwrap();
|
main_win.show().unwrap();
|
||||||
main_win.set_focus().unwrap();
|
main_win.set_focus().unwrap();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ pub const BUY_COFFEE: &str = "https://www.buymeacoffee.com/lencx";
|
|||||||
pub const GITHUB_PROMPTS_CSV_URL: &str =
|
pub const GITHUB_PROMPTS_CSV_URL: &str =
|
||||||
"https://raw.githubusercontent.com/f/awesome-chatgpt-prompts/main/prompts.csv";
|
"https://raw.githubusercontent.com/f/awesome-chatgpt-prompts/main/prompts.csv";
|
||||||
pub const DEFAULT_CHAT_CONF: &str = r#"{
|
pub const DEFAULT_CHAT_CONF: &str = r#"{
|
||||||
"dashboard": false,
|
|
||||||
"stay_on_top": false,
|
"stay_on_top": false,
|
||||||
"auto_update": "Prompt",
|
"auto_update": "Prompt",
|
||||||
"theme": "Light",
|
"theme": "Light",
|
||||||
@@ -27,14 +26,15 @@ pub const DEFAULT_CHAT_CONF: &str = r#"{
|
|||||||
"popup_search": false,
|
"popup_search": false,
|
||||||
"global_shortcut": "",
|
"global_shortcut": "",
|
||||||
"hide_dock_icon": false,
|
"hide_dock_icon": false,
|
||||||
"origin": "https://chat.openai.com",
|
"main_dashboard": false,
|
||||||
|
"tray_dashboard": false,
|
||||||
|
"main_origin": "https://chat.openai.com",
|
||||||
"tray_origin": "https://chat.openai.com",
|
"tray_origin": "https://chat.openai.com",
|
||||||
"default_origin": "https://chat.openai.com",
|
"default_origin": "https://chat.openai.com",
|
||||||
"ua_window": "",
|
"ua_window": "",
|
||||||
"ua_tray": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Safari/604.1"
|
"ua_tray": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Safari/604.1"
|
||||||
}"#;
|
}"#;
|
||||||
pub const DEFAULT_CHAT_CONF_MAC: &str = r#"{
|
pub const DEFAULT_CHAT_CONF_MAC: &str = r#"{
|
||||||
"dashboard": false,
|
|
||||||
"stay_on_top": false,
|
"stay_on_top": false,
|
||||||
"auto_update": "Prompt",
|
"auto_update": "Prompt",
|
||||||
"theme": "Light",
|
"theme": "Light",
|
||||||
@@ -43,7 +43,9 @@ pub const DEFAULT_CHAT_CONF_MAC: &str = r#"{
|
|||||||
"popup_search": false,
|
"popup_search": false,
|
||||||
"global_shortcut": "",
|
"global_shortcut": "",
|
||||||
"hide_dock_icon": false,
|
"hide_dock_icon": false,
|
||||||
"origin": "https://chat.openai.com",
|
"main_dashboard": false,
|
||||||
|
"tray_dashboard": false,
|
||||||
|
"main_origin": "https://chat.openai.com",
|
||||||
"tray_origin": "https://chat.openai.com",
|
"tray_origin": "https://chat.openai.com",
|
||||||
"default_origin": "https://chat.openai.com",
|
"default_origin": "https://chat.openai.com",
|
||||||
"ua_window": "",
|
"ua_window": "",
|
||||||
@@ -60,11 +62,12 @@ pub struct ChatConfJson {
|
|||||||
pub theme: String,
|
pub theme: String,
|
||||||
// auto update policy, Prompt/Silent/Disable
|
// auto update policy, Prompt/Silent/Disable
|
||||||
pub auto_update: String,
|
pub auto_update: String,
|
||||||
pub dashboard: bool,
|
|
||||||
pub tray: bool,
|
pub tray: bool,
|
||||||
pub popup_search: bool,
|
pub popup_search: bool,
|
||||||
pub stay_on_top: bool,
|
pub stay_on_top: bool,
|
||||||
pub origin: String,
|
pub main_dashboard: bool,
|
||||||
|
pub tray_dashboard: bool,
|
||||||
|
pub main_origin: String,
|
||||||
pub tray_origin: String,
|
pub tray_origin: String,
|
||||||
pub default_origin: String,
|
pub default_origin: String,
|
||||||
pub ua_window: String,
|
pub ua_window: String,
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ async fn main() {
|
|||||||
fs_extra::metadata,
|
fs_extra::metadata,
|
||||||
window::window_reload,
|
window::window_reload,
|
||||||
window::wa_window,
|
window::wa_window,
|
||||||
|
window::control_window,
|
||||||
])
|
])
|
||||||
.setup(setup::init)
|
.setup(setup::init)
|
||||||
.menu(menu::init());
|
.menu(menu::init());
|
||||||
|
|||||||
102
src/components/SwitchOrigin/index.tsx
vendored
102
src/components/SwitchOrigin/index.tsx
vendored
@@ -1,6 +1,6 @@
|
|||||||
import { FC } from 'react';
|
import { FC } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { Form, Select, Tag, Tooltip } from 'antd';
|
import { Form, Select, Tag, Tooltip, Switch } from 'antd';
|
||||||
import { QuestionCircleOutlined } from '@ant-design/icons';
|
import { QuestionCircleOutlined } from '@ant-design/icons';
|
||||||
|
|
||||||
import useJson from '@/hooks/useJson';
|
import useJson from '@/hooks/useJson';
|
||||||
@@ -11,34 +11,82 @@ interface SwitchOriginProps {
|
|||||||
|
|
||||||
const SwitchOrigin: FC<SwitchOriginProps> = ({ name }) => {
|
const SwitchOrigin: FC<SwitchOriginProps> = ({ name }) => {
|
||||||
const { json: list = [] } = useJson<any[]>(CHAT_AWESOME_JSON);
|
const { json: list = [] } = useJson<any[]>(CHAT_AWESOME_JSON);
|
||||||
|
const form = Form.useFormInstance();
|
||||||
|
|
||||||
|
const labelName = `(${name === 'main' ? 'Main' : 'SystemTray'})`;
|
||||||
|
const dashboardName = `${name}_dashboard`;
|
||||||
|
const originName = `${name}_origin`;
|
||||||
|
const isEnable = Form.useWatch(dashboardName, form);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form.Item
|
<>
|
||||||
label={
|
<Form.Item
|
||||||
<span>
|
label={
|
||||||
Switch Origin ({name === 'origin' ? 'Main' : 'SystemTray'}){' '}
|
<span>
|
||||||
<Tooltip
|
Dashboard {labelName}{' '}
|
||||||
title={
|
<Tooltip
|
||||||
<div>
|
title={
|
||||||
If you need to set a new URL as the application loading window, please add the URL
|
<div>
|
||||||
in the <Link to="/">Awesome</Link> menu and then select it.
|
<p>
|
||||||
</div>
|
<b>Set the URL dashboard as an application window.</b>
|
||||||
}
|
</p>
|
||||||
>
|
<p>
|
||||||
<QuestionCircleOutlined style={{ color: '#1677ff' }} />
|
If this is enabled, the <Tag color="blue">Switch Origin {labelName}</Tag>{' '}
|
||||||
</Tooltip>
|
setting will be invalid.
|
||||||
</span>
|
</p>
|
||||||
}
|
<p>
|
||||||
name={name}
|
If you want to add a new URL to the dashboard, add it in the{' '}
|
||||||
>
|
<Link to="/awesome">Awesome</Link> menu and make sure it is enabled.
|
||||||
<Select showSearch {...DISABLE_AUTO_COMPLETE} optionLabelProp="url">
|
</p>
|
||||||
{[{ title: 'ChatGPT', url: 'https://chat.openai.com' }, ...list].map((i) => (
|
</div>
|
||||||
<Select.Option key={i.url} label={i.title} value={i.url} title={i.url}>
|
}
|
||||||
<Tag color={i.title === 'ChatGPT' ? 'orange' : 'geekblue'}>{i.title}</Tag> {i.url}
|
>
|
||||||
</Select.Option>
|
<QuestionCircleOutlined style={{ color: '#1677ff' }} />
|
||||||
))}
|
</Tooltip>
|
||||||
</Select>
|
</span>
|
||||||
</Form.Item>
|
}
|
||||||
|
name={dashboardName}
|
||||||
|
valuePropName="checked"
|
||||||
|
>
|
||||||
|
<Switch />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={
|
||||||
|
<span>
|
||||||
|
Switch Origin {labelName}{' '}
|
||||||
|
<Tooltip
|
||||||
|
title={
|
||||||
|
<div>
|
||||||
|
<p>
|
||||||
|
<b>Set a single URL as an application window.</b>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
If you need to set a new URL as the application loading window, please add the
|
||||||
|
URL in the <Link to="/awesome">Awesome</Link> menu and then select it.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<QuestionCircleOutlined style={{ color: '#1677ff' }} />
|
||||||
|
</Tooltip>
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
name={originName}
|
||||||
|
>
|
||||||
|
<Select disabled={isEnable} showSearch {...DISABLE_AUTO_COMPLETE} optionLabelProp="url">
|
||||||
|
{[{ title: 'ChatGPT', url: 'https://chat.openai.com' }, ...list].map((i, idx) => (
|
||||||
|
<Select.Option
|
||||||
|
key={`${idx}_${i.url}`}
|
||||||
|
label={i.title}
|
||||||
|
value={i.url}
|
||||||
|
title={`${i.title}: ${i.url}`}
|
||||||
|
>
|
||||||
|
<Tag color={i.title === 'ChatGPT' ? 'orange' : 'geekblue'}>{i.title}</Tag> {i.url}
|
||||||
|
</Select.Option>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
41
src/view/awesome/index.tsx
vendored
41
src/view/awesome/index.tsx
vendored
@@ -34,9 +34,7 @@ export default function Awesome() {
|
|||||||
updateJson(data);
|
updateJson(data);
|
||||||
opInfo.resetRecord();
|
opInfo.resetRecord();
|
||||||
}
|
}
|
||||||
}, [opInfo.opType,
|
}, [opInfo.opType, formRef]);
|
||||||
|
|
||||||
formRef]);
|
|
||||||
|
|
||||||
const hide = () => {
|
const hide = () => {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
@@ -54,18 +52,33 @@ export default function Awesome() {
|
|||||||
|
|
||||||
const handleOk = () => {
|
const handleOk = () => {
|
||||||
formRef.current?.form?.validateFields().then(async (vals: Record<string, any>) => {
|
formRef.current?.form?.validateFields().then(async (vals: Record<string, any>) => {
|
||||||
if (opInfo.opType === 'new') {
|
const idx = opData.findIndex((i) => i.url === vals.url);
|
||||||
const data = opAdd(vals);
|
if (idx === -1) {
|
||||||
await updateJson(data);
|
if (opInfo.opType === 'new') {
|
||||||
opInit(data);
|
const data = opAdd(vals);
|
||||||
message.success('Data added successfully');
|
await updateJson(data);
|
||||||
|
opInit(data);
|
||||||
|
message.success('Data added successfully');
|
||||||
|
}
|
||||||
|
if (opInfo.opType === 'edit') {
|
||||||
|
const data = opReplace(opInfo?.opRecord?.[opSafeKey], vals);
|
||||||
|
await updateJson(data);
|
||||||
|
message.success('Data updated successfully');
|
||||||
|
}
|
||||||
|
hide();
|
||||||
|
} else {
|
||||||
|
const data = opData[idx];
|
||||||
|
message.error(
|
||||||
|
<div style={{ width: 360 }}>
|
||||||
|
<div>
|
||||||
|
<b>
|
||||||
|
{data.title}: {data.url}
|
||||||
|
</b>
|
||||||
|
</div>
|
||||||
|
<div>This URL already exists, please edit it and try again.</div>
|
||||||
|
</div>,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (opInfo.opType === 'edit') {
|
|
||||||
const data = opReplace(opInfo?.opRecord?.[opSafeKey], vals);
|
|
||||||
await updateJson(data);
|
|
||||||
message.success('Data updated successfully');
|
|
||||||
}
|
|
||||||
hide();
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
24
src/view/dashboard/index.scss
vendored
24
src/view/dashboard/index.scss
vendored
@@ -5,6 +5,30 @@
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
|
|
||||||
|
&-no-data {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
text-align: center;
|
||||||
|
flex-direction: column;
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
color: #989898;
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.txt {
|
||||||
|
font-size: 12px;
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #1677ff;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.dark {
|
&.dark {
|
||||||
background-color: #000;
|
background-color: #000;
|
||||||
}
|
}
|
||||||
|
|||||||
21
src/view/dashboard/index.tsx
vendored
21
src/view/dashboard/index.tsx
vendored
@@ -1,6 +1,7 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { Row, Col, Card } from 'antd';
|
import { Row, Col, Card } from 'antd';
|
||||||
|
import { InboxOutlined } from '@ant-design/icons';
|
||||||
import { os, invoke } from '@tauri-apps/api';
|
import { os, invoke } from '@tauri-apps/api';
|
||||||
|
|
||||||
import useInit from '@/hooks/useInit';
|
import useInit from '@/hooks/useInit';
|
||||||
@@ -10,7 +11,7 @@ import './index.scss';
|
|||||||
|
|
||||||
export default function Dashboard() {
|
export default function Dashboard() {
|
||||||
const { json } = useJson<Record<string, any>[]>(CHAT_AWESOME_JSON);
|
const { json } = useJson<Record<string, any>[]>(CHAT_AWESOME_JSON);
|
||||||
const [list, setList] = useState<Array<[string, Record<string, any>[]]>>([]);
|
const [list, setList] = useState<Array<[string, Record<string, any>[]]>>();
|
||||||
const [hasClass, setClass] = useState(false);
|
const [hasClass, setClass] = useState(false);
|
||||||
const [theme, setTheme] = useState('');
|
const [theme, setTheme] = useState('');
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@ export default function Dashboard() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!json) return;
|
||||||
const categories = new Map();
|
const categories = new Map();
|
||||||
|
|
||||||
json?.forEach((i) => {
|
json?.forEach((i) => {
|
||||||
@@ -43,6 +45,23 @@ export default function Dashboard() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!list) return null;
|
||||||
|
if (list?.length === 0) {
|
||||||
|
return (
|
||||||
|
<div className="dashboard-no-data">
|
||||||
|
<div className="icon">
|
||||||
|
<InboxOutlined style={{ fontSize: 80, marginBottom: 5 }} />
|
||||||
|
<br />
|
||||||
|
No data
|
||||||
|
</div>
|
||||||
|
<div className="txt">
|
||||||
|
Go to <a onClick={() => invoke('control_window')}>{'Control Center -> Awesome'}</a> to add
|
||||||
|
data
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={clsx('dashboard', theme, { 'has-top-dom': hasClass })}>
|
<div className={clsx('dashboard', theme, { 'has-top-dom': hasClass })}>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
89
src/view/settings/General.tsx
vendored
89
src/view/settings/General.tsx
vendored
@@ -6,6 +6,49 @@ import { platform } from '@tauri-apps/api/os';
|
|||||||
import useInit from '@/hooks/useInit';
|
import useInit from '@/hooks/useInit';
|
||||||
import { DISABLE_AUTO_COMPLETE } from '@/utils';
|
import { DISABLE_AUTO_COMPLETE } from '@/utils';
|
||||||
|
|
||||||
|
export default function General() {
|
||||||
|
const [platformInfo, setPlatform] = useState('');
|
||||||
|
|
||||||
|
useInit(async () => {
|
||||||
|
setPlatform(await platform());
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<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>
|
||||||
|
)}
|
||||||
|
{platformInfo === 'darwin' && (
|
||||||
|
<Form.Item label="Hide Dock Icon" name="hide_dock_icon" valuePropName="checked">
|
||||||
|
<Switch />
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
|
<Form.Item label="Theme" name="theme">
|
||||||
|
<Radio.Group>
|
||||||
|
<Radio value="Light">Light</Radio>
|
||||||
|
<Radio value="Dark">Dark</Radio>
|
||||||
|
{['darwin', 'windows'].includes(platformInfo) && <Radio value="System">System</Radio>}
|
||||||
|
</Radio.Group>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={<AutoUpdateLabel />} name="auto_update">
|
||||||
|
<Radio.Group>
|
||||||
|
<Radio value="Prompt">Prompt</Radio>
|
||||||
|
<Radio value="Silent">Silent</Radio>
|
||||||
|
{/*<Radio value="Disable">Disable</Radio>*/}
|
||||||
|
</Radio.Group>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={<GlobalShortcutLabel />} name="global_shortcut">
|
||||||
|
<Input placeholder="CmdOrCtrl+Shift+O" {...DISABLE_AUTO_COMPLETE} />
|
||||||
|
</Form.Item>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const AutoUpdateLabel = () => {
|
const AutoUpdateLabel = () => {
|
||||||
return (
|
return (
|
||||||
<span>
|
<span>
|
||||||
@@ -50,49 +93,3 @@ const GlobalShortcutLabel = () => {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function General() {
|
|
||||||
const [platformInfo, setPlatform] = useState('');
|
|
||||||
|
|
||||||
useInit(async () => {
|
|
||||||
setPlatform(await platform());
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Form.Item label="Dashboard" name="dashboard" valuePropName="checked">
|
|
||||||
<Switch />
|
|
||||||
</Form.Item>
|
|
||||||
<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>
|
|
||||||
)}
|
|
||||||
{platformInfo === 'darwin' && (
|
|
||||||
<Form.Item label="Hide Dock Icon" name="hide_dock_icon" valuePropName="checked">
|
|
||||||
<Switch />
|
|
||||||
</Form.Item>
|
|
||||||
)}
|
|
||||||
<Form.Item label="Theme" name="theme">
|
|
||||||
<Radio.Group>
|
|
||||||
<Radio value="Light">Light</Radio>
|
|
||||||
<Radio value="Dark">Dark</Radio>
|
|
||||||
{['darwin', 'windows'].includes(platformInfo) && <Radio value="System">System</Radio>}
|
|
||||||
</Radio.Group>
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item label={<AutoUpdateLabel />} name="auto_update">
|
|
||||||
<Radio.Group>
|
|
||||||
<Radio value="Prompt">Prompt</Radio>
|
|
||||||
<Radio value="Silent">Silent</Radio>
|
|
||||||
{/*<Radio value="Disable">Disable</Radio>*/}
|
|
||||||
</Radio.Group>
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item label={<GlobalShortcutLabel />} name="global_shortcut">
|
|
||||||
<Input placeholder="CmdOrCtrl+Shift+O" {...DISABLE_AUTO_COMPLETE} />
|
|
||||||
</Form.Item>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|||||||
2
src/view/settings/MainWindow.tsx
vendored
2
src/view/settings/MainWindow.tsx
vendored
@@ -36,7 +36,7 @@ export default function General() {
|
|||||||
<Form.Item label={<PopupSearchLabel />} name="popup_search" valuePropName="checked">
|
<Form.Item label={<PopupSearchLabel />} name="popup_search" valuePropName="checked">
|
||||||
<Switch />
|
<Switch />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<SwitchOrigin name="origin" />
|
<SwitchOrigin name="main" />
|
||||||
<Form.Item label="User Agent (Main)" name="ua_window">
|
<Form.Item label="User Agent (Main)" name="ua_window">
|
||||||
<Input.TextArea
|
<Input.TextArea
|
||||||
autoSize={{ minRows: 4, maxRows: 4 }}
|
autoSize={{ minRows: 4, maxRows: 4 }}
|
||||||
|
|||||||
2
src/view/settings/TrayWindow.tsx
vendored
2
src/view/settings/TrayWindow.tsx
vendored
@@ -23,7 +23,7 @@ export default function General() {
|
|||||||
<Form.Item label="Enable SystemTray" name="tray" valuePropName="checked">
|
<Form.Item label="Enable SystemTray" name="tray" valuePropName="checked">
|
||||||
<Switch />
|
<Switch />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<SwitchOrigin name="tray_origin" />
|
<SwitchOrigin name="tray" />
|
||||||
<Form.Item label={<UALabel />} name="ua_tray">
|
<Form.Item label={<UALabel />} name="ua_tray">
|
||||||
<Input.TextArea
|
<Input.TextArea
|
||||||
autoSize={{ minRows: 4, maxRows: 4 }}
|
autoSize={{ minRows: 4, maxRows: 4 }}
|
||||||
|
|||||||
Reference in New Issue
Block a user