Skip to content

Commit

Permalink
mix format
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrocp committed Oct 19, 2023
1 parent 770bdcc commit 1b6fdb3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
17 changes: 13 additions & 4 deletions lib/beacon/live_admin/live/page_editor_live/edit.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,19 @@ defmodule Beacon.LiveAdmin.PageEditorLive.Edit do
@impl true
def handle_params(%{"id" => id}, _url, socket) do
page = Content.get_page(socket.assigns.beacon_page.site, id)
%{ data: components } = BeaconWeb.API.ComponentJSON.index(%{
components: Content.list_components(socket.assigns.beacon_page.site, per_page: :infinity)
})
{:noreply, assign(socket, page_title: "Edit Page", page: page, visual_mode: true, components: components)}

%{data: components} =
BeaconWeb.API.ComponentJSON.index(%{
components: Content.list_components(socket.assigns.beacon_page.site, per_page: :infinity)
})

{:noreply,
assign(socket,
page_title: "Edit Page",
page: page,
visual_mode: true,
components: components
)}
end

@impl true
Expand Down
8 changes: 6 additions & 2 deletions lib/beacon/live_admin/live/page_editor_live/form_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ defmodule Beacon.LiveAdmin.PageEditorLive.FormComponent do
alias Beacon.LiveAdmin.Content

@impl true
def update(%{site: site, page: page, visual_mode: visual_mode, components: components} = assigns, socket) do
def update(
%{site: site, page: page, visual_mode: visual_mode, components: components} = assigns,
socket
) do
changeset = Content.change_page(site, page)
layouts = Content.list_layouts(site)
%{data: builder_page} = BeaconWeb.API.PageJSON.show(%{page: page})

{:ok,
socket
|> assign(assigns)
Expand Down Expand Up @@ -174,7 +178,7 @@ defmodule Beacon.LiveAdmin.PageEditorLive.FormComponent do
</.modal>
<%= if @visual_mode do %>
<.svelte name="components/UiBuilder" class="relative overflow-x-hidden" props={%{components: @components, page: @builder_page }} socket={@socket} />
<.svelte name="components/UiBuilder" class="relative overflow-x-hidden" props={%{components: @components, page: @builder_page}} socket={@socket} />
<% else %>
<div class="grid items-start lg:h-[calc(100vh_-_144px)] grid-cols-1 mx-auto mt-4 gap-x-8 gap-y-8 lg:mx-0 lg:max-w-none lg:grid-cols-3">
<div class="p-4 bg-white col-span-full lg:col-span-1 rounded-[1.25rem] lg:rounded-t-[1.25rem] lg:rounded-b-none lg:h-full">
Expand Down

0 comments on commit 1b6fdb3

Please sign in to comment.