fix: more alignment with the old shell
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -587,13 +587,23 @@ defmodule BDS.Desktop.ShellLive do
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= if Map.get(@sidebar_filters_config, :has_more) do %>
|
||||
<div class="sidebar-load-more">
|
||||
<button class="load-more-button" data-testid="sidebar-load-more" type="button" phx-click="load_more_sidebar">
|
||||
<%= translated("Load more") %>
|
||||
</button>
|
||||
</div>
|
||||
<% end %>
|
||||
"""
|
||||
else
|
||||
~H"""
|
||||
"""
|
||||
end
|
||||
end
|
||||
|
||||
defp render_sidebar_load_more(assigns) do
|
||||
filters = Map.get(assigns.sidebar_data, :filters, %{})
|
||||
|
||||
if Map.get(filters, :has_more) do
|
||||
~H"""
|
||||
<div class="sidebar-load-more">
|
||||
<button class="load-more-button" data-testid="sidebar-load-more" type="button" phx-click="load_more_sidebar">
|
||||
<%= translated("Load more") %>
|
||||
</button>
|
||||
</div>
|
||||
"""
|
||||
else
|
||||
~H"""
|
||||
|
||||
@@ -120,6 +120,7 @@
|
||||
</div>
|
||||
<%= render_sidebar_filters(assigns) %>
|
||||
<%= render_sidebar_body(assigns) %>
|
||||
<%= render_sidebar_load_more(assigns) %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="resizable-panel-divider sidebar-divider" data-resize="sidebar" data-role="resize-handle"></div>
|
||||
|
||||
@@ -228,6 +228,7 @@ defmodule BDS.Desktop.ShellLiveTest do
|
||||
assert html =~ ~s(class="sidebar-section-header")
|
||||
assert html =~ ~s(class="sidebar-actions")
|
||||
assert html =~ ~s(data-testid="sidebar-load-more")
|
||||
assert html_position(html, ~s(data-testid="sidebar-load-more")) > html_position(html, ">Archived<")
|
||||
refute html =~ ~s(data-testid="sidebar-filter-tag")
|
||||
assert html =~ "Alpha Post"
|
||||
refute html =~ "Overflow Post"
|
||||
@@ -398,6 +399,13 @@ defmodule BDS.Desktop.ShellLiveTest do
|
||||
assert count == length(entries)
|
||||
end
|
||||
|
||||
defp html_position(html, needle) do
|
||||
case :binary.match(html, needle) do
|
||||
{index, _length} -> index
|
||||
:nomatch -> -1
|
||||
end
|
||||
end
|
||||
|
||||
defp sidebar_post(project_id, slug, title, timestamp, tags, categories) do
|
||||
%{
|
||||
id: Ecto.UUID.generate(),
|
||||
|
||||
Reference in New Issue
Block a user