refactor(microprints): move expand/collapse button above microprint

- Button is now on top of the card, matching qwan-tracker layout
- Microprint SVG shown when collapsed, source viewer when expanded
- Fixes DOM confusion from duplicate source-viewer IDs by only
  rendering one source_viewer at a time
This commit is contained in:
Willem van den Ende 2026-05-15 16:12:43 +01:00
parent 3434042aed
commit aaf4c6a2c7

View File

@ -55,19 +55,10 @@ defmodule FirehoseWeb.MicroprintsLive do
</h3> </h3>
<%= if microprint do %> <%= if microprint do %>
<.microprint
microprint={microprint}
width={200}
max_height={100}
clickable={true}
file_path={path}
highlighted_line={@highlighted_line}
/>
<button <button
phx-click="toggle_expand" phx-click="toggle_expand"
phx-value-path={path} phx-value-path={path}
class="btn btn-xs btn-ghost mt-2 w-full" class="btn btn-xs btn-ghost w-full"
> >
<%= if @expanded_path == path do %> <%= if @expanded_path == path do %>
Collapse Collapse
@ -82,6 +73,15 @@ defmodule FirehoseWeb.MicroprintsLive do
highlighted_line={@highlighted_line} highlighted_line={@highlighted_line}
language="elixir" language="elixir"
/> />
<% else %>
<.microprint
microprint={microprint}
width={200}
max_height={100}
clickable={true}
file_path={path}
highlighted_line={@highlighted_line}
/>
<% end %> <% end %>
<% else %> <% else %>
<div class="text-xs text-red-500 mt-1"> <div class="text-xs text-red-500 mt-1">