Return artists first in universal search

This commit is contained in:
Claudio Ortolina
2025-10-16 20:02:58 +01:00
parent ed19c6d29e
commit 31683af4f4
@@ -22,15 +22,28 @@
</div> </div>
</form> </form>
<!-- Empty state -->
<.empty_state :if={@search_query == ""} /> <.empty_state :if={@search_query == ""} />
<!-- No results -->
<.no_results :if={@search_query != "" and @total_results == 0} query={@search_query} /> <.no_results :if={@search_query != "" and @total_results == 0} query={@search_query} />
<!-- Search results -->
<div :if={@total_results > 0} class="max-h-148 md:max-h-164 overflow-y-auto"> <div :if={@total_results > 0} class="max-h-148 md:max-h-164 overflow-y-auto">
<!-- Collection results --> <.search_result_group
:if={length(@search_results.artists) > 0}
title="Artists"
count={length(@search_results.artists)}
total_count={@search_counts.artists_count}
class="border-t border-zinc-200 dark:border-zinc-700"
>
<.search_result_artist
:for={%{artist: artist, image_data_hash: image_data_hash} <- @search_results.artists}
artist={artist}
image_data_hash={image_data_hash}
phx-click="navigate_to_artist"
phx-value-id={artist.musicbrainz_id}
phx-target={@myself}
/>
</.search_result_group>
</div>
<.search_result_group <.search_result_group
:if={length(@search_results.collection) > 0} :if={length(@search_results.collection) > 0}
title="Collection" title="Collection"
@@ -57,8 +70,6 @@
/> />
</:actions> </:actions>
</.search_result_group> </.search_result_group>
<!-- Wishlist results -->
<.search_result_group <.search_result_group
:if={length(@search_results.wishlist) > 0} :if={length(@search_results.wishlist) > 0}
title="Wishlist" title="Wishlist"
@@ -86,27 +97,6 @@
/> />
</:actions> </:actions>
</.search_result_group> </.search_result_group>
<!-- Artists results -->
<.search_result_group
:if={length(@search_results.artists) > 0}
title="Artists"
count={length(@search_results.artists)}
total_count={@search_counts.artists_count}
class="border-t border-zinc-200 dark:border-zinc-700"
>
<.search_result_artist
:for={%{artist: artist, image_data_hash: image_data_hash} <- @search_results.artists}
artist={artist}
image_data_hash={image_data_hash}
phx-click="navigate_to_artist"
phx-value-id={artist.musicbrainz_id}
phx-target={@myself}
/>
</.search_result_group>
</div>
<!-- Footer with keyboard shortcuts -->
<.results_footer total_results={@total_results} /> <.results_footer total_results={@total_results} />
</.structured_modal> </.structured_modal>
</div> </div>