Skip to content

Commit c30d662

Browse files
committed
fix: disable swipe in bulk select mode; icon-only bulk action toolbar
1 parent 87b81dd commit c30d662

1 file changed

Lines changed: 20 additions & 14 deletions

File tree

‎frontend/src/components/MessageList.jsx‎

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,7 +1718,7 @@ export default function MessageList() {
17181718
<div
17191719
ref={listRef}
17201720
onScroll={handleScroll}
1721-
style={{ height: '100%', overflow: 'auto' }}
1721+
style={{ height: '100%', overflowY: 'auto', overflowX: 'hidden' }}
17221722
>
17231723
{/* Pull-to-refresh indicator */}
17241724
{isMobile && (
@@ -1820,13 +1820,12 @@ export default function MessageList() {
18201820
title={t('messageList.archiveSelected')}
18211821
onClick={() => handleBulkArchive([...selectedIds], selectedMsgs)}
18221822
>
1823-
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
1823+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
18241824
<rect x="2" y="3" width="20" height="5" rx="1"/>
18251825
<path d="M4 8v11a1 1 0 001 1h14a1 1 0 001-1V8"/>
18261826
<polyline points="9 13 12 16 15 13"/>
18271827
<line x1="12" y1="11" x2="12" y2="16"/>
18281828
</svg>
1829-
{t('messageList.archiveSelected')}
18301829
</BulkBtn>
18311830

18321831
{/* Delete button */}
@@ -1835,11 +1834,10 @@ export default function MessageList() {
18351834
onClick={() => handleBulkDelete([...selectedIds], selectedMsgs)}
18361835
danger
18371836
>
1838-
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
1837+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
18391838
<polyline points="3 6 5 6 21 6"/>
18401839
<path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a1 1 0 011-1h4a1 1 0 011 1v2"/>
18411840
</svg>
1842-
{t('messageList.deleteSelected')}
18431841
</BulkBtn>
18441842

18451843
{/* Move button + folder picker */}
@@ -1849,10 +1847,9 @@ export default function MessageList() {
18491847
onClick={() => handleOpenFolderPicker(selectedMsgs)}
18501848
disabled={!canMove}
18511849
>
1852-
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
1850+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
18531851
<path d="M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"/>
18541852
</svg>
1855-
{t('messageList.moveToFolder')}
18561853
</BulkBtn>
18571854

18581855
{showFolderPicker && !isMobile && (
@@ -2025,8 +2022,8 @@ export default function MessageList() {
20252022
isMobile={isMobile}
20262023
swipeLeftAction={swipeLeftAction}
20272024
swipeRightAction={swipeRightAction}
2028-
onSwipeLeft={swipeLeftAction === 'disabled' ? undefined : (msg) => runSwipeAction(swipeLeftAction, msg)}
2029-
onSwipeRight={swipeRightAction === 'disabled' ? undefined : (msg) => runSwipeAction(swipeRightAction, msg)}
2025+
onSwipeLeft={selectionMode || swipeLeftAction === 'disabled' ? undefined : (msg) => runSwipeAction(swipeLeftAction, msg)}
2026+
onSwipeRight={selectionMode || swipeRightAction === 'disabled' ? undefined : (msg) => runSwipeAction(swipeRightAction, msg)}
20302027
/>
20312028
);
20322029
})
@@ -2057,8 +2054,8 @@ export default function MessageList() {
20572054
isMobile={isMobile}
20582055
swipeLeftAction={swipeLeftAction}
20592056
swipeRightAction={swipeRightAction}
2060-
onSwipeLeft={swipeLeftAction === 'disabled' ? undefined : (msg) => runSwipeAction(swipeLeftAction, msg)}
2061-
onSwipeRight={swipeRightAction === 'disabled' ? undefined : (msg) => runSwipeAction(swipeRightAction, msg)}
2057+
onSwipeLeft={selectionMode || swipeLeftAction === 'disabled' ? undefined : (msg) => runSwipeAction(swipeLeftAction, msg)}
2058+
onSwipeRight={selectionMode || swipeRightAction === 'disabled' ? undefined : (msg) => runSwipeAction(swipeRightAction, msg)}
20622059
onLongPress={isMobile ? (id) => { setSelectionModeActive(true); toggleSelect(id); } : undefined}
20632060
/>
20642061
);
@@ -2546,6 +2543,11 @@ function ThreadRow({ message, isExpanded, threadMsgs, isLoadingThread, selectedM
25462543
el.removeEventListener('touchmove', onMove);
25472544
el.removeEventListener('touchend', onEnd);
25482545
el.removeEventListener('touchcancel', springBack);
2546+
el.style.transform = 'translateX(0)';
2547+
el.style.transition = '';
2548+
el.style.boxShadow = '';
2549+
if (swipeBgLeftRef.current) swipeBgLeftRef.current.style.display = 'none';
2550+
if (swipeBgRightRef.current) swipeBgRightRef.current.style.display = 'none';
25492551
};
25502552
}, [isMobile, message, onSwipeLeft, onSwipeRight, springBack]);
25512553

@@ -2890,6 +2892,11 @@ function MessageRow({ message, selected, lastViewed, isChecked, selectionMode, s
28902892
el.removeEventListener('touchmove', onMove);
28912893
el.removeEventListener('touchend', onEnd);
28922894
el.removeEventListener('touchcancel', onCancel);
2895+
el.style.transform = 'translateX(0)';
2896+
el.style.transition = '';
2897+
el.style.boxShadow = '';
2898+
if (swipeBgLeftRef.current) swipeBgLeftRef.current.style.display = 'none';
2899+
if (swipeBgRightRef.current) swipeBgRightRef.current.style.display = 'none';
28932900
};
28942901
}, [isMobile, message, onSwipeLeft, onSwipeRight, onLongPress, springBack]);
28952902

@@ -3127,15 +3134,14 @@ function BulkBtn({ children, onClick, title, disabled, danger }) {
31273134
onMouseEnter={() => { if (!disabled) setHov(true); }}
31283135
onMouseLeave={() => setHov(false)}
31293136
style={{
3130-
display: 'flex', alignItems: 'center', gap: 5,
3131-
padding: '4px 10px', borderRadius: 6, fontSize: 12, fontWeight: 500,
3137+
display: 'flex', alignItems: 'center', justifyContent: 'center',
3138+
padding: '5px 7px', borderRadius: 6,
31323139
cursor: disabled ? 'not-allowed' : 'pointer',
31333140
border: `1px solid ${hov && !disabled ? (danger ? 'var(--red, #ef4444)' : 'var(--accent)') : 'var(--border)'}`,
31343141
background: hov && !disabled ? (danger ? 'rgba(239,68,68,0.1)' : 'var(--accent-dim)') : 'var(--bg-tertiary)',
31353142
color: disabled ? 'var(--text-tertiary)' : (hov && danger ? 'var(--red, #ef4444)' : (hov ? 'var(--accent)' : 'var(--text-secondary)')),
31363143
opacity: disabled ? 0.5 : 1,
31373144
transition: 'all 0.15s',
3138-
whiteSpace: 'nowrap',
31393145
flexShrink: 0,
31403146
}}
31413147
>

0 commit comments

Comments
 (0)