2024-10-07 23:21:49 +00:00
|
|
|
defmodule SlaxWeb.ChatRoomLive do
|
|
|
|
@moduledoc false
|
|
|
|
use SlaxWeb, :live_view
|
|
|
|
|
2024-10-09 00:12:59 +00:00
|
|
|
alias Slax.Repo
|
|
|
|
alias Slax.Chat.Room
|
|
|
|
|
2024-10-07 23:21:49 +00:00
|
|
|
def render(assigns) do
|
|
|
|
~H"""
|
2024-10-09 00:12:59 +00:00
|
|
|
<div class="flex flex-col flex-grow shadow-lg">
|
|
|
|
<div class="flex justify-between items-center flex-shrink-0 h-16 bg-white border-b border-slate-300 px-4">
|
|
|
|
<div class="flex flex-col gap-1.5">
|
|
|
|
<h1 class="text-sm font-bold leading-none">#<%= @room.name %></h1>
|
|
|
|
<div class="text-xs leading-none h-3.5"><%= @room.topic %></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-10-07 23:21:49 +00:00
|
|
|
"""
|
|
|
|
end
|
2024-10-09 00:12:59 +00:00
|
|
|
|
|
|
|
def mount(_params, _session, socket) do
|
|
|
|
room = Room |> Repo.all() |> List.first()
|
|
|
|
{:ok, assign(socket, :room, room)}
|
|
|
|
end
|
2024-10-07 23:21:49 +00:00
|
|
|
end
|