|
1 | 1 | import { useCallback, useEffect, useMemo, useRef, useState } from 'react' |
2 | 2 | import './App.css' |
3 | | -import { ChevronsDown, ChevronsUp, CheckSquare, Square, Sun, Moon, Folder, FolderGit2, ListChecks, Copy, ArrowLeftRight } from 'lucide-react' |
| 3 | +import { ChevronsDown, ChevronsUp, CheckSquare, Square, Sun, Moon, Folder, FolderGit2, ListChecks, Copy, ArrowLeftRight, Trash2 } from 'lucide-react' |
4 | 4 | import { FileTreeView, PreviewModal, GitHubStarIconButton, BugIconButton } from '@gitcontext/ui' |
5 | 5 | import { type FileDiffStatus, isBinaryPath, MAX_CONCURRENT_READS } from '@gitcontext/core' |
6 | 6 | import { readText, writeText } from '@tauri-apps/plugin-clipboard-manager' |
@@ -159,6 +159,7 @@ function AppContent() { |
159 | 159 | selectAll, |
160 | 160 | deselectAll, |
161 | 161 | addSelectedPaths, |
| 162 | + removeSelectedPathsByPredicate, |
162 | 163 | revealPath, |
163 | 164 | } = useFileTree(setAppStatus) |
164 | 165 |
|
@@ -394,6 +395,10 @@ function AppContent() { |
394 | 395 | } |
395 | 396 | }, [currentDir, fileTree, statusByPath, addSelectedPaths]) |
396 | 397 |
|
| 398 | + const handleRemoveTestPathsFromSelection = useCallback(() => { |
| 399 | + removeSelectedPathsByPredicate((path) => path.toLowerCase().includes('test')) |
| 400 | + }, [removeSelectedPathsByPredicate]) |
| 401 | + |
397 | 402 | // Calculate file tree tokens |
398 | 403 | useEffect(() => { |
399 | 404 | if (!includeFileTree || !fileTree || selectedPaths.size === 0) { |
@@ -578,6 +583,7 @@ function AppContent() { |
578 | 583 | <button onClick={() => selectAll(treeFilter)} className="btn btn-ghost btn-icon" title="Select All" disabled={!fileTree}><CheckSquare size={14} /></button> |
579 | 584 | <button onClick={() => deselectAll(treeFilter)} className="btn btn-ghost btn-icon" title="Deselect All" disabled={!fileTree}><Square size={14} /></button> |
580 | 585 | <button onClick={() => void handleBatchSelectFromClipboard()} className="btn btn-ghost btn-icon" title="Batch Select from Clipboard" disabled={!fileTree || !currentDir}><ListChecks size={14} /></button> |
| 586 | + <button onClick={handleRemoveTestPathsFromSelection} className="btn btn-ghost btn-icon" title="Remove selected test files" disabled={!fileTree || selectedPaths.size === 0}><Trash2 size={14} /></button> |
581 | 587 | </div> |
582 | 588 | <label className="tree-filter-checkbox"> |
583 | 589 | <input type="checkbox" checked={showChangedOnly} onChange={(e) => setShowChangedOnly(e.target.checked)} /> |
|
0 commit comments