mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-24 07:09:12 +08:00
refactor(export): merge bulk selection actions into header row
This commit is contained in:
@@ -1144,6 +1144,16 @@
|
||||
.contacts-list-header-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.contacts-list-header-main-label {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.contacts-list-header-count {
|
||||
@@ -1157,7 +1167,10 @@
|
||||
|
||||
.contacts-list-header-actions {
|
||||
width: var(--contacts-action-col-width);
|
||||
text-align: right;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@@ -1183,78 +1196,63 @@
|
||||
}
|
||||
}
|
||||
|
||||
.contacts-selection-toolbar {
|
||||
display: flex;
|
||||
.selection-toggle-btn,
|
||||
.selection-clear-btn {
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 8px;
|
||||
background: var(--bg-secondary);
|
||||
color: var(--text-secondary);
|
||||
font-size: 12px;
|
||||
padding: 6px 10px;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
border-color: var(--text-tertiary);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.65;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
.selection-toggle-btn {
|
||||
padding: 4px 8px;
|
||||
font-size: 11px;
|
||||
line-height: 1.2;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.selection-export-btn {
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
padding: 6px 10px;
|
||||
background: var(--primary);
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 10px 12px 8px;
|
||||
border-bottom: 1px solid color-mix(in srgb, var(--border-color) 85%, transparent);
|
||||
background: color-mix(in srgb, var(--bg-primary) 88%, var(--bg-secondary));
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
|
||||
.selection-toggle-btn,
|
||||
.selection-clear-btn {
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 8px;
|
||||
background: var(--bg-secondary);
|
||||
color: var(--text-secondary);
|
||||
font-size: 12px;
|
||||
padding: 6px 10px;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
border-color: var(--text-tertiary);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.65;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
&:hover:not(:disabled) {
|
||||
background: var(--primary-hover);
|
||||
}
|
||||
|
||||
.selection-summary {
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary);
|
||||
font-weight: 600;
|
||||
|
||||
&.muted {
|
||||
color: var(--text-tertiary);
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.selection-export-btn {
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
padding: 6px 10px;
|
||||
background: var(--primary);
|
||||
.selection-export-count {
|
||||
min-width: 18px;
|
||||
height: 18px;
|
||||
padding: 0 5px;
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
margin-left: auto;
|
||||
display: inline-flex;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
background: var(--primary-hover);
|
||||
}
|
||||
|
||||
.selection-export-count {
|
||||
min-width: 18px;
|
||||
height: 18px;
|
||||
padding: 0 5px;
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
color: #fff;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
justify-content: center;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2700,12 +2698,17 @@
|
||||
padding: 8px 10px 6px;
|
||||
}
|
||||
|
||||
.table-wrap .contacts-selection-toolbar {
|
||||
padding: 8px 10px 6px;
|
||||
.table-wrap .contacts-list-header-main {
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.selection-export-btn {
|
||||
margin-left: 0;
|
||||
}
|
||||
.table-wrap .selection-toggle-btn {
|
||||
padding: 3px 7px;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.table-wrap .contacts-list-header-actions {
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.table-wrap .contacts-list {
|
||||
|
||||
@@ -3761,24 +3761,12 @@ function ExportPage() {
|
||||
return sessions.reduce((count, session) => (session.avatarUrl ? count + 1 : count), 0)
|
||||
}, [sessions])
|
||||
|
||||
const visibleSelectedCount = useMemo(() => {
|
||||
const visibleSet = new Set(
|
||||
filteredContacts
|
||||
.filter(contact => sessionRowByUsername.get(contact.username)?.hasSession)
|
||||
.map(contact => contact.username)
|
||||
)
|
||||
let count = 0
|
||||
for (const id of selectedSessions) {
|
||||
if (visibleSet.has(id)) count += 1
|
||||
}
|
||||
return count
|
||||
}, [filteredContacts, selectedSessions, sessionRowByUsername])
|
||||
const visibleSelectableCount = useMemo(() => (
|
||||
filteredContacts.reduce((count, contact) => (
|
||||
sessionRowByUsername.get(contact.username)?.hasSession ? count + 1 : count
|
||||
), 0)
|
||||
), [filteredContacts, sessionRowByUsername])
|
||||
const isAllVisibleSelected = visibleSelectableCount > 0 && visibleSelectedCount === visibleSelectableCount
|
||||
const isAllVisibleSelected = visibleSelectableCount > 0 && selectedCount === visibleSelectableCount
|
||||
|
||||
const canCreateTask = exportDialog.scope === 'sns'
|
||||
? Boolean(exportFolder)
|
||||
@@ -4174,8 +4162,8 @@ function ExportPage() {
|
||||
)}
|
||||
|
||||
{hasFilteredContacts && (
|
||||
<>
|
||||
<div className="contacts-selection-toolbar">
|
||||
<div className="contacts-list-header">
|
||||
<span className="contacts-list-header-select">
|
||||
<button
|
||||
className={`select-icon-btn ${isAllVisibleSelected ? 'checked' : ''}`}
|
||||
type="button"
|
||||
@@ -4185,6 +4173,8 @@ function ExportPage() {
|
||||
>
|
||||
{isAllVisibleSelected ? <CheckSquare size={16} /> : <Square size={16} />}
|
||||
</button>
|
||||
</span>
|
||||
<span className="contacts-list-header-main">
|
||||
<button
|
||||
className="selection-toggle-btn"
|
||||
type="button"
|
||||
@@ -4193,35 +4183,31 @@ function ExportPage() {
|
||||
>
|
||||
{isAllVisibleSelected ? '取消全选当前筛选' : '全选当前筛选'}
|
||||
</button>
|
||||
<span className="selection-summary muted">
|
||||
当前筛选 {visibleSelectedCount}/{visibleSelectableCount}
|
||||
</span>
|
||||
<button
|
||||
className="selection-clear-btn"
|
||||
type="button"
|
||||
onClick={clearSelection}
|
||||
disabled={selectedCount === 0}
|
||||
>
|
||||
清空
|
||||
</button>
|
||||
<span className="contacts-list-header-main-label">联系人(头像/名称/微信号)</span>
|
||||
</span>
|
||||
<span className="contacts-list-header-count">总消息数</span>
|
||||
<span className="contacts-list-header-actions">
|
||||
{selectedCount > 0 && (
|
||||
<button
|
||||
className="selection-export-btn"
|
||||
type="button"
|
||||
onClick={openBatchExport}
|
||||
>
|
||||
<span>批量导出</span>
|
||||
<span className="selection-export-count">{selectedCount}</span>
|
||||
</button>
|
||||
<>
|
||||
<button
|
||||
className="selection-clear-btn"
|
||||
type="button"
|
||||
onClick={clearSelection}
|
||||
>
|
||||
清空
|
||||
</button>
|
||||
<button
|
||||
className="selection-export-btn"
|
||||
type="button"
|
||||
onClick={openBatchExport}
|
||||
>
|
||||
<span>批量导出</span>
|
||||
<span className="selection-export-count">{selectedCount}</span>
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<div className="contacts-list-header">
|
||||
<span className="contacts-list-header-select">选择</span>
|
||||
<span className="contacts-list-header-main">联系人(头像/名称/微信号)</span>
|
||||
<span className="contacts-list-header-count">总消息数</span>
|
||||
<span className="contacts-list-header-actions">操作</span>
|
||||
</div>
|
||||
</>
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user