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