feat: show room info on chat live view
This commit is contained in:
parent
efd8914d74
commit
7d537c8148
@ -2,9 +2,24 @@ defmodule SlaxWeb.ChatRoomLive do
|
||||
@moduledoc false
|
||||
use SlaxWeb, :live_view
|
||||
|
||||
alias Slax.Repo
|
||||
alias Slax.Chat.Room
|
||||
|
||||
def render(assigns) do
|
||||
~H"""
|
||||
<div>Welcome to the chat!</div>
|
||||
<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>
|
||||
"""
|
||||
end
|
||||
|
||||
def mount(_params, _session, socket) do
|
||||
room = Room |> Repo.all() |> List.first()
|
||||
{:ok, assign(socket, :room, room)}
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user