chore: add pretty

This commit is contained in:
lencx
2023-01-22 18:18:36 +08:00
parent 1ba356a91f
commit bc39dcdd72
56 changed files with 776 additions and 535 deletions

View File

@@ -9,37 +9,47 @@ import { DISABLE_AUTO_COMPLETE } from '@/utils';
const AutoUpdateLabel = () => {
return (
<span>
Auto Update
{' '}
<Tooltip title={(
<div>
<div>Auto Update Policy</div>
<div><strong>Prompt</strong>: prompt to install</div>
<div><strong>Silent</strong>: install silently</div>
{/* <div><strong>Disable</strong>: disable auto update</div> */}
</div>
)}><QuestionCircleOutlined style={{ color: '#1677ff' }} /></Tooltip>
Auto Update{' '}
<Tooltip
title={
<div>
<div>Auto Update Policy</div>
<div>
<strong>Prompt</strong>: prompt to install
</div>
<div>
<strong>Silent</strong>: install silently
</div>
{/* <div><strong>Disable</strong>: disable auto update</div> */}
</div>
}
>
<QuestionCircleOutlined style={{ color: '#1677ff' }} />
</Tooltip>
</span>
)
}
);
};
const GlobalShortcutLabel = () => {
return (
<div>
Global Shortcut
{' '}
<Tooltip title={(
<div>
<div>Shortcut definition, modifiers and key separated by "+" e.g. CmdOrControl+Q</div>
<div style={{ margin: '10px 0'}}>If empty, the shortcut is disabled.</div>
<a href="https://tauri.app/v1/api/js/globalshortcut" target="_blank">https://tauri.app/v1/api/js/globalshortcut</a>
</div>
)}>
Global Shortcut{' '}
<Tooltip
title={
<div>
<div>Shortcut definition, modifiers and key separated by "+" e.g. CmdOrControl+Q</div>
<div style={{ margin: '10px 0' }}>If empty, the shortcut is disabled.</div>
<a href="https://tauri.app/v1/api/js/globalshortcut" target="_blank">
https://tauri.app/v1/api/js/globalshortcut
</a>
</div>
}
>
<QuestionCircleOutlined style={{ color: '#1677ff' }} />
</Tooltip>
</div>
)
}
);
};
export default function General() {
const [platformInfo, setPlatform] = useState('');
@@ -62,9 +72,7 @@ export default function General() {
<Radio.Group>
<Radio value="Light">Light</Radio>
<Radio value="Dark">Dark</Radio>
{["darwin", "windows"].includes(platformInfo) && (
<Radio value="System">System</Radio>
)}
{['darwin', 'windows'].includes(platformInfo) && <Radio value="System">System</Radio>}
</Radio.Group>
</Form.Item>
<Form.Item label={<AutoUpdateLabel />} name="auto_update">
@@ -78,5 +86,5 @@ export default function General() {
<Input placeholder="CmdOrCtrl+Shift+O" {...DISABLE_AUTO_COMPLETE} />
</Form.Item>
</>
)
);
}

View File

@@ -9,25 +9,39 @@ import { DISABLE_AUTO_COMPLETE } from '@/utils';
const OriginLabel = ({ url }: { url: string }) => {
return (
<span>
Switch Origin <Tooltip title={`Default: ${url}`}><QuestionCircleOutlined style={{ color: '#1677ff' }} /></Tooltip>
Switch Origin{' '}
<Tooltip title={`Default: ${url}`}>
<QuestionCircleOutlined style={{ color: '#1677ff' }} />
</Tooltip>
</span>
)
}
);
};
const PopupSearchLabel = () => {
return (
<span>
Pop-up Search
{' '}
<Tooltip title={(
<div>
<div style={{ marginBottom: 10 }}>Generate images according to the content: Select the ChatGPT content with the mouse, no more than 400 characters. the <b>DALL·E 2</b> button appears, and click to jump (Note: because the search content filled by the script cannot trigger the event directly, you need to enter a space in the input box to make the button clickable).</div>
<div>The application is built using Tauri, and due to its security restrictions, some of the action buttons will not work, so we recommend going to your browser.</div>
</div>
)}><QuestionCircleOutlined style={{ color: '#1677ff' }} /></Tooltip>
Pop-up Search{' '}
<Tooltip
title={
<div>
<div style={{ marginBottom: 10 }}>
Generate images according to the content: Select the ChatGPT content with the mouse,
no more than 400 characters. the <b>DALL·E 2</b> button appears, and click to jump
(Note: because the search content filled by the script cannot trigger the event
directly, you need to enter a space in the input box to make the button clickable).
</div>
<div>
The application is built using Tauri, and due to its security restrictions, some of
the action buttons will not work, so we recommend going to your browser.
</div>
</div>
}
>
<QuestionCircleOutlined style={{ color: '#1677ff' }} />
</Tooltip>
</span>
)
}
);
};
export default function General() {
const [chatConf, setChatConf] = useState<any>(null);
@@ -46,8 +60,12 @@ export default function General() {
<Input placeholder="https://chat.openai.com" {...DISABLE_AUTO_COMPLETE} />
</Form.Item>
<Form.Item label="User Agent (Main)" name="ua_window">
<Input.TextArea autoSize={{ minRows: 4, maxRows: 4 }} {...DISABLE_AUTO_COMPLETE} placeholder="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36" />
<Input.TextArea
autoSize={{ minRows: 4, maxRows: 4 }}
{...DISABLE_AUTO_COMPLETE}
placeholder="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
/>
</Form.Item>
</>
)
);
}

View File

@@ -9,8 +9,12 @@ export default function General() {
<Switch />
</Form.Item>
<Form.Item label="User Agent (SystemTray)" name="ua_tray">
<Input.TextArea autoSize={{ minRows: 4, maxRows: 4 }} {...DISABLE_AUTO_COMPLETE} placeholder="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" />
<Input.TextArea
autoSize={{ minRows: 4, maxRows: 4 }}
{...DISABLE_AUTO_COMPLETE}
placeholder="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"
/>
</Form.Item>
</>
)
);
}

View File

@@ -21,7 +21,7 @@ export default function Settings() {
useEffect(() => {
form.setFieldsValue(clone(chatConf));
}, [chatConf])
}, [chatConf]);
const onCancel = () => {
form.setFieldsValue(chatConf);
@@ -31,7 +31,7 @@ export default function Settings() {
const chatData = await invoke('reset_chat_conf');
setChatConf(chatData);
const isOk = await dialog.ask(`Configuration reset successfully, whether to restart?`, {
title: 'ChatGPT Preferences'
title: 'ChatGPT Preferences',
});
if (isOk) {
process.relaunch();
@@ -44,7 +44,7 @@ export default function Settings() {
if (!isEqual(omit(chatConf, ['default_origin']), values)) {
await invoke('form_confirm', { data: values, label: 'main' });
const isOk = await dialog.ask(`Configuration saved successfully, whether to restart?`, {
title: 'ChatGPT Preferences'
title: 'ChatGPT Preferences',
});
if (isOk) {
process.relaunch();
@@ -75,11 +75,15 @@ export default function Settings() {
<Form.Item>
<Space size={20}>
<Button onClick={onCancel}>Cancel</Button>
<Button type="primary" htmlType="submit">Submit</Button>
<Button type="dashed" onClick={onReset}>Reset to defaults</Button>
<Button type="primary" htmlType="submit">
Submit
</Button>
<Button type="dashed" onClick={onReset}>
Reset to defaults
</Button>
</Space>
</Form.Item>
</Form>
</div>
)
}
);
}