|
25 | 25 | Route,
|
26 | 26 | Search,
|
27 | 27 | SearchCode,
|
28 |
| - Unplug |
| 28 | + Unplug, |
| 29 | + WandSparkles |
29 | 30 | } from 'lucide-svelte'
|
30 | 31 | import Portal from '$lib/components/Portal.svelte'
|
31 | 32 |
|
|
293 | 294 | }
|
294 | 295 |
|
295 | 296 | if (tab === 'default') {
|
296 |
| - if (searchTerm === '') |
297 |
| - itemMap['default'] = fuzzyFilter(searchTerm, defaultMenuItems, defaultMenuItemLabels) |
| 297 | + if (searchTerm === '') itemMap['default'] = defaultMenuItems |
298 | 298 | else
|
299 | 299 | itemMap['default'] = fuzzyFilter(
|
300 | 300 | searchTerm,
|
|
372 | 372 | }
|
373 | 373 | }
|
374 | 374 | }
|
375 |
| - if ((itemMap[tab] ?? []).length === 0 && searchTerm.length > 0 && event.key === 'Enter') { |
376 |
| - askAiButton?.onClick() |
377 |
| - } |
378 | 375 | }
|
379 | 376 | }
|
380 | 377 |
|
|
653 | 650 | <div class="overflow-y-auto relative {maxModalHeight(tab)}">
|
654 | 651 | {#if tab === 'default' || tab === 'switch-mode'}
|
655 | 652 | {@const items = (itemMap[tab] ?? []).filter((e) =>
|
656 |
| - defaultMenuItemsWithHidden.includes(e) |
| 653 | + defaultMenuItemsWithHidden.some((x) => e.search_id === x.search_id) |
657 | 654 | )}
|
658 | 655 | {#if items.length > 0}
|
659 |
| - <div class={tab === 'switch-mode' ? 'p-2' : 'p-2 border-b'}> |
| 656 | + <div |
| 657 | + class={tab === 'switch-mode' || itemMap[tab].length === items.length |
| 658 | + ? 'p-2' |
| 659 | + : 'p-2 border-b'} |
| 660 | + > |
660 | 661 | {#each items as el}
|
661 | 662 | <QuickMenuItem
|
662 | 663 | onselect={(shift) => el?.action(shift)}
|
|
674 | 675 | {/if}
|
675 | 676 |
|
676 | 677 | {#if tab === 'default'}
|
677 |
| - <div class="p-2"> |
678 |
| - {#if (itemMap[tab] ?? []).filter((e) => (combinedItems ?? []).includes(e)).length > 0} |
| 678 | + {#if (itemMap[tab] ?? []).filter((e) => (combinedItems ?? []).includes(e)).length > 0} |
| 679 | + <div class="p-2"> |
679 | 680 | <div class="py-2 px-1 text-xs font-semibold text-tertiary">
|
680 | 681 | Flows/Scripts/Apps
|
681 | 682 | </div>
|
|
694 | 695 | bind:mouseMoved
|
695 | 696 | />
|
696 | 697 | {/each}
|
697 |
| - {/if} |
| 698 | + </div> |
| 699 | + {/if} |
698 | 700 |
|
699 |
| - {#if (itemMap[tab] ?? []).length === 0} |
| 701 | + {#if (itemMap[tab] ?? []).length === 0} |
| 702 | + <div class="p-2"> |
| 703 | + <QuickMenuItem |
| 704 | + onselect={() => { |
| 705 | + askAiButton?.onClick() |
| 706 | + }} |
| 707 | + id={'ai:no-results-ask-ai'} |
| 708 | + hovered={true} |
| 709 | + label={`Try asking \`${searchTerm}\` to AI`} |
| 710 | + icon={WandSparkles} |
| 711 | + bind:mouseMoved |
| 712 | + /> |
700 | 713 | <div class="flex w-full justify-center items-center">
|
701 | 714 | <div class="text-tertiary text-center">
|
702 |
| - <div class="text-2xl font-bold" |
703 |
| - >Nothing found, ask the AI to find what you need!</div |
704 |
| - > |
705 |
| - <div class="text-sm">Tip: press `esc` to quickly clear the search bar</div> |
| 715 | + <div class="pt-1 text-sm">Tip: press `esc` to quickly clear the search bar</div> |
706 | 716 | </div>
|
707 | 717 | </div>
|
708 |
| - {/if} |
709 |
| - </div> |
| 718 | + </div> |
| 719 | + {/if} |
710 | 720 | {:else if tab === 'content'}
|
711 | 721 | <ContentSearchInner
|
712 | 722 | search={removePrefix(searchTerm, '#')}
|
|
0 commit comments