Lots of clean up. Going to go with backup plan for IDAA and dealing with the Novi iframes.

This commit is contained in:
Scott Idem
2025-06-27 15:01:46 -04:00
parent 9914fd1700
commit fbcebcf816
10 changed files with 230 additions and 71 deletions

View File

@@ -1,27 +1,26 @@
<script lang="ts">
import { run } from 'svelte/legacy';
import { page } from '$app/state';
interface Props {
/** @type {import('./$types').PageData} */
data: any;
}
let { data }: Props = $props();
let log_lvl: number = $state(0);
if (log_lvl) {
console.log(`ae_idaa_bb +page.svelte data:`, data);
}
// *** Import Svelte specific
import { page } from '$app/state';
import { browser } from '$app/environment';
// import { goto, invalidate, pushState, replaceState } from '$app/navigation';
// *** Import other supporting libraries
import { Modal } from 'flowbite-svelte';
import { liveQuery } from "dexie";
// *** Import Aether specific variables and functions
// import type { key_val } from '$lib/ae_stores';
// import { ae_util } from '$lib/ae_utils/ae_utils';
import { liveQuery } from "dexie";
import { core_func } from '$lib/ae_core/ae_core_functions';
import { db_posts } from "$lib/ae_posts/db_posts";
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
@@ -85,7 +84,6 @@ let lq__post_comment_obj = $derived(liveQuery(async () => {
}));
$effect(() => {
if ($idaa_trig.post_li) {
$idaa_trig.post_li = false;
@@ -174,6 +172,9 @@ $effect(() => {
if (browser) {
console.log('Browser environment detected.');
let message = {'post_id': $idaa_slct?.post_id ?? null};
window.parent.postMessage(message, "*");
add_activity_log(
{
action: 'idaa_bb_page',
@@ -335,6 +336,11 @@ function add_activity_log(
onclick={() => {
$idaa_sess.bb.show__modal_view__post_id = false;
$idaa_sess.bb.show__inline_edit__post_obj = false;
$idaa_slct.post_id = null;
$idaa_slct.post_obj = null;
let message = {'post_id': $idaa_slct.post_id ?? null};
window.parent.postMessage(message, "*");
}}
>
<span class="fas fa-times"></span>
@@ -355,6 +361,11 @@ function add_activity_log(
onclick={() => {
$idaa_sess.bb.show__modal_view__post_id = false;
$idaa_sess.bb.show__inline_edit__post_obj = false;
$idaa_slct.post_id = null;
$idaa_slct.post_obj = null;
let message = {'post_id': $idaa_slct.post_id ?? null};
window.parent.postMessage(message, "*");
}}
>
<span class="fas fa-times"></span>

View File

@@ -1,4 +1,5 @@
<script lang="ts">
import { onDestroy } from 'svelte';
import { browser } from '$app/environment';
@@ -12,27 +13,33 @@ import { idaa_loc, idaa_sess, idaa_slct, idaa_trig } from '$lib/ae_idaa_stores';
import Comp__post_obj_id_edit from './ae_idaa_comp__post_obj_id_edit.svelte';
import Comp__post_comment_obj_id_edit from './ae_idaa_comp__post_comment_obj_id_edit.svelte';
export let lq__post_obj: any;
export let lq__post_comment_obj_li: any;
export let lq__post_comment_obj: any;
interface Props {
lq__post_obj: any;
lq__post_comment_obj_li: any;
lq__post_comment_obj: any;
}
let ae_promises: key_val = {};
let { lq__post_obj, lq__post_comment_obj_li, lq__post_comment_obj }: Props = $props();
let ae_promises: key_val = $state({});
if ($idaa_slct.post_id) {
console.log(`Post ID selected: ${$idaa_slct.post_id}`);
console.log(`Post Object selected: ${lq__post_obj}`);
console.log(`Post Object title: ${$lq__post_obj?.title}`);
console.log(`Post Object selected: `, $lq__post_obj);
console.log(`Post Object title (name): ${$lq__post_obj?.title}`);
$idaa_trig.post_id = $idaa_slct.post_id;
}
$: if (browser && $lq__post_obj?.post_id) {
document.body.scrollIntoView();
$effect(() => {
if (browser && $lq__post_obj?.post_id) {
document.body.scrollIntoView();
const url = new URL(location);
url.searchParams.set('post_id', $lq__post_obj?.post_id);
history.pushState({}, '', url);
}
const url = new URL(location);
url.searchParams.set('post_id', $lq__post_obj?.post_id);
history.pushState({}, '', url);
}
});
onDestroy(() => {
console.log('** Component Destroyed: ** View - Post Obj');
@@ -152,7 +159,7 @@ onDestroy(() => {
<button
type="button"
disabled={!$ae_loc.trusted_access}
on:click={() => {
onclick={() => {
ae_promises[linked_obj.hosted_file_id_random] = api.download_hosted_file({
api_cfg: $ae_api,
hosted_file_id: linked_obj.hosted_file_id_random,
@@ -239,7 +246,7 @@ onDestroy(() => {
{#if ($ae_loc.trusted_access && $ae_loc.edit_mode) || $idaa_loc.novi_uuid}
<button
type="button"
on:click={() => {
onclick={() => {
if (confirm('Are you sure you want to add a new comment?')) {
$idaa_slct.post_comment_id = null;
$idaa_slct.post_comment_obj = {};
@@ -257,7 +264,7 @@ onDestroy(() => {
{#if ($ae_loc.trusted_access && $ae_loc.edit_mode) || $lq__post_obj?.external_person_id === $idaa_loc.novi_uuid}
<button
type="button"
on:click={() => {
onclick={() => {
// $idaa_slct.post_id = $idaa_slct.post_obj.post_id_random;
$idaa_slct.post_obj = $lq__post_obj; // In case things changed
@@ -337,7 +344,7 @@ onDestroy(() => {
<div class="ae_options">
<button
type="button"
on:click={() => {
onclick={() => {
$idaa_slct.post_comment_id = post_comment_obj.post_comment_id;
$idaa_slct.post_comment_obj = post_comment_obj;