More work on the posters and Websockets

This commit is contained in:
Scott Idem
2025-10-13 17:19:32 -04:00
parent de071dae49
commit 8f7c1bf428
7 changed files with 108 additions and 52 deletions

View File

@@ -344,7 +344,7 @@ function handle_ws_recv(ws_recv_status: any) {
if ($events_loc.launcher.controller != 'remote') {
if (log_lvl) {
console.log('Controller is not set to remote. Ignoring command.', cmd);
console.log('Ignoring WS command. Launcher is not set to be remotely controlled.', cmd);
}
return;
}
@@ -440,17 +440,21 @@ function handle_ws_recv(ws_recv_status: any) {
clearInterval(idle_timer_interval);
$events_slct.event_file_id = obj_id;
$events_sess.launcher.modal__open = $events_slct.event_file_id;
let modal_title = null;
if (!modal_title) {
modal_title = '*'; // event_file_obj.filename;
}
$events_sess.launcher.modal__title = modal_title;
$events_sess.launcher.modal__open_event_file_id = $events_slct.event_file_id;
// $events_sess.launcher.modal__event_file_obj = event_file_obj;
// $events_sess.launcher.modal__img_src = `/event/file/${event_file_obj.event_file_id_random}/download`;
// $events_slct.event_file_obj = event_file_obj;
// $slct_trigger = 'event_file';
// $events_sess.launcher.event_file_open.open_status = 'open';
@@ -477,7 +481,11 @@ function handle_ws_recv(ws_recv_status: any) {
// let obj_id = obj_parts[1];
if (what == 'event_file_modal') {
$events_sess.launcher.modal__open = false;
$events_sess.launcher.modal__title = '';
$events_sess.launcher.modal__open_event_file_id = null;
$events_sess.launcher.modal__event_file_obj = null;
// $events_sess.launcher.modal__img_src = null;
// $events_slct.event_file_id = null;
// $slct_trigger = 'event_file';
// $events_sess.launcher.event_file_open.open_status = 'close';
@@ -523,6 +531,11 @@ $effect(() => {
$slct_trigger = null;
// handle_event_file_open();
}
// if ($events_sess.launcher.trigger_open_file) {
// $events_sess.launcher.trigger_modal_open_file = false;
// handle_event_file_open();
// }
});
$effect(() => {
@@ -1093,9 +1106,11 @@ $effect(() => {
<!-- Main modal -->
<!-- NOTE: The modal size is intentionally set to "". This makes it undefined and allows the modal to be as large as the content. -->
<!-- bind:open={$events_sess.launcher.modal__open_event_file_id} -->
<!-- {#if $events_sess.launcher.modal__open_event_file_id} -->
<Modal
title={$events_sess.launcher?.modal__title}
bind:open={$events_sess.launcher.modal__open}
open={$events_sess.launcher?.modal__open_event_file_id}
autoclose={false}
size=""
class="bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200 rounded-lg border-gray-200 dark:border-gray-700 divide-gray-200 dark:divide-gray-700 shadow-md relative flex flex-col mx-auto w-full divide-y m-0"
@@ -1103,7 +1118,8 @@ $effect(() => {
classHeader="px-1 py-0 md:px-1 md:py-0 absolute top-0 start-0 end-0 bg-gray-200 dark:bg-gray-800 opacity-50 hover:opacity-75"
bodyClass='p-0 flex-1 overflow-y-auto overscroll-contain'
classBody="flex flex-col items-center p-0 md:px-0 py-0"
on:close={async () => {
onclose={async () => {
$events_sess.launcher.modal__open_event_file_id = null;
if ($events_loc.launcher.controller == 'local_push' && $events_sess.launcher.ws_connect_status == 'connected') {
// // This should work....????
// console.log(`TEST - FAIL??? Local Push Controller Command: ae_close:event_file_modal`);
@@ -1140,14 +1156,14 @@ $effect(() => {
<span class="fas fa-times m-1"></span>
Close Remote Poster Display Only
</button>
Open: {$ae_api.base_url} {$events_sess.launcher.modal__open}
Open: {$ae_api.base_url} {$events_sess.launcher.modal__open_event_file_id}
<!-- /event/file/{$events_slct.event_file_obj.event_file_id_random}/download?filename={$events_slct.event_file_obj.filename}&x_no_account_id_token=direct-download -->
<!-- <span class="aspect-9/16 max-h-96"> -->
{#if $events_sess.launcher.modal__open}
{#if $events_sess.launcher.modal__open_event_file_id}
<img
src="{$ae_api.base_url}/event/file/{$events_sess.launcher.modal__open}/download?filename={$events_slct.event_file_obj.filename}&x_no_account_id_token=direct-download"
alt="Placeholder: /event/file/{$events_sess.launcher.modal__open}/download?filename={$events_slct.event_file_obj.filename}&x_no_account_id_token=direct-download"
class="margin-auto max-h-full max-w-full"
src="{$ae_api.base_url}/event/file/{$events_sess.launcher.modal__open_event_file_id}/download?filename={$events_slct.event_file_obj.filename}&x_no_account_id_token=direct-download"
alt="Placeholder: /event/file/{$events_sess.launcher.modal__open_event_file_id}/download?filename={$events_slct.event_file_obj.filename}&x_no_account_id_token=direct-download"
class="margin-auto min-h-28 max-h-full max-w-full"
/>
{:else}
<div class="flex flex-row items-center justify-center p-4">
@@ -1177,7 +1193,10 @@ $effect(() => {
<button
onclick={() => {
$events_sess.launcher.modal__open = false;
// $events_sess.launcher.modal__open = false;
$events_sess.launcher.modal__title = '';
$events_sess.launcher.modal__open_event_file_id = null;
$events_sess.launcher.modal__event_file_obj = null;
}}
class="absolute bottom-0 right-20 m-1 p-1 btn btn-sm preset-tonal-warning hover:preset-tonal-warning border border-warning-500"
class:hidden={!$ae_loc.trusted_access && ($events_loc.launcher.controller != 'local_push' || $events_sess.launcher.ws_connect_status != 'connected')}
@@ -1203,6 +1222,9 @@ $effect(() => {
</Modal>
<!-- {:else}
{$events_sess.launcher.modal__open_event_file_id}
{/if} -->
{#if $events_loc.launcher.controller_group_code && $events_loc.launcher.ws_connect}
<!-- {$ae_api.base_url} -->