From cb9a1ee7a78b1c614002cea8c18baa37b1c5cee8 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Fri, 24 Jan 2025 17:32:47 +1300 Subject: [PATCH] Add max search history --- materialious/electron/src/setup.ts | 2 +- materialious/src/lib/components/Search.svelte | 6 +++++- .../lib/components/Settings/Interface.svelte | 21 +++++++++++++++++++ materialious/src/lib/i18n/locales/en.json | 2 +- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/materialious/electron/src/setup.ts b/materialious/electron/src/setup.ts index f2a4171a..dbfe60b2 100644 --- a/materialious/electron/src/setup.ts +++ b/materialious/electron/src/setup.ts @@ -106,7 +106,7 @@ export class ElectronCapacitorApp { defaultHeight: 800, }); // Setup preload script path and construct our main window. - const preloadPath = join(app.getAppPath(), 'build', 'src', 'preload); + const preloadPath = join(app.getAppPath(), 'build', 'src', 'preload.js'); this.MainWindow = new BrowserWindow({ icon, show: false, diff --git a/materialious/src/lib/components/Search.svelte b/materialious/src/lib/components/Search.svelte index aaf98ffe..b4c5a110 100644 --- a/materialious/src/lib/components/Search.svelte +++ b/materialious/src/lib/components/Search.svelte @@ -46,7 +46,11 @@ showSearchBox = false; if ($interfaceSearchHistoryEnabled && !$searchHistoryStore.includes(search)) { - searchHistoryStore.set([search, ...$searchHistoryStore]); + let pastHistory = $searchHistoryStore; + if (pastHistory.length > 15) { + pastHistory.pop(); + } + searchHistoryStore.set([search, ...pastHistory]); } } diff --git a/materialious/src/lib/components/Settings/Interface.svelte b/materialious/src/lib/components/Settings/Interface.svelte index 7e6facbc..93b22c3a 100644 --- a/materialious/src/lib/components/Settings/Interface.svelte +++ b/materialious/src/lib/components/Settings/Interface.svelte @@ -24,7 +24,9 @@ interfaceLowBandwidthMode, interfacePreviewVideoOnHoverStore, interfaceRegionStore, + interfaceSearchHistoryEnabled, interfaceSearchSuggestionsStore, + searchHistoryStore, themeColorStore } from '../../store'; @@ -128,6 +130,25 @@ +
+ +
+