Skip to content

Commit a9caef7

Browse files
committed
fix(Search tools): show more tools
In Search of tools, show up to 25 tools (configurable by VITE_MAX_SEARCH_RESULT) and show a scrollbar if needed Fix CorentinTh#1430 (since there are many json related tools)
1 parent e4cca1e commit a9caef7

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/modules/command-palette/command-palette.store.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import BugIcon from '~icons/mdi/bug-outline';
1111
import DiceIcon from '~icons/mdi/dice-5';
1212
import InfoIcon from '~icons/mdi/information-outline';
1313

14+
const maxSearchResultsPerCategory = import.meta.env.VITE_MAX_SEARCH_RESULT || 25;
15+
1416
export const useCommandPaletteStore = defineStore('command-palette', () => {
1517
const toolStore = useToolStore();
1618
const styleStore = useStyleStore();
@@ -82,7 +84,7 @@ export const useCommandPaletteStore = defineStore('command-palette', () => {
8284
});
8385

8486
const filteredSearchResult = computed(() =>
85-
_.chain(searchResult.value).groupBy('category').mapValues(categoryOptions => _.take(categoryOptions, 5)).value());
87+
_.chain(searchResult.value).groupBy('category').mapValues(categoryOptions => _.take(categoryOptions, maxSearchResultsPerCategory)).value());
8688

8789
return {
8890
filteredSearchResult,

src/modules/command-palette/command-palette.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ function activateOption(option: PaletteOption) {
124124
</span>
125125
</c-button>
126126

127-
<c-modal v-model:open="isModalOpen" class="palette-modal" shadow-xl important:max-w-650px important:pa-12px @keydown="handleKeydown">
127+
<c-modal v-model:open="isModalOpen" class="palette-modal" overflow-y-auto shadow-xl important:max-w-650px pretty-scrollbar important:pa-12px @keydown="handleKeydown">
128128
<c-input-text ref="inputRef" v-model:value="searchPrompt" raw-text placeholder="Type to search a tool or a command..." autofocus clearable />
129129

130130
<div v-for="(options, category) in filteredSearchResult" :key="category">
@@ -147,6 +147,10 @@ function activateOption(option: PaletteOption) {
147147
}
148148
}
149149
150+
::v-deep(.palette-modal) {
151+
max-height: 80vh;
152+
}
153+
150154
.c-modal--overlay {
151155
align-items: flex-start !important;
152156
padding-top: 80px;

0 commit comments

Comments
 (0)