feat: 优化UI和功能,添加图标生成脚本

- 修复未匹配订单更新逻辑,添加去重机制避免重复赎回
- 优化跟单配置列表,移除订单菜单中的编辑选项
- 限制账户编辑功能,只允许编辑账户名称
- 优化Layout布局,将PC端图标移至标题下方,添加Telegram群链接
- 添加图标生成脚本到polymarket-demo目录
- 添加多个尺寸的favicon图标文件
This commit is contained in:
WrBug
2025-12-07 14:45:59 +08:00
parent 5c136ab0f4
commit 89e3c726b2
13 changed files with 644 additions and 114 deletions
+46 -18
View File
@@ -17,7 +17,8 @@ import {
SettingOutlined,
GithubOutlined,
TwitterOutlined,
CheckCircleOutlined
CheckCircleOutlined,
SendOutlined
} from '@ant-design/icons'
import type { MenuProps } from 'antd'
import type { ReactNode } from 'react'
@@ -197,12 +198,13 @@ const Layout: React.FC<LayoutProps> = ({ children }) => {
size="normal"
darkMode={true}
/>
<div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
<a
href="https://github.com/WrBug/PolyHermes"
target="_blank"
rel="noopener noreferrer"
style={{ color: '#fff', fontSize: '18px' }}
style={{ color: '#fff', fontSize: '16px', display: 'flex', alignItems: 'center' }}
title="GitHub"
>
<GithubOutlined />
</a>
@@ -210,14 +212,24 @@ const Layout: React.FC<LayoutProps> = ({ children }) => {
href="https://x.com/quant_tr"
target="_blank"
rel="noopener noreferrer"
style={{ color: '#fff', fontSize: '18px' }}
style={{ color: '#fff', fontSize: '16px', display: 'flex', alignItems: 'center' }}
title="Twitter"
>
<TwitterOutlined />
</a>
<a
href="https://t.me/+5BwdYvvvuf9iZGZl"
target="_blank"
rel="noopener noreferrer"
style={{ color: '#fff', fontSize: '16px', display: 'flex', alignItems: 'center' }}
title="Telegram 交流群"
>
<SendOutlined />
</a>
<Button
type="text"
icon={<MenuOutlined />}
style={{ color: '#fff' }}
style={{ color: '#fff', marginLeft: '4px' }}
onClick={() => setMobileMenuOpen(true)}
/>
</div>
@@ -265,23 +277,30 @@ const Layout: React.FC<LayoutProps> = ({ children }) => {
}}
>
<div style={{
height: '64px',
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
padding: '0 16px',
padding: '16px',
color: '#fff',
fontSize: '18px',
fontWeight: 'bold',
flexShrink: 0
flexShrink: 0,
borderBottom: '1px solid rgba(255, 255, 255, 0.1)'
}}>
<span>PolyHermes</span>
<div style={{ display: 'flex', gap: '12px', alignItems: 'center' }}>
<div style={{
fontSize: '18px',
fontWeight: 'bold',
marginBottom: '12px',
textAlign: 'center'
}}>
PolyHermes
</div>
<div style={{
display: 'flex',
gap: '12px',
alignItems: 'center',
justifyContent: 'center'
}}>
<a
href="https://github.com/WrBug/PolyHermes"
target="_blank"
rel="noopener noreferrer"
style={{ color: '#fff', fontSize: '16px' }}
style={{ color: '#fff', fontSize: '18px', display: 'flex', alignItems: 'center' }}
title="GitHub"
>
<GithubOutlined />
@@ -290,11 +309,20 @@ const Layout: React.FC<LayoutProps> = ({ children }) => {
href="https://x.com/quant_tr"
target="_blank"
rel="noopener noreferrer"
style={{ color: '#fff', fontSize: '16px' }}
style={{ color: '#fff', fontSize: '18px', display: 'flex', alignItems: 'center' }}
title="Twitter"
>
<TwitterOutlined />
</a>
<a
href="https://t.me/+5BwdYvvvuf9iZGZl"
target="_blank"
rel="noopener noreferrer"
style={{ color: '#fff', fontSize: '18px', display: 'flex', alignItems: 'center' }}
title="Telegram 交流群"
>
<SendOutlined />
</a>
</div>
</div>
<Menu
@@ -305,7 +333,7 @@ const Layout: React.FC<LayoutProps> = ({ children }) => {
items={menuItems}
onClick={handleMenuClick}
style={{
height: 'calc(100vh - 64px)',
height: 'calc(100vh - 100px)',
borderRight: 0,
overflowY: 'auto'
}}
+5 -40
View File
@@ -72,23 +72,12 @@ const AccountDetail: React.FC = () => {
setEditLoading(true)
try {
// 构建更新请求,空字符串转换为 undefined(不修改)
// 构建更新请求,只支持编辑账户名称
const updateData: any = {
accountId: account.id,
accountName: values.accountName || undefined,
}
// 只有非空字符串才更新 API 凭证
if (values.apiKey && values.apiKey.trim()) {
updateData.apiKey = values.apiKey.trim()
}
if (values.apiSecret && values.apiSecret.trim()) {
updateData.apiSecret = values.apiSecret.trim()
}
if (values.apiPassphrase && values.apiPassphrase.trim()) {
updateData.apiPassphrase = values.apiPassphrase.trim()
}
await updateAccount(updateData)
message.success(t('account.updateSuccess'))
@@ -335,42 +324,18 @@ const AccountDetail: React.FC = () => {
size={isMobile ? 'middle' : 'large'}
>
<Alert
message={t('account.editTip')}
description={t('account.editTipDesc')}
message={t('account.editTip') || '编辑账户'}
description={t('account.editTipDesc') || '只能编辑账户名称,API 凭证需要通过导入账户功能更新。'}
type="info"
showIcon
style={{ marginBottom: '24px' }}
/>
<Form.Item
label={t('account.accountName')}
label={t('account.accountName') || '账户名称'}
name="accountName"
>
<Input placeholder={t('account.accountNamePlaceholder')} />
</Form.Item>
<Form.Item
label={t('account.apiKey')}
name="apiKey"
help={t('account.leaveEmptyToNotModify')}
>
<Input.Password placeholder={t('account.leaveEmptyToNotModify')} />
</Form.Item>
<Form.Item
label={t('account.apiSecret')}
name="apiSecret"
help={t('account.leaveEmptyToNotModify')}
>
<Input.Password placeholder={t('account.leaveEmptyToNotModify')} />
</Form.Item>
<Form.Item
label={t('account.apiPassphrase')}
name="apiPassphrase"
help={t('account.leaveEmptyToNotModify')}
>
<Input.Password placeholder={t('account.leaveEmptyToNotModify')} />
<Input placeholder={t('account.accountNamePlaceholder') || '请输入账户名称(可选)'} />
</Form.Item>
<Form.Item>
+5 -40
View File
@@ -171,23 +171,12 @@ const AccountList: React.FC = () => {
setEditLoading(true)
try {
// 构建更新请求,空字符串转换为 undefined(不修改)
// 构建更新请求,只支持编辑账户名称
const updateData: any = {
accountId: editAccount.id,
accountName: values.accountName || undefined
}
// 只有非空字符串才更新 API 凭证
if (values.apiKey && values.apiKey.trim()) {
updateData.apiKey = values.apiKey.trim()
}
if (values.apiSecret && values.apiSecret.trim()) {
updateData.apiSecret = values.apiSecret.trim()
}
if (values.apiPassphrase && values.apiPassphrase.trim()) {
updateData.apiPassphrase = values.apiPassphrase.trim()
}
await updateAccount(updateData)
message.success(t('accountList.updateSuccess'))
@@ -778,42 +767,18 @@ const AccountList: React.FC = () => {
size={isMobile ? 'middle' : 'large'}
>
<Alert
message={t('accountList.editTip')}
description={t('accountList.editTipDesc')}
message={t('accountList.editTip') || '编辑账户'}
description={t('accountList.editTipDesc') || '只能编辑账户名称,API 凭证需要通过导入账户功能更新。'}
type="info"
showIcon
style={{ marginBottom: '24px' }}
/>
<Form.Item
label={t('accountList.accountName')}
label={t('accountList.accountName') || '账户名称'}
name="accountName"
>
<Input placeholder={t('accountList.accountNamePlaceholder')} />
</Form.Item>
<Form.Item
label={t('accountList.apiKey')}
name="apiKey"
help={t('accountList.leaveEmptyToNotModify')}
>
<Input.Password placeholder={t('accountList.leaveEmptyToNotModify')} />
</Form.Item>
<Form.Item
label={t('accountList.apiSecret')}
name="apiSecret"
help={t('accountList.leaveEmptyToNotModify')}
>
<Input.Password placeholder={t('accountList.leaveEmptyToNotModify')} />
</Form.Item>
<Form.Item
label={t('accountList.apiPassphrase')}
name="apiPassphrase"
help={t('accountList.leaveEmptyToNotModify')}
>
<Input.Password placeholder={t('accountList.leaveEmptyToNotModify')} />
<Input placeholder={t('accountList.accountNamePlaceholder') || '请输入账户名称(可选)'} />
</Form.Item>
<Form.Item>
-9
View File
@@ -265,15 +265,6 @@ const CopyTradingList: React.FC = () => {
fixed: 'right' as const,
render: (_: any, record: CopyTrading) => {
const menuItems: MenuProps['items'] = [
{
key: 'edit',
label: t('common.edit') || '编辑',
icon: <EditOutlined />,
onClick: () => navigate(`/copy-trading/edit/${record.id}`)
},
{
type: 'divider'
},
{
key: 'buyOrders',
label: t('copyTradingList.buyOrders') || '买入订单',