Remove custom loading state logic
This commit is contained in:
@@ -235,20 +235,4 @@ defmodule MusicLibraryWeb.SearchComponents do
|
|||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
|
||||||
Renders a loading state.
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
<.loading_state />
|
|
||||||
"""
|
|
||||||
def loading_state(assigns) do
|
|
||||||
~H"""
|
|
||||||
<div class="p-8 text-center">
|
|
||||||
<div class="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500 mx-auto"></div>
|
|
||||||
<p class="mt-4 text-zinc-600 dark:text-zinc-400">{gettext("Searching...")}</p>
|
|
||||||
</div>
|
|
||||||
"""
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ defmodule MusicLibraryWeb.UniversalSearchLive.Index do
|
|||||||
|> assign(:search_results, %{collection: [], wishlist: [], artists: []})
|
|> assign(:search_results, %{collection: [], wishlist: [], artists: []})
|
||||||
|> assign(:search_counts, %{collection_count: 0, wishlist_count: 0, artists_count: 0})
|
|> assign(:search_counts, %{collection_count: 0, wishlist_count: 0, artists_count: 0})
|
||||||
|> assign(:show_modal, false)
|
|> assign(:show_modal, false)
|
||||||
|> assign(:loading, false)
|
|
||||||
|> assign(:total_results, 0)}
|
|> assign(:total_results, 0)}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -43,12 +42,11 @@ defmodule MusicLibraryWeb.UniversalSearchLive.Index do
|
|||||||
socket
|
socket
|
||||||
|> assign(:search_results, %{collection: [], wishlist: [], artists: []})
|
|> assign(:search_results, %{collection: [], wishlist: [], artists: []})
|
||||||
|> assign(:search_counts, %{collection_count: 0, wishlist_count: 0, artists_count: 0})
|
|> assign(:search_counts, %{collection_count: 0, wishlist_count: 0, artists_count: 0})
|
||||||
|> assign(:loading, false)
|
|
||||||
|> assign(:total_results, 0)}
|
|> assign(:total_results, 0)}
|
||||||
|
|
||||||
_query ->
|
_query ->
|
||||||
send(self(), {:perform_search, query})
|
send(self(), {:perform_search, query})
|
||||||
{:noreply, assign(socket, :loading, true)}
|
{:noreply, socket}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -123,7 +121,6 @@ defmodule MusicLibraryWeb.UniversalSearchLive.Index do
|
|||||||
socket
|
socket
|
||||||
|> assign(:search_results, search_results)
|
|> assign(:search_results, search_results)
|
||||||
|> assign(:search_counts, search_counts)
|
|> assign(:search_counts, search_counts)
|
||||||
|> assign(:loading, false)
|
|
||||||
|> assign(:total_results, total_results)}
|
|> assign(:total_results, total_results)}
|
||||||
else
|
else
|
||||||
{:noreply, socket}
|
{:noreply, socket}
|
||||||
|
|||||||
@@ -22,20 +22,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- Loading state -->
|
|
||||||
<.loading_state :if={@loading} />
|
|
||||||
|
|
||||||
<!-- Empty state -->
|
<!-- Empty state -->
|
||||||
<.empty_state :if={@search_query == "" and not @loading} />
|
<.empty_state :if={@search_query == ""} />
|
||||||
|
|
||||||
<!-- No results -->
|
<!-- No results -->
|
||||||
<.no_results
|
<.no_results :if={@search_query != "" and @total_results == 0} query={@search_query} />
|
||||||
:if={@search_query != "" and @total_results == 0 and not @loading}
|
|
||||||
query={@search_query}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- Search results -->
|
<!-- Search results -->
|
||||||
<div :if={@total_results > 0 and not @loading} class="max-h-96 overflow-y-auto">
|
<div :if={@total_results > 0} class="max-h-96 overflow-y-auto">
|
||||||
<!-- Collection results -->
|
<!-- Collection results -->
|
||||||
<.search_result_group
|
<.search_result_group
|
||||||
:if={length(@search_results.collection) > 0}
|
:if={length(@search_results.collection) > 0}
|
||||||
|
|||||||
@@ -1128,11 +1128,6 @@ msgstr ""
|
|||||||
msgid "No results found for '%{query}'"
|
msgid "No results found for '%{query}'"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/components/search_components.ex
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "Searching..."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/music_library_web/components/search_components.ex
|
#: lib/music_library_web/components/search_components.ex
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "View all %{count} %{target} results →"
|
msgid "View all %{count} %{target} results →"
|
||||||
|
|||||||
@@ -1128,11 +1128,6 @@ msgstr ""
|
|||||||
msgid "No results found for '%{query}'"
|
msgid "No results found for '%{query}'"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/components/search_components.ex
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
|
||||||
msgid "Searching..."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/music_library_web/components/search_components.ex
|
#: lib/music_library_web/components/search_components.ex
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "View all %{count} %{target} results →"
|
msgid "View all %{count} %{target} results →"
|
||||||
|
|||||||
Reference in New Issue
Block a user