defmodule LiveDebugger.App.Web.Layout do
@moduledoc """
Layout of the Application.
It uses `phoenix` and `phoenix_live_view.js` of debugged application to dependency conflicts.
"""
use Phoenix.Component
@doc false
def render(template, assigns)
def render("root.html", assigns) do
~H"""
<%= custom_head_tags(assigns, :after_opening_head_tag) %>
LiveDebugger
<%= custom_head_tags(assigns, :before_closing_head_tag) %>
<%= @inner_content %>
"""
end
def render("app.html", assigns) do
~H"""
<%= @inner_content %>
"""
end
defp custom_head_tags(assigns, key) do
case assigns do
%{^key => components} when is_list(components) ->
assigns = assign(assigns, :components, components)
~H"""
<%= for component <- @components do %>
<%= component.(assigns) %>
<% end %>
"""
_ ->
nil
end
end
end