diff --git a/src/lib/components/Searchbar.svelte b/src/lib/components/Searchbar.svelte index b06ec617..4ddbada6 100644 --- a/src/lib/components/Searchbar.svelte +++ b/src/lib/components/Searchbar.svelte @@ -1,40 +1,50 @@ - - @@ -469,125 +330,108 @@ - {#if $searchBarData?.length !== 0} -
- -
- {#if notFoundTicker} -

- Oh snapp, ticker does not exist in our database -

- {/if} +
+ +
+ {#if !showSuggestions} +
+ {searchHistory?.length > 0 ? "Recent" : "Popular"} +
+ {/if} + +
+ {/each} + {:else if showSuggestions && searchBarData?.length > 0} +
+ Suggestions +
+ {#each searchBarData as item} +
  • + + + searchBarTicker(item?.symbol)} + class="mb-2 {item?.symbol === focusedSuggestion + ? 'shake-ticker cursor-pointer flex justify-start items-center p-2 text-white bg-[#27272A] rounded group' + : 'cursor-pointer mb-2 bg-[#09090B] sm:hover:bg-[#27272A] rounded-lg flex justify-start items-center p-2 text-white group'}" + > +
    +
    + {item?.symbol} + {item?.name?.length > 150 + ? item?.name?.slice(0, 150) + "..." + : item?.name} +
    + +
    + {item?.type} +
    +
    +
    +
  • + {/each} + {:else if showSuggestions && searchBarData?.length === 0} +
  • + +
  • + {/if} +
    - {:else} -
    -
    - -
    -
    - {/if} +
    - {#if $searchBarData?.length !== 0} -
    - -
    - {#if notFoundTicker} -

    - Oh snapp, ticker does not exist in our database -

    - {/if} +
    + +
    + {#if !showSuggestions} +
    + {searchHistory?.length > 0 ? "Recent" : "Popular"} +
    + {/if} +
    + {/each} + {:else if showSuggestions && searchBarData?.length > 0} +
    + Suggestions +
    + {#each searchBarData as item} +
  • + + + searchBarTicker(item?.symbol)} + class="mb-2 {item?.symbol === focusedSuggestion + ? 'shake-ticker cursor-pointer flex justify-start items-center p-2 text-white bg-[#27272A] rounded group' + : 'cursor-pointer mb-2 bg-[#09090B] bg-opacity-[0.4] rounded-lg flex justify-start items-center p-2 text-white group'}" + > +
    +
    + {item?.symbol} + {item?.name.length > charNumber + ? item?.name.slice(0, charNumber) + "..." + : item?.name} +
    + +
    + {item?.type} +
    +
    +
    +
  • + {/each} + {:else if showSuggestions && searchBarData?.length === 0} +
  • + +
  • + {/if} +
    - {:else} -
    - -
    - {/if} +
    -