Remove all vestiges of the abandoned Trash system: trashed/trashedAt fields from types, frontmatter parsing, sidebar filtering, editor banners, inspector components, mock data, and all related tests. Delete is already permanent via useDeleteActions with a confirmation dialog. Notes with trashed:true in existing vault frontmatter are now treated as normal notes (the flag is ignored by the parser). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
22 lines
642 B
TypeScript
22 lines
642 B
TypeScript
import { useCallback } from 'react'
|
|
|
|
interface BulkEntryActions {
|
|
handleArchiveNote: (path: string) => Promise<void>
|
|
}
|
|
|
|
export function useBulkActions(
|
|
entryActions: BulkEntryActions,
|
|
setToastMessage: (msg: string | null) => void,
|
|
) {
|
|
const handleBulkArchive = useCallback(async (paths: string[]) => {
|
|
let ok = 0
|
|
for (const path of paths) {
|
|
try { await entryActions.handleArchiveNote(path); ok++ }
|
|
catch { /* error toast already shown by flushBeforeAction */ }
|
|
}
|
|
if (ok > 0) setToastMessage(`${ok} note${ok > 1 ? 's' : ''} archived`)
|
|
}, [entryActions, setToastMessage])
|
|
|
|
return { handleBulkArchive }
|
|
}
|