diff --git a/src/renderer/src/components/workspace-cleanup/WorkspaceCleanupDialog.tsx b/src/renderer/src/components/workspace-cleanup/WorkspaceCleanupDialog.tsx index 5896770ce3e..3682d8365b7 100644 --- a/src/renderer/src/components/workspace-cleanup/WorkspaceCleanupDialog.tsx +++ b/src/renderer/src/components/workspace-cleanup/WorkspaceCleanupDialog.tsx @@ -7,7 +7,6 @@ import { Check, EyeOff, Loader2, - Minus, RefreshCcw, Search, SlidersHorizontal, @@ -52,8 +51,7 @@ import { type WorkspaceCleanupBlocker, type WorkspaceCleanupCandidate, type WorkspaceCleanupScanError, - type WorkspaceCleanupScanProgress, - type WorkspaceCleanupTier + type WorkspaceCleanupScanProgress } from '../../../../shared/workspace-cleanup' import { filterWorkspaceCleanupCandidates, @@ -77,12 +75,6 @@ import { } from './workspace-cleanup-view-selection' import { translate } from '@/i18n/i18n' -const TIER_LABELS: Record = { - ready: 'Suggested cleanup', - review: 'Needs a closer look', - protected: 'Not suggested for cleanup' -} - const DEFAULT_FILTERS: WorkspaceCleanupFilters = { query: '', time: 'all', @@ -376,9 +368,6 @@ export default function WorkspaceCleanupDialog(): React.JSX.Element { }), [visibleCandidates] ) - const hiddenByKeepCount = filteredCandidates.filter((candidate) => - candidate.blockers.includes('dismissed') - ).length const cleanupViewCounts = useMemo( () => ({ ready: groups.ready.length, @@ -440,23 +429,6 @@ export default function WorkspaceCleanupDialog(): React.JSX.Element { candidate != null && canQueueWorkspaceCleanupCandidate(candidate) ) }, [activeRows, selectedIds]) - const activeQueueableRows = useMemo( - () => activeRows.filter(canQueueWorkspaceCleanupCandidate), - [activeRows] - ) - const activeQueueableSelected = useMemo( - () => activeQueueableRows.filter((candidate) => selectedIds.has(candidate.worktreeId)).length, - [activeQueueableRows, selectedIds] - ) - const allActiveQueueableSelected = - activeQueueableRows.length > 0 && activeQueueableSelected === activeQueueableRows.length - const someActiveQueueableSelected = activeQueueableSelected > 0 - const activeSelectionState = allActiveQueueableSelected - ? 'checked' - : someActiveQueueableSelected - ? 'mixed' - : 'unchecked' - useEffect(() => { if (!open || confirming) { return @@ -482,25 +454,6 @@ export default function WorkspaceCleanupDialog(): React.JSX.Element { startWorkspaceCleanupScan({ notifyWhenReady: true }) }, [startWorkspaceCleanupScan]) - const toggleActiveSelection = useCallback(() => { - if (activeQueueableRows.length === 0) { - return - } - setSelectedIds((current) => { - const next = new Set(current) - if (allActiveQueueableSelected) { - for (const candidate of activeQueueableRows) { - next.delete(candidate.worktreeId) - } - } else { - for (const candidate of activeQueueableRows) { - next.add(candidate.worktreeId) - } - } - return next - }) - }, [activeQueueableRows, allActiveQueueableSelected]) - const ignoreCandidate = useCallback( (candidate: WorkspaceCleanupCandidate) => { void dismissCandidates([candidate]) @@ -750,77 +703,18 @@ export default function WorkspaceCleanupDialog(): React.JSX.Element { onViewChange={setActiveView} />
-
-
- {resolvedActiveView !== 'hidden' && activeQueueableRows.length > 0 ? ( - - ) : null} -
- {resolvedActiveView === 'hidden' - ? translate( - 'auto.components.workspace.cleanup.WorkspaceCleanupDialog.0c6672f5e3', - 'Ignored cleanup suggestions' - ) - : TIER_LABELS[resolvedActiveView]} -
-
- {resolvedActiveView === 'hidden' && hiddenByKeepCount > 0 ? ( - - ) : ( -
- {translate( - 'auto.components.workspace.cleanup.WorkspaceCleanupDialog.592fbab446', - 'Sorted by {{value0}}', - { value0: formatWorkspaceCleanupSortLabel(sortKey, sortDirection) } - )} -
- )} -
{filteredCandidates.length > 0 ? ( 0 + } sortKey={sortKey} sortDirection={sortDirection} onFiltersChange={setFilters} onSortKeyChange={setSortKey} onSortDirectionChange={setSortDirection} + onRestoreIgnored={() => void resetDismissals()} /> ) : null} @@ -967,18 +861,22 @@ function StatusPill({ function WorkspaceCleanupFilterToolbar({ filters, + showRestoreIgnored, sortKey, sortDirection, onFiltersChange, onSortKeyChange, - onSortDirectionChange + onSortDirectionChange, + onRestoreIgnored }: { filters: WorkspaceCleanupFilters + showRestoreIgnored: boolean sortKey: WorkspaceCleanupSortKey sortDirection: WorkspaceCleanupSortDirection onFiltersChange: (filters: WorkspaceCleanupFilters) => void onSortKeyChange: (sortKey: WorkspaceCleanupSortKey) => void onSortDirectionChange: (direction: WorkspaceCleanupSortDirection) => void + onRestoreIgnored: () => void }): React.JSX.Element { const updateFilter = ( key: K, @@ -1121,6 +1019,17 @@ function WorkspaceCleanupFilterToolbar({ ]} onChange={onSortDirectionChange} /> + {showRestoreIgnored ? ( + <> + + + {translate( + 'auto.components.workspace.cleanup.WorkspaceCleanupDialog.aaee139eab', + 'Restore ignored suggestions' + )} + + + ) : null} {hasHiddenControls ? ( <> @@ -1767,25 +1676,6 @@ function getDefaultSelectedWorkspaceCleanupIds( ) } -function formatWorkspaceCleanupSortLabel( - sortKey: WorkspaceCleanupSortKey, - sortDirection: WorkspaceCleanupSortDirection -): string { - const direction = sortDirection === 'asc' ? 'ascending' : 'descending' - switch (sortKey) { - case 'activity': - return sortDirection === 'asc' ? 'oldest activity' : 'newest activity' - case 'name': - return `name ${direction}` - case 'repo': - return `repo ${direction}` - case 'review': - return `review ${direction}` - case 'git': - return `git ${direction}` - } -} - function formatWorkspaceCleanupReadyToastDescription( inactiveCount: number, suggestedCount: number