@<%= @room.domain %>

<%= if @live_action in [:new, :edit] do %> <.modal return_to={Routes.post_index_path(@socket, :index, @room)}> <.live_component current_user={@current_user} module={AggieditWeb.PostLive.FormComponent} id={@post.id || :new} title={@page_title} action={@live_action} post={@post} return_to={Routes.post_index_path(@socket, :index, @room)} /> <% end %> <%= live_patch "New Post", to: Routes.post_index_path(@socket, :new, @room) %>
<%= for post <- @posts do %>
<%= has_vote = Map.has_key?(@votes, post.id) is_upvote = has_vote && @votes[post.id].is_up "" %>
<%= link "", to: "#", phx_click: "upvote", phx_value_id: post.id, class: "bi bi-arrow-up-circle#{if has_vote && is_upvote, do: "-fill", else: ""}" %>
<%= post.score %>
<%= link "", to: "#", phx_click: "downvote", phx_value_id: post.id, class: "bi bi-arrow-down-circle#{if has_vote && !is_upvote, do: "-fill", else: ""}" %>
<%= if !is_nil(post.upload) do %> <%= live_redirect to: Routes.post_show_path(@socket, :show, @room, post) do %> <% end %> <% end %>
<%= live_redirect to: Routes.post_show_path(@socket, :show, @room, post) do %>

<%= post.title %>

<% end %>
aggie/<%= post.user.username %>

<%= post.body %>

<%= if Aggiedit.Roles.guard?(@current_user, :edit, post) && Aggiedit.Roles.guard?(@current_user, :edit, post) do %> <%= live_patch "Edit", to: Routes.post_index_path(@socket, :edit, @room, post) %> <%= link "Delete", to: "#", phx_click: "delete", phx_value_id: post.id %> <% end %>
<% end %>