Better sorting of presentations and session files. Slight style changes.

This commit is contained in:
Scott Idem
2024-10-18 19:14:20 -04:00
parent 295fa1b49a
commit 2d644aafe8
3 changed files with 89 additions and 11 deletions

View File

@@ -14,6 +14,9 @@ export let msg: null|string = null;
export let type: null|string = null; // msg, cmd, json, hello, bye
export let trigger_send: any = null;
export let classes: string = 'container p-1 bg-pink-100 text-xs mx-auto pb-16 mb-20 sm:mb-12 md:mb-8';
export let hide__ws_form: boolean = true;
export let hide__ws_messages: boolean = false;
export let hide__ws_commands: boolean = false;
// *** Set initial variables
const dispatch = createEventDispatcher();
@@ -227,12 +230,63 @@ function handle_send_ws_data() {
</script>
<section class="ae_element__websocket container p-1 bg-pink-100 text-xs mx-auto pb-16 mb-20 ">
<section class="ae_element__websocket container p-1 bg-pink-100 text-xs mx-auto pb-16 mt-32 mb-32 relative">
<span class="absolute top-0 right-0 flex flex-col gap-1">
<button
type="button"
on:click={() => {
hide__ws_form = !hide__ws_form;
}}
class="btn btn-sm text-xs hover:variant-filled-tertiary"
class:variant-soft-tertiary={hide__ws_form}
class:variant-filled-tertiary={!hide__ws_form}
>
{#if hide__ws_form}
Show Form
{:else}
Hide Form?
{/if}
</button>
<button
type="button"
on:click={() => {
hide__ws_messages = !hide__ws_messages;
}}
class="btn btn-sm text-xs hover:variant-filled-tertiary"
class:variant-soft-tertiary={hide__ws_messages}
class:variant-filled-tertiary={!hide__ws_messages}
>
{#if hide__ws_messages}
Show Messages
{:else}
Hide Messages?
{/if}
</button>
<button
type="button"
on:click={() => {
hide__ws_commands = !hide__ws_commands;
}}
class="btn btn-sm text-xs hover:variant-filled-tertiary"
class:variant-soft-tertiary={hide__ws_commands}
class:variant-filled-tertiary={!hide__ws_commands}
>
{#if hide__ws_commands}
Show Commands
{:else}
Hide Commands?
{/if}
</button>
</span>
<header>
<h1 class="font-bold text-center">Websocket Messages &amp; Commands</h1>
<h1 class="h6 text-center">Websocket Messages &amp; Commands</h1>
</header>
<!-- <form on:submit|preventDefault={handle_send_message}>
<select bind:value={type}>
<option value="">None</option>
@@ -255,17 +309,22 @@ function handle_send_ws_data() {
<button>Send</button>
</form> -->
{#if 1==1}
<form on:submit|preventDefault={handle_send_ws_data}>
<!-- <select bind:value={type}>
{#if !hide__ws_form}
<form
on:submit|preventDefault={handle_send_ws_data}
>
<select
bind:value={ws_data.type}
class="input text-sm w-24"
>
<option value="">None</option>
<option value="echo">Echo</option>
<option value="dm">Direct Message</option>
<option value="group">Group Message</option>
<option value="all">Broadcast to All</option>
<option value="cmd">Command</option>
</select> -->
</select>
<input type="text" bind:value={group_id} placeholder="Group ID" class="input text-sm w-36" />
<!-- <select bind:value={group_id}>
<option value="">None</option>
<option value="test_grp_123">123</option>
@@ -281,7 +340,7 @@ function handle_send_ws_data() {
<button
type="submit"
class="btn btn-sm variant-soft-warning"
>Send Example Group</button>
>Send Group</button>
</form>
{/if}
@@ -293,6 +352,9 @@ ae_open:event_file=Kljq0uiTlXt (video)
<!-- <hr> -->
<section
class:hidden={hide__ws_messages}
>
<h2 class="text-center underline">Messages [grp, client, target, type]</h2>
<ol class="list-decimal list-outside max-h-24 overflow-y-auto messages">
@@ -320,9 +382,13 @@ ae_open:event_file=Kljq0uiTlXt (video)
</li>
{/each}
</ol>
</section> <!-- End Messages -->
<hr>
<section
class:hidden={hide__ws_commands}
>
<h2 class="text-center underline">Commands</h2>
<ol class="list-decimal list-outside max-h-24 overflow-y-auto commands">
@@ -349,6 +415,8 @@ ae_open:event_file=Kljq0uiTlXt (video)
</li>
{/each}
</ol>
</section> <!-- End Commands -->
</section>

View File

@@ -655,7 +655,7 @@ export let close_event_file_as_modal = function close_event_file_as_modal({}) {
<button
type="button"
on:click={() => ($events_loc.launcher.hide_drawer__cfg = false)}
class="btn btn-sm p-0.5 variant-soft-error hover:variant-filled-error transition-all duration-1000"
class="btn btn-sm p-2.5 variant-soft-error hover:variant-filled-error transition-all duration-1000"
class:opacity-25={!$ae_loc.trusted_access}
class:hover:opacity-75={!$ae_loc.trusted_access}
>
@@ -876,6 +876,10 @@ export let close_event_file_as_modal = function close_event_file_as_modal({}) {
type={'cmd'}
bind:trigger_send={$events_sess.launcher.controller_trigger_send}
bind:hide__ws_form={$events_loc.launcher.hide__ws_form}
bind:hide__ws_messages={$events_loc.launcher.hide__ws_messages}
bind:hide__ws_commands={$events_loc.launcher.hide__ws_commands}
on:ws_conn={handle_ws_conn}
on:ws_recv={handle_ws_recv}
on:ws_sent={handle_ws_sent}

View File

@@ -56,7 +56,9 @@ let lq__event_file_obj_li = liveQuery(
// .where('event_session_id_random')
.where('for_id_random')
.equals($events_slct.event_session_id)
.sortBy('filename')
.reverse() // Need reverse for created_on newest first.
.sortBy('created_on') // or filename
);
// Does not refresh when the event_file_id_li_json changes.
@@ -73,10 +75,14 @@ let lq__event_file_obj_li = liveQuery(
// );
$: lq__event_presentation_obj_li = liveQuery(async () => {
let sort_by = 'start_datetime';
if ($lq__event_session_obj.type_code == 'poster') {
sort_by = 'name';
}
let results = await db_events.presentations
.where('event_session_id_random')
.equals($events_slct.event_session_id)
.sortBy('start_datetime');
.sortBy(sort_by);
// .sortBy('name')
return results;