style: Refine Segmented component styling with transparent background and rounded corners
This commit is contained in:
parent
741d84b4d3
commit
59b1d8bcc4
@ -1,12 +1,12 @@
|
||||
import { WebDavConfig } from '@types'
|
||||
import AdmZip from 'adm-zip'
|
||||
import { exec } from 'child_process'
|
||||
import { app } from 'electron'
|
||||
import Logger from 'electron-log'
|
||||
import * as fs from 'fs-extra'
|
||||
import * as path from 'path'
|
||||
|
||||
import WebDav from './WebDav'
|
||||
import { exec } from 'child_process'
|
||||
|
||||
class BackupManager {
|
||||
private tempDir = path.join(app.getPath('temp'), 'cherry-studio', 'backup', 'temp')
|
||||
@ -21,25 +21,25 @@ class BackupManager {
|
||||
|
||||
private async setWritableRecursive(dirPath: string): Promise<void> {
|
||||
try {
|
||||
const items = await fs.readdir(dirPath, { withFileTypes: true });
|
||||
const items = await fs.readdir(dirPath, { withFileTypes: true })
|
||||
|
||||
for (const item of items) {
|
||||
const fullPath = path.join(dirPath, item.name);
|
||||
const fullPath = path.join(dirPath, item.name)
|
||||
|
||||
// 先处理子目录
|
||||
if (item.isDirectory()) {
|
||||
await this.setWritableRecursive(fullPath);
|
||||
await this.setWritableRecursive(fullPath)
|
||||
}
|
||||
|
||||
// 统一设置权限(Windows需要特殊处理)
|
||||
await this.forceSetWritable(fullPath);
|
||||
await this.forceSetWritable(fullPath)
|
||||
}
|
||||
|
||||
// 确保根目录权限
|
||||
await this.forceSetWritable(dirPath);
|
||||
await this.forceSetWritable(dirPath)
|
||||
} catch (error) {
|
||||
Logger.error(`权限设置失败:${dirPath}`, error);
|
||||
throw error;
|
||||
Logger.error(`权限设置失败:${dirPath}`, error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,20 +48,20 @@ class BackupManager {
|
||||
try {
|
||||
// Windows系统需要先取消只读属性
|
||||
if (process.platform === 'win32') {
|
||||
await fs.chmod(targetPath, 0o666); // Windows会忽略权限位但能移除只读
|
||||
await fs.chmod(targetPath, 0o666) // Windows会忽略权限位但能移除只读
|
||||
} else {
|
||||
const stats = await fs.stat(targetPath);
|
||||
const mode = stats.isDirectory() ? 0o777 : 0o666;
|
||||
await fs.chmod(targetPath, mode);
|
||||
const stats = await fs.stat(targetPath)
|
||||
const mode = stats.isDirectory() ? 0o777 : 0o666
|
||||
await fs.chmod(targetPath, mode)
|
||||
}
|
||||
|
||||
// 双重保险:使用文件属性命令(Windows专用)
|
||||
if (process.platform === 'win32') {
|
||||
await exec(`attrib -R "${targetPath}" /L /D`);
|
||||
await exec(`attrib -R "${targetPath}" /L /D`)
|
||||
}
|
||||
} catch (error) {
|
||||
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {
|
||||
Logger.warn(`权限设置警告:${targetPath}`, error);
|
||||
Logger.warn(`权限设置警告:${targetPath}`, error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,16 +14,16 @@ export default class WebDav {
|
||||
constructor(params: WebDavConfig) {
|
||||
this.webdavPath = params.webdavPath
|
||||
|
||||
const httpAgent = new HttpProxyAgent(proxyManager.getProxyUrl() || '')
|
||||
const httpsAgent = new HttpsProxyAgent(proxyManager.getProxyUrl() || '')
|
||||
const httpProxy = proxyManager.getProxyUrl() || ''
|
||||
const httpsProxy = proxyManager.getProxyUrl() || ''
|
||||
|
||||
this.instance = createClient(params.webdavHost, {
|
||||
username: params.webdavUser,
|
||||
password: params.webdavPass,
|
||||
maxBodyLength: Infinity,
|
||||
maxContentLength: Infinity,
|
||||
httpAgent: httpAgent,
|
||||
httpsAgent: httpsAgent
|
||||
httpAgent: httpProxy ? new HttpProxyAgent(httpProxy) : undefined,
|
||||
httpsAgent: httpsProxy ? new HttpsProxyAgent(httpsProxy) : undefined
|
||||
})
|
||||
|
||||
this.putFileContents = this.putFileContents.bind(this)
|
||||
|
||||
@ -405,6 +405,7 @@
|
||||
"reset.double.confirm.content": "All data will be lost, do you want to continue?",
|
||||
"reset.double.confirm.title": "DATA LOST !!!",
|
||||
"restore.success": "Restored successfully",
|
||||
"restore.failed": "Restore failed",
|
||||
"save.success.title": "Saved successfully",
|
||||
"searching": "Searching the internet...",
|
||||
"success.notion.export": "Successfully exported to Notion",
|
||||
|
||||
@ -405,6 +405,7 @@
|
||||
"reset.double.confirm.content": "すべてのデータが失われます。続行しますか?",
|
||||
"reset.double.confirm.title": "データが失われます!!!",
|
||||
"restore.success": "復元に成功しました",
|
||||
"restore.failed": "復元に失敗しました",
|
||||
"save.success.title": "保存に成功しました",
|
||||
"searching": "インターネットで検索中...",
|
||||
"success.notion.export": "Notionへのエクスポートに成功しました",
|
||||
|
||||
@ -405,6 +405,7 @@
|
||||
"reset.double.confirm.content": "Все данные будут утеряны, хотите продолжить?",
|
||||
"reset.double.confirm.title": "ДАННЫЕ БУДУТ УТЕРЯНЫ !!!",
|
||||
"restore.success": "Успешно восстановлено",
|
||||
"restore.failed": "Восстановление не удалось",
|
||||
"save.success.title": "Успешно сохранено",
|
||||
"searching": "Поиск в Интернете...",
|
||||
"success.notion.export": "Успешный экспорт в Notion",
|
||||
|
||||
@ -405,6 +405,7 @@
|
||||
"reset.double.confirm.content": "你的全部数据都会丢失,如果没有备份数据,将无法恢复,确定要继续吗?",
|
||||
"reset.double.confirm.title": "数据丢失!!!",
|
||||
"restore.success": "恢复成功",
|
||||
"restore.failed": "恢复失败",
|
||||
"save.success.title": "保存成功",
|
||||
"searching": "正在联网搜索...",
|
||||
"success.notion.export": "成功导出到Notion",
|
||||
|
||||
@ -405,6 +405,7 @@
|
||||
"reset.double.confirm.content": "所有資料將會被清除,您確定要繼續嗎?",
|
||||
"reset.double.confirm.title": "資料將會丟失!!!",
|
||||
"restore.success": "恢復成功",
|
||||
"restore.failed": "恢復失敗",
|
||||
"save.success.title": "保存成功",
|
||||
"searching": "正在網路搜索...",
|
||||
"success.notion.export": "成功導出到 Notion",
|
||||
@ -841,7 +842,8 @@
|
||||
"blacklist_tooltip": "請使用以下格式(換行分隔)\nexample.com\nhttps://www.example.com\nhttps://example.com\n*://*.example.com",
|
||||
"search_max_result": "搜索結果個數",
|
||||
"search_result_default": "預設"
|
||||
}
|
||||
},
|
||||
"display.assistant.title": "助手設定"
|
||||
},
|
||||
"translate": {
|
||||
"any.language": "任意語言",
|
||||
|
||||
@ -131,9 +131,14 @@ const ModelsContainer = styled(Scrollbar)`
|
||||
`
|
||||
|
||||
const Segmented = styled(AntdSegmented)`
|
||||
&.ant-segmented {
|
||||
background: transparent !important;
|
||||
}
|
||||
.ant-segmented-item {
|
||||
background-color: transparent !important;
|
||||
transition: none !important;
|
||||
border-radius: var(--list-item-border-radius) !important;
|
||||
box-shadow: none !important;
|
||||
&:hover {
|
||||
background: transparent !important;
|
||||
}
|
||||
@ -143,6 +148,8 @@ const Segmented = styled(AntdSegmented)`
|
||||
background-color: transparent !important;
|
||||
border: 0.5px solid var(--color-border);
|
||||
transition: none !important;
|
||||
border-radius: var(--list-item-border-radius) !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
`
|
||||
|
||||
|
||||
@ -28,9 +28,9 @@ import {
|
||||
} from '@renderer/utils'
|
||||
import {
|
||||
exportMarkdownToNotion,
|
||||
exportMarkdownToYuque,
|
||||
exportMessageAsMarkdown,
|
||||
messageToMarkdown,
|
||||
exportMarkdownToYuque
|
||||
messageToMarkdown
|
||||
} from '@renderer/utils/export'
|
||||
import { Button, Dropdown, Popconfirm, Tooltip } from 'antd'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
@ -57,4 +57,3 @@ export function formatDomains(urls: string[]): FormatDomainsResult {
|
||||
|
||||
return { formattedDomains, hasError }
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user