mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-24 23:06:51 +00:00
排除好友防呆设计
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "weflow",
|
||||
"version": "2.0.1",
|
||||
"version": "2.1.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "weflow",
|
||||
"version": "2.0.1",
|
||||
"version": "2.1.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"better-sqlite3": "^12.5.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "weflow",
|
||||
"version": "2.0.1",
|
||||
"version": "2.1.0",
|
||||
"description": "WeFlow",
|
||||
"main": "dist-electron/main.js",
|
||||
"author": "cc",
|
||||
|
||||
@@ -45,6 +45,12 @@
|
||||
font-weight: 600;
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.error-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.page-header {
|
||||
@@ -521,4 +527,4 @@
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ function AnalyticsPage() {
|
||||
}, [loadExcludedUsernames])
|
||||
|
||||
const handleRefresh = () => loadData(true)
|
||||
const isNoSessionError = error?.includes('未找到消息会话') ?? false
|
||||
|
||||
const loadExcludeCandidates = useCallback(async () => {
|
||||
setExcludeLoading(true)
|
||||
@@ -175,6 +176,23 @@ function AnalyticsPage() {
|
||||
}
|
||||
}
|
||||
|
||||
const handleResetExcluded = async () => {
|
||||
try {
|
||||
const result = await window.electronAPI.analytics.setExcludedUsernames([])
|
||||
if (!result.success) {
|
||||
setError(result.error || '重置排除好友失败')
|
||||
return
|
||||
}
|
||||
setExcludedUsernames(new Set())
|
||||
setDraftExcluded(new Set())
|
||||
clearCache()
|
||||
await window.electronAPI.cache.clearAnalytics()
|
||||
await loadData(true)
|
||||
} catch (e) {
|
||||
setError(`重置排除好友失败: ${String(e)}`)
|
||||
}
|
||||
}
|
||||
|
||||
const visibleExcludeCandidates = excludeCandidates
|
||||
.filter((candidate) => {
|
||||
const query = excludeQuery.trim().toLowerCase()
|
||||
@@ -355,6 +373,22 @@ function AnalyticsPage() {
|
||||
)
|
||||
}
|
||||
|
||||
if (error && !isLoaded && isNoSessionError && excludedUsernames.size > 0) {
|
||||
return (
|
||||
<div className="error-container">
|
||||
<p>{error}</p>
|
||||
<div className="error-actions">
|
||||
<button className="btn btn-secondary" onClick={handleResetExcluded}>
|
||||
重置排除好友
|
||||
</button>
|
||||
<button className="btn btn-primary" onClick={() => loadData(true)}>
|
||||
重试
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
if (error && !isLoaded) {
|
||||
return (<div className="error-container"><p>{error}</p><button className="btn btn-primary" onClick={() => loadData(true)}>重试</button></div>)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user