From 689166a80defbf49ee8938b497ee4331a4999d59 Mon Sep 17 00:00:00 2001 From: Chili Palmer Date: Sun, 26 Apr 2026 07:44:31 +0200 Subject: [PATCH] fix: more alignment with the old shell Co-authored-by: Copilot --- lib/bds/desktop/shell_live.ex | 24 +++++++++++++++------- lib/bds/desktop/shell_live/index.html.heex | 1 + test/bds/desktop/shell_live_test.exs | 8 ++++++++ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/lib/bds/desktop/shell_live.ex b/lib/bds/desktop/shell_live.ex index c0f4879..4f6ee76 100644 --- a/lib/bds/desktop/shell_live.ex +++ b/lib/bds/desktop/shell_live.ex @@ -587,13 +587,23 @@ defmodule BDS.Desktop.ShellLive do <% end %> - <%= if Map.get(@sidebar_filters_config, :has_more) do %> - - <% 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""" + """ else ~H""" diff --git a/lib/bds/desktop/shell_live/index.html.heex b/lib/bds/desktop/shell_live/index.html.heex index 65b6c4e..fae2d0c 100644 --- a/lib/bds/desktop/shell_live/index.html.heex +++ b/lib/bds/desktop/shell_live/index.html.heex @@ -120,6 +120,7 @@ <%= render_sidebar_filters(assigns) %> <%= render_sidebar_body(assigns) %> + <%= render_sidebar_load_more(assigns) %> diff --git a/test/bds/desktop/shell_live_test.exs b/test/bds/desktop/shell_live_test.exs index b9b0170..ffa4dbf 100644 --- a/test/bds/desktop/shell_live_test.exs +++ b/test/bds/desktop/shell_live_test.exs @@ -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(),