Skip to content

Commit

Permalink
Format files
Browse files Browse the repository at this point in the history
  • Loading branch information
alxlion committed Dec 1, 2023
1 parent b08462b commit aafbc1b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
17 changes: 14 additions & 3 deletions lib/claper_web/live/event_live/form_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ defmodule ClaperWeb.EventLive.FormComponent do
<% end %>
</div>
<div class="flex items-center gap-4">
<button
<div class="flex items-center gap-4">
<button
type="submit"
class="px-3 py-2 text-white font-semibold bg-primary-500 hover:bg-primary-600 rounded-md my-5"
>
Expand All @@ -99,7 +99,18 @@ defmodule ClaperWeb.EventLive.FormComponent do
<%= unless is_nil(assigns.current_form_submit) do %>
<div class="flex gap-1 text-green-500 text-sm">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" /><path d="M9 12l2 2l4 -4" /></svg>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none" /><path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" /><path d="M9 12l2 2l4 -4" />
</svg>
<span><%= gettext("Saved") %></span>
</div>
<% end %>
Expand Down
9 changes: 5 additions & 4 deletions lib/claper_web/live/event_live/manage.ex
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ defmodule ClaperWeb.EventLive.Manage do
{:noreply,
socket
|> update(:all_posts, fn posts -> [updated_post | posts] end)
|> update(:pinned_posts, fn posts -> [updated_post | posts] end)
}
|> update(:pinned_posts, fn posts -> [updated_post | posts] end)}
end

@impl true
Expand All @@ -97,8 +96,9 @@ defmodule ClaperWeb.EventLive.Manage do
socket
|> update(:all_posts, fn posts -> [deleted_post | posts] end)
|> update(:pinned_posts, fn posts -> [deleted_post | posts] end)
|> update(:pinned_post_count, fn pinned_post_count -> pinned_post_count - if deleted_post.pinned, do: 1, else: 0 end)
}
|> update(:pinned_post_count, fn pinned_post_count ->
pinned_post_count - if deleted_post.pinned, do: 1, else: 0
end)}
end

@impl true
Expand All @@ -119,6 +119,7 @@ defmodule ClaperWeb.EventLive.Manage do
|> update(:all_posts, fn all_posts -> [post | all_posts] end)
|> update(:pinned_posts, fn pinned_posts -> [post | pinned_posts] end)
|> assign(:pinned_post_count, socket.assigns.pinned_post_count - 1)

{:noreply, updated_socket}
end

Expand Down
6 changes: 5 additions & 1 deletion lib/claper_web/live/event_live/manage.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,11 @@

<div class="grid grid-cols-1 grid-rows-2 md:grid-rows-3" style="height: 100%;">
<div class="bg-gray-200 md:row-span-2 border-2">
<ul id="menu" phx-update="replace" class="fixed z-20 flex items-center bg-gray-200 space-x-3 px-2 w-full py-2">
<ul
id="menu"
phx-update="replace"
class="fixed z-20 flex items-center bg-gray-200 space-x-3 px-2 w-full py-2"
>
<li class={"rounded-md #{if @list_tab==:posts, do: 'bg-secondary-600 text-white' ,
else: 'bg-white text-gray-600' } px-2 py-0.5 text-sm shadow-sm"}>
<%= link(gettext("Messages"), to: "#", phx_click: "list-tab", phx_value_tab: :posts) %>
Expand Down

0 comments on commit aafbc1b

Please sign in to comment.