Fix layouts and streams

This commit is contained in:
Alex
2024-04-27 12:38:04 +02:00
parent 3a6f949ecd
commit b78e01a162
3 changed files with 6 additions and 3 deletions

View File

@@ -317,6 +317,7 @@ defmodule Claper.Forms do
|> Repo.insert_or_update()
|> case do
{:ok, r} ->
r = Repo.preload(r, :form) # Preloading form in FormSubmit
case fs do
nil -> broadcast({:ok, r, event_uuid}, :form_submit_created)
_form_submit -> broadcast({:ok, r, event_uuid}, :form_submit_updated)

View File

@@ -38,6 +38,7 @@ defmodule ClaperWeb.EventLive.Manage do
posts = list_all_posts(socket, event.uuid)
pinned_posts = list_pinned_posts(socket, event.uuid)
questions = list_all_questions(socket, event.uuid)
form_submits = list_form_submits(socket, event.presentation_file.id)
socket =
socket
@@ -49,12 +50,13 @@ defmodule ClaperWeb.EventLive.Manage do
|> stream(:posts, posts)
|> stream(:questions, questions)
|> stream(:pinned_posts, pinned_posts)
|> stream(:form_submits, form_submits)
|> assign(:pinned_post_count, length(pinned_posts))
|> assign(:question_count, length(questions))
|> assign(:post_count, length(posts))
|> assign(
:form_submit_count,
length(list_form_submits(socket, event.presentation_file.id))
length(form_submits)
)
|> assign(:polls, list_polls(socket, event.presentation_file.id))
|> assign(:forms, list_forms(socket, event.presentation_file.id))

View File

@@ -85,10 +85,10 @@
<!-- MESSAGES -->
<div
id="slider-wrapper"
class="w-full min-h-screen flex items-center justify-center relative bg-black"
class={"w-full min-h-screen flex items-center #{if @event.presentation_file.length > 0 || @current_embed, do: 'justify-start', else: 'justify-center'} relative bg-black"}
>
<div
class={"#{if @state.chat_visible, do: (if @event.presentation_file.length > 0, do: 'opacity-100 w-3/12 px-4 showed', else: 'opacity-100 w-2/3 px-4 showed'), else: 'opacity-0 w-0 p-0'} transition-all duration-150 flex flex-col h-screen py-5 justify-end max-h-screen bg-black"}
class={"#{if @state.chat_visible, do: (if @event.presentation_file.length > 0 || @current_embed, do: 'opacity-100 w-3/12 px-4 showed', else: 'opacity-100 w-2/3 px-4 showed'), else: 'opacity-0 w-0 p-0'} transition-all duration-150 flex flex-col h-screen py-5 justify-end max-h-screen bg-black"}
id="post-list-wrapper"
phx-update="replace"
>