feat(chat): updates made on Jan-2025
Some updates were made to the course and described in this post: * https://arrowsmithlabs.com/blog/learn-phoenix-liveview-update-guide-january-2025
This commit is contained in:
@@ -16,12 +16,15 @@ defmodule SlaxWeb.ChatRoomLive.Index do
|
||||
:for={{id, {room, joined?}} <- @streams.rooms}
|
||||
class="cursor-pointer p-4 flex justify-between items-center group first:rounded-t last:rounded-b"
|
||||
id={id}
|
||||
phx-click={JS.navigate(~p"/rooms/#{room}")}
|
||||
phx-click={open_room(room)}
|
||||
phx-keydown={open_room(room)}
|
||||
phx-key="Enter"
|
||||
tabindex="0"
|
||||
>
|
||||
<div>
|
||||
<div class="font-medium mb-1">
|
||||
#{room.name}
|
||||
<span class="mx-1 text-gray-500 font-light text-sm opacity-0 group-hover:opacity-100">
|
||||
<span class="mx-1 text-gray-500 font-light text-sm hidden group-hover:inline group-focus:inline">
|
||||
View room
|
||||
</span>
|
||||
</div>
|
||||
@@ -77,4 +80,8 @@ defmodule SlaxWeb.ChatRoomLive.Index do
|
||||
|
||||
{:noreply, stream_insert(socket, :rooms, {room, joined?})}
|
||||
end
|
||||
|
||||
defp open_room(room) do
|
||||
JS.navigate(~p"/rooms/#{room}")
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user