Bug fixes

This commit is contained in:
Scott Idem
2025-08-12 14:19:54 -04:00
parent 1e20539b1a
commit 05d7e78444
2 changed files with 51 additions and 54 deletions

View File

@@ -47,7 +47,7 @@ import Help_tech from '$lib/e_app_help_tech.svelte';
// if (!archive_content_id) {
// $idaa_slct.archive_content_id = null;
// } else {
// console.log(`ae Posts - [archive_content_id] +page.ts: archive_content_id = `, archive_content_id);
// console.log(`ae Archives - [archive_content_id] +page.ts: archive_content_id = `, archive_content_id);
// $idaa_slct.archive_content_id = archive_content_id;
// $idaa_trig.archive_content_id = archive_content_id;
// }
@@ -109,6 +109,18 @@ let lq__archive_content_obj_li = $derived(liveQuery(async () => {
// .reverse()
.sortBy('tmp_sort_1');
if ($idaa_slct.archive_content_obj_li && JSON.stringify($idaa_slct.archive_content_obj_li) !== JSON.stringify(results)) {
$idaa_slct.archive_content_obj_li = [...results];
if (log_lvl) {
console.log(`$idaa_slct.archive_content_obj_li = `, $idaa_slct.archive_content_obj_li);
}
} else {
if (log_lvl) {
console.log(`Archive content object list has not changed for archive_id: ${$idaa_slct.archive_id}`);
}
}
return results;
}
@@ -118,16 +130,26 @@ let lq__archive_content_obj = $derived(liveQuery(async () => {
if (log_lvl) {
console.log(`lq__archive_content_obj: archive_content_id = ${$idaa_slct?.archive_content_id}`);
}
if ($idaa_slct.archive_content_id) {
// if ($idaa_slct.archive_content_id) {
let results = await db_archives.content
.get($idaa_slct.archive_content_id); // null or undefined does not reset things like '' does
.get($idaa_slct.archive_content_id ?? ''); // null or undefined does not reset things like '' does
// Check if results are different than the current $idaa_slct.archive_content_obj
if ($idaa_slct.archive_content_obj && results) {
if (JSON.stringify($idaa_slct.archive_content_obj) !== JSON.stringify(results)) {
$idaa_slct.archive_content_obj = { ...results };
if (log_lvl) {
console.log(`$idaa_slct.archive_content_obj = `, $idaa_slct.archive_content_obj);
}
} else {
if (log_lvl) {
console.log(`Archive content object has not changed for archive_content_id: ${$idaa_slct.archive_content_id}`);
}
}
}
return results;
}
// const results = await db_archives.content
// .get($idaa_slct.archive_content_id); // null or undefined does not reset things like '' does
// return results;
// }
}));
@@ -386,9 +408,10 @@ onDestroy(() => {
<!-- Modal: Archive Content edit ID -->
<!-- title="{$lq__archive_content_obj?.name ?? 'New Archive Content'} - {$lq__archive_content_obj?.id ?? 'Not Saved Yet'}" -->
<!-- {#if $idaa_sess.archives.show__modal_edit__archive_content_id} -->
<Modal
bind:open={$idaa_sess.archives.show__modal_edit__archive_content_id}
title="{$lq__archive_content_obj?.name ?? 'New Archive Content'} - {$lq__archive_content_obj?.id ?? 'Not Saved Yet'}"
autoclose={false}
placement="top-center"
size="xl"
@@ -403,25 +426,28 @@ onDestroy(() => {
<!-- <div class="ae_options"> -->
<button
onclick={() => {
// const url = new URL(location);
// url.searchParams.set('event_id', $lq__archive_content_obj?.event_id_random);
// history.pushState({}, '', url);
// const url = new URL(location);
// url.searchParams.set('event_id', $lq__archive_content_obj?.event_id_random);
// history.pushState({}, '', url);
$idaa_sess.archives.show__modal_view__archive_content_id = $idaa_slct.archive_content_id;
$idaa_sess.archives.show__modal_edit__archive_content_id = false;
}}
// $idaa_sess.archives.show__modal_view__archive_content_id = $idaa_slct.archive_content_id;
$idaa_slct.archive_content_id = null;
$idaa_slct.archive_content_obj = {};
$idaa_sess.archives.show__modal_edit__archive_content_id = false;
}}
class="novi_btn btn btn-sm preset-tonal-warning border border-warning-500 hover:preset-filled-warning-500 transition"
title={`View meeting: ${$lq__archive_content_obj?.name}`}
>
<span class="fas fa-eye m-1"></span> View
<span class="fas fa-eye m-1"></span> Cancel
</button>
<!-- </div> -->
{/if}
<span class="text-sm text-gray-500">
Edit Archive Content:
Edit Content:
</span>
{$lq__archive_content_obj?.name ?? 'New Archive Content'}
{$idaa_slct.archive_content_obj?.name ?? 'New Archive Content'}
</h3>
</div>
@@ -447,38 +473,9 @@ onDestroy(() => {
{/snippet}
</Modal>
<!-- {/if} -->
<!-- Modal: Archive Content ID media player -->
<!-- {#if $idaa_slct.archive_content_id && $idaa_sess.archives.show__modal_view__archive_content_id} -->
<!-- <Modal
bind:open={$idaa_sess.archives.show__modal_view__archive_content_id}
title="{$lq__archive_content_obj?.name} - {$lq__archive_content_obj?.archive_content_id}"
autoclose={true}
onclose={() => {
// We want to cancel the inline edit if the modal is closed
// $idaa_sess.archives.show__inline_edit__archive_content_id = false;
}}
outsideclose={true}
placement="top-center"
size="xl"
class=""
>
{#snippet header()}
<div class="flex flex-row items-center justify-between w-full">
<h3 class="text-lg font-semibold">
<span class="text-sm text-gray-500">
Viewing:
</span>
{$idaa_slct.archive_content_obj?.name} - {$lq__archive_content_obj?.archive_content_id}</h3>
</div>
{/snippet} -->
<!-- Showing and hiding a modal like this seems to cause an issue with where it is rendered on the page. The <Modal> should be moved back here and the actual "player" left mostly separate. 2025-07-10 -->
<!-- {#if $idaa_slct.archive_content_id} -->
<Modal_media_player

View File

@@ -1,4 +1,10 @@
<script lang="ts">
interface Props {
lq__archive_content_obj_li: any;
}
let { lq__archive_content_obj_li }: Props = $props();
// *** Import Svelte specific
import { goto, invalidate, pushState, replaceState } from '$app/navigation';
@@ -9,12 +15,6 @@ import { api } from '$lib/api';
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
interface Props {
lq__archive_content_obj_li: any;
}
let { lq__archive_content_obj_li }: Props = $props();
let ae_promises: key_val = $state({});
// let ae_tmp: key_val = {};
// let ae_triggers: key_val = {};