.header>
Listing Users
<:actions>
<.link patch={~p"/users/new"}>
<.button>New User
<.table
id="users"
rows={@streams.users}
row_click={fn {_id, user} -> JS.navigate(~p"/users/#{user}") end}
>
<:col :let={{_id, user}} label="Name"><%= user.name %>
<:col :let={{_id, user}} label="Avatar url"><%= user.avatar_url %>
<:col :let={{_id, user}} label="Color"><%= user.color %>
<:action :let={{_id, user}}>
<.link navigate={~p"/users/#{user}"}>Show
<.link patch={~p"/users/#{user}/edit"}>Edit
<:action :let={{id, user}}>
<.link
phx-click={JS.push("delete", value: %{id: user.id}) |> hide("##{id}")}
data-confirm="Are you sure?"
>
Delete
<.modal :if={@live_action in [:new, :edit]} id="user-modal" show on_cancel={JS.patch(~p"/users")}>
<.live_component
module={HomemanWeb.UserLive.FormComponent}
id={@user.id || :new}
title={@page_title}
action={@live_action}
user={@user}
patch={~p"/users"}
/>