1
0
mirror of https://github.com/algora-io/tv.git synced 2024-11-16 00:58:59 +02:00

enable chat for all videos

This commit is contained in:
zafer 2024-03-07 03:00:07 +03:00
parent 2aa886f23e
commit b9379ebfe5
2 changed files with 4 additions and 10 deletions

View File

@ -26,15 +26,11 @@ const init = () => {
main.classList.remove("lg:mr-[24rem]");
};
const join = ({ id, type }) => {
const join = ({ id }) => {
if (channel) {
leave(channel);
}
if (type !== "livestream") {
return;
}
player = player;
channel = socket.channel(`room:${id}`, {});
chatBox = document.querySelector("#chat-box");

View File

@ -15,7 +15,7 @@ defmodule AlgoraWeb.ChatLive do
<aside id="chat-box" class="hidden fixed top-[64px] right-0 w-0 flex-col pr-4">
<div class="p-4 bg-gray-800/40 backdrop-blur-xl rounded-2xl shadow-inner shadow-white/[10%] border border-white/[15%]">
<div class="pb-2 text-center text-gray-400 text-xs font-medium uppercase tracking-wide">
Stream chat
Chat
</div>
<div
id="chat-messages"
@ -56,12 +56,10 @@ defmodule AlgoraWeb.ChatLive do
def handle_info({Library, _}, socket), do: {:noreply, socket}
def handle_event("join", %{"video_id" => video_id}, socket) do
video = Library.get_video!(video_id)
socket =
socket
|> assign(messages: Chat.list_messages(%Video{id: video.id}))
|> push_event("join_chat", %{id: video.id, type: video.type})
|> assign(messages: Chat.list_messages(%Video{id: video_id}))
|> push_event("join_chat", %{id: video_id})
{:noreply, socket}
end