diff --git a/website/src/lib/wordlist-database.ts b/website/src/lib/wordlist-database.ts index a1506be..ce71803 100644 --- a/website/src/lib/wordlist-database.ts +++ b/website/src/lib/wordlist-database.ts @@ -163,6 +163,9 @@ export function searchWordlist(search: string, wordlist: WordlistWord[], textOpt } export function calculateWordsToDelete(wordlist: WordlistWord[], monthsBackToKeep: number): string[] { + if (monthsBackToKeep === 0) { + return [...wordlist].map((word) => word._id); + } const now = Date.now(); const cutoffDate = now - getMillisecondsPeriod("months", monthsBackToKeep); return wordlist.filter((word) => { diff --git a/website/src/screens/Wordlist.tsx b/website/src/screens/Wordlist.tsx index b24823a..6f7cf1a 100644 --- a/website/src/screens/Wordlist.tsx +++ b/website/src/screens/Wordlist.tsx @@ -75,6 +75,9 @@ function paginate(arr: T[], page: number): T[] { } function amountOfWords(number: number): string { + if (number === 0) { + return "ALL your words"; + } return `${number} word${number !== 1 ? "s" : ""}`; } @@ -378,19 +381,23 @@ function Wordlist({ options, wordlist, isolateEntry, optionsDispatch }: {

You have {amountOfWords(wordlist.length)} in your wordlist.

-

Delete words older than:

+

Delete: