Making the URL update when viewing and closing specific content. Other clean up.

This commit is contained in:
Scott Idem
2024-11-08 13:57:16 -05:00
parent 13d906428b
commit e6a9a5ceab
10 changed files with 108 additions and 63 deletions

View File

@@ -286,7 +286,7 @@ async function handle_input_upload_files(input_upload_files, task_id) {
</span> </span>
<!-- <span class="fas fa-save m-1"></span> --> <!-- <span class="fas fa-save m-1"></span> -->
<span class="grow font-bold"> <span class="grow font-bold">
{#if $ae_sess.files.processed_file_list.length > 0} {#if $ae_sess.files.processed_file_list?.length > 0}
<!-- {#each $ae_sess.files.processed_file_list as file_obj, index} <!-- {#each $ae_sess.files.processed_file_list as file_obj, index}
<span class="text-xs"> <span class="text-xs">
{file_obj.filename} {file_obj.filename}

View File

@@ -245,7 +245,7 @@ if (browser) {
<!-- Modal: Archive Content ID media player --> <!-- Modal: Archive Content ID media player -->
<Modal <Modal
title="{$lq__archive_content_obj?.name} - {$lq__archive_content_obj?.id}" title="{$lq__archive_content_obj?.name} - {$lq__archive_content_obj?.archive_content_id}"
bind:open={$idaa_sess.archives.show__modal_view__archive_content_id} bind:open={$idaa_sess.archives.show__modal_view__archive_content_id}
autoclose={false} autoclose={false}
placement="top-center" placement="top-center"
@@ -259,7 +259,7 @@ if (browser) {
<span class="text-sm text-gray-500"> <span class="text-sm text-gray-500">
Viewing: Viewing:
</span> </span>
{$lq__archive_content_obj?.name}</h3> {$lq__archive_content_obj?.name} - {$lq__archive_content_obj?.archive_content_id}</h3>
</div> </div>
</svelte:fragment> </svelte:fragment>

View File

@@ -123,7 +123,7 @@ onMount(() => {
</a> --> </a> -->
{/if} {/if}
{#if $ae_loc.trusted_access} {#if $ae_loc.trusted_access && $ae_loc.edit_mode}
<button <button
disabled={!$ae_loc.trusted_access} disabled={!$ae_loc.trusted_access}
on:click={() => { on:click={() => {

View File

@@ -70,7 +70,7 @@ onMount(() => {
{/if} {/if}
</div> </div>
{#if $ae_loc.trusted_access} {#if $ae_loc.trusted_access && $ae_loc.edit_mode}
<div class="ae_options"> <div class="ae_options">
<!-- {#if $ae_loc.trusted_access} --> <!-- {#if $ae_loc.trusted_access} -->
<button <button

View File

@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { createEventDispatcher, onMount } from 'svelte'; import { onDestroy, onMount } from 'svelte';
import { fade } from 'svelte/transition'; import { browser } from '$app/environment';
// import { ae, Element_modal_v3 } from 'aether_npm_lib'; // import { ae, Element_modal_v3 } from 'aether_npm_lib';
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores'; import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
@@ -8,6 +8,8 @@ import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
// export let archive_content_id = null; // export let archive_content_id = null;
export let lq__archive_content_obj: any;
let file_icons:any = {} let file_icons:any = {}
file_icons['ac3'] = 'file-audio'; file_icons['ac3'] = 'file-audio';
file_icons['aac'] = 'file-audio'; file_icons['aac'] = 'file-audio';
@@ -35,17 +37,36 @@ file_icons['xls'] = 'file-excel';
file_icons['xlsx'] = 'file-excel'; file_icons['xlsx'] = 'file-excel';
file_icons['zip'] = 'file-archive'; file_icons['zip'] = 'file-archive';
onMount(() => { $: if (browser && $lq__archive_content_obj?.archive_content_id) {
console.log('** Component Mounted: ** Media Player - Archive Content Obj'); console.log('** Component Mounted: ** Media Player - Archive Content Obj');
const url = new URL(location);
url.searchParams.set('archive_content_id', $lq__archive_content_obj?.archive_content_id);
// url.searchParams.set('archive_content_id', $idaa_slct?.archive_content_id);
history.pushState({}, '', url);
}
onDestroy(() => {
console.log('** Component Destroyed: ** View - Archive Content Obj');
const url = new URL(location);
url.searchParams.delete('archive_content_id');
history.pushState({}, '', url);
}); });
// Reminder: Styling is being done with Tailwind CSS, not Bootstrap. // Reminder: Styling is being done with Tailwind CSS, not Bootstrap.
</script> </script>
<!-- <h3 class="ae_title">Viewing: {$idaa_slct.archive_content_obj.name}</h3> --> <!-- <h3 class="ae_title">Viewing: {$idaa_slct.archive_content_obj.name} - {$lq__archive_content_obj?.archive_content_id}</h3> -->
<section class="ae_content flex flex-col gap-2 items-center justify-center"> <section class="ae_content flex flex-col gap-2 items-center justify-center">
{#if file_icons[$idaa_slct.archive_content_obj.file_extension] == 'file-audio'} {#if !$idaa_slct.archive_content_obj.hosted_file_id}
<span class="text-center text-lg text-gray-500 bg-yellow-100 p-2 rounded-lg">
<span class="fas fa-exclamation-triangle text-warning"></span>
No Hosted File Linked
<span class="fas fa-exclamation-triangle text-warning"></span>
</span>
{:else if file_icons[$idaa_slct.archive_content_obj.file_extension] == 'file-audio'}
<audio <audio
autoplay controls autoplay controls
style="max-width: 100%; max-height: 65vh;" style="max-width: 100%; max-height: 65vh;"

View File

@@ -1,7 +1,6 @@
<script lang="ts"> <script lang="ts">
import { onMount } from 'svelte'; import { onDestroy } from 'svelte';
import { fade } from 'svelte/transition'; import { browser } from '$app/environment';
import { Modal } from 'flowbite-svelte';
// *** Import Aether core variables and functions // *** Import Aether core variables and functions
import { ae_util } from '$lib/ae_utils/ae_utils'; import { ae_util } from '$lib/ae_utils/ae_utils';
@@ -15,7 +14,6 @@ export let lq__post_obj: any;
export let lq__post_comment_obj_li: any; export let lq__post_comment_obj_li: any;
export let lq__post_comment_obj: any; export let lq__post_comment_obj: any;
// import Edit_post_comment_obj from './10_edit__post_comment_obj.svelte';
if ($idaa_slct.post_id) { if ($idaa_slct.post_id) {
console.log(`Post ID selected: ${$idaa_slct.post_id}`); console.log(`Post ID selected: ${$idaa_slct.post_id}`);
@@ -24,51 +22,63 @@ if ($idaa_slct.post_id) {
$idaa_trigger = 'load__post_obj'; $idaa_trigger = 'load__post_obj';
} }
onMount(() => { $: if (browser && $lq__post_obj?.post_id) {
console.log('** Component Mounted: ** View - Post Obj'); console.log('** Component Mounted: ** View - Post Obj');
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');
const url = new URL(location);
url.searchParams.delete('post_id');
history.pushState({}, '', url);
}); });
function handle_post_comment_obj_created(event) { // function handle_post_comment_obj_created(event) {
console.log('*** handle_post_comment_obj_created() ***'); // console.log('*** handle_post_comment_obj_created() ***');
console.log(event.detail); // console.log(event.detail);
$idaa_slct.post_comment_id = null; // $idaa_slct.post_comment_id = null;
$idaa_slct.post_comment_obj = {}; // $idaa_slct.post_comment_obj = {};
$idaa_trigger = 'load__post_obj_li'; // $idaa_trigger = 'load__post_obj_li';
$idaa_trigger = 'load__post_obj'; // $idaa_trigger = 'load__post_obj';
$idaa_trigger = 'load__post_comment_obj_li'; // $idaa_trigger = 'load__post_comment_obj_li';
// $idaa_sess.bb.show_post_list = false; // // $idaa_sess.bb.show_post_list = false;
// $idaa_sess.bb.show_edit__post_id = false; // // $idaa_sess.bb.show_edit__post_id = false;
// $idaa_sess.bb.show_view__post_id = true; // // $idaa_sess.bb.show_view__post_id = true;
$idaa_sess.bb.show_edit__post_comment = false; // $idaa_sess.bb.show_edit__post_comment = false;
} // }
function handle_post_comment_obj_updated(event) { // function handle_post_comment_obj_updated(event) {
console.log('*** handle_post_comment_obj_updated() ***'); // console.log('*** handle_post_comment_obj_updated() ***');
console.log(event.detail); // console.log(event.detail);
$idaa_trigger = 'load__post_obj'; // $idaa_trigger = 'load__post_obj';
$idaa_trigger = 'load__post_comment_obj_li'; // $idaa_trigger = 'load__post_comment_obj_li';
// $idaa_sess.bb.show_post_list = false; // // $idaa_sess.bb.show_post_list = false;
// $idaa_sess.bb.show_edit__post_id = false; // // $idaa_sess.bb.show_edit__post_id = false;
// $idaa_sess.bb.show_view__post_id = true; // // $idaa_sess.bb.show_view__post_id = true;
$idaa_sess.bb.show_edit__post_comment = false; // $idaa_sess.bb.show_edit__post_comment = false;
} // }
function handle_post_comment_obj_deleted(event) { // function handle_post_comment_obj_deleted(event) {
console.log('*** handle_post_comment_obj_deleted() ***'); // console.log('*** handle_post_comment_obj_deleted() ***');
console.log(event.detail); // console.log(event.detail);
$idaa_trigger = 'load__post_obj_li'; // $idaa_trigger = 'load__post_obj_li';
$idaa_trigger = 'load__post_obj'; // $idaa_trigger = 'load__post_obj';
$idaa_trigger = 'load__post_comment_obj_li'; // $idaa_trigger = 'load__post_comment_obj_li';
// $idaa_sess.bb.show_post_list = false; // // $idaa_sess.bb.show_post_list = false;
// $idaa_sess.bb.show_edit__post_id = false; // // $idaa_sess.bb.show_edit__post_id = false;
// $idaa_sess.bb.show_view__post_id = true; // // $idaa_sess.bb.show_view__post_id = true;
$idaa_sess.bb.show_edit__post_comment = false; // $idaa_sess.bb.show_edit__post_comment = false;
} // }
</script> </script>
@@ -134,6 +144,7 @@ function handle_post_comment_obj_deleted(event) {
<span class="fas fa-comment"></span> {($idaa_slct.post_obj.post_comment_count == 1 ? `${$idaa_slct.post_obj.post_comment_count} comment` : `${$idaa_slct.post_obj.post_comment_count} comments` )} <span class="fas fa-comment"></span> {($idaa_slct.post_obj.post_comment_count == 1 ? `${$idaa_slct.post_obj.post_comment_count} comment` : `${$idaa_slct.post_obj.post_comment_count} comments` )}
</span> </span>
{/if} {/if}
{#if ($ae_loc.trusted_access && $ae_loc.edit_mode) || $idaa_loc.novi_uuid}
<button <button
on:click={() => { on:click={() => {
if (confirm('Are you sure you want to add a new comment?')) { if (confirm('Are you sure you want to add a new comment?')) {
@@ -145,8 +156,9 @@ function handle_post_comment_obj_deleted(event) {
> >
<span class="fas fa-plus m-1"></span> New Comment <span class="fas fa-plus m-1"></span> New Comment
</button> </button>
{/if}
{#if $ae_loc.trusted_access || $idaa_slct.post_obj.external_person_id === $idaa_loc.novi_uuid} {#if ($ae_loc.trusted_access && $ae_loc.edit_mode) || $idaa_slct.post_obj.external_person_id === $idaa_loc.novi_uuid}
<button <button
on:click={() => { on:click={() => {
// $idaa_slct.post_id = $idaa_slct.post_obj.post_id_random; // $idaa_slct.post_id = $idaa_slct.post_obj.post_id_random;
@@ -172,8 +184,6 @@ function handle_post_comment_obj_deleted(event) {
{/if} {/if}
{#if $lq__post_comment_obj_li?.length} {#if $lq__post_comment_obj_li?.length}
<section class="post_comment_obj_li space-y-2 border border-1 rounded p-2 border-y-4"> <section class="post_comment_obj_li space-y-2 border border-1 rounded p-2 border-y-4">
{#each $lq__post_comment_obj_li as post_comment_obj, index} {#each $lq__post_comment_obj_li as post_comment_obj, index}
@@ -213,7 +223,7 @@ function handle_post_comment_obj_deleted(event) {
</span> </span>
</div> </div>
{#if $ae_loc.trusted_access || post_comment_obj.external_person_id === $idaa_loc.novi_uuid} {#if ($ae_loc.trusted_access && $ae_loc.edit_mode) || post_comment_obj.external_person_id === $idaa_loc.novi_uuid}
<div class="ae_options"> <div class="ae_options">
<button on:click={() => { <button on:click={() => {
$idaa_slct.post_comment_id = post_comment_obj.post_comment_id; $idaa_slct.post_comment_id = post_comment_obj.post_comment_id;

View File

@@ -68,7 +68,7 @@ onMount(() => {
{/if} {/if}
</button> </button>
{#if $ae_loc.trusted_access || idaa_post_obj.external_person_id === $idaa_loc.novi_uuid} {#if ($ae_loc.trusted_access && $ae_loc.edit_mode) || idaa_post_obj.external_person_id === $idaa_loc.novi_uuid}
<button <button
on:click={() => { on:click={() => {
$idaa_slct.post_id = idaa_post_obj.post_id; $idaa_slct.post_id = idaa_post_obj.post_id;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { createEventDispatcher, onMount } from 'svelte'; import { onDestroy } from 'svelte';
import { browser } from '$app/environment';
// import { fade } from 'svelte/transition'; // import { fade } from 'svelte/transition';
import { ae_util } from '$lib/ae_utils/ae_utils'; import { ae_util } from '$lib/ae_utils/ae_utils';
@@ -8,8 +9,6 @@ import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
export let lq__event_obj: any; export let lq__event_obj: any;
const dispatch = createEventDispatcher();
if ($idaa_slct.event_id) { if ($idaa_slct.event_id) {
console.log(`Event ID selected: ${$idaa_slct.event_id}`); console.log(`Event ID selected: ${$idaa_slct.event_id}`);
console.log(`Event Object selected: ${$lq__event_obj}`) console.log(`Event Object selected: ${$lq__event_obj}`)
@@ -17,8 +16,18 @@ if ($idaa_slct.event_id) {
$slct_trigger = 'load__event_obj'; $slct_trigger = 'load__event_obj';
} }
onMount(() => { $: if (browser && $lq__event_obj?.event_id) {
console.log('** Component Mounted: ** View - Event Obj'); const url = new URL(location);
url.searchParams.set('event_id', $lq__event_obj?.event_id);
history.pushState({}, '', url);
}
onDestroy(() => {
console.log('** Component Destroyed: ** View - Event Obj');
const url = new URL(location);
url.searchParams.delete('event_id');
history.pushState({}, '', url);
}); });

View File

@@ -98,7 +98,7 @@ onMount(() => {
</button> </button>
<!-- This checks if the currently logged in Novi user has a matching UUID or email address. --> <!-- This checks if the currently logged in Novi user has a matching UUID or email address. -->
{#if $ae_loc.trusted_access || idaa_event_obj?.external_person_id === $idaa_loc.novi_uuid || idaa_event_obj?.contact_li_json[0].email === $idaa_loc.novi_email} {#if ($ae_loc.trusted_access && $ae_loc.edit_mode) || idaa_event_obj?.external_person_id === $idaa_loc.novi_uuid || idaa_event_obj?.contact_li_json[0].email === $idaa_loc.novi_email}
<button <button
on:click={() => { on:click={() => {
$idaa_slct.event_id = idaa_event_obj?.event_id; $idaa_slct.event_id = idaa_event_obj?.event_id;

View File

@@ -439,8 +439,12 @@ async function handle_qry__event(
</button> </button>
{/if} {/if}
{#if ($ae_loc.trusted_access && $ae_loc.edit_mode) || $idaa_loc.novi_uuid}
<button <button
on:click={() => { on:click={() => {
if (!confirm('Create new meeting?')) {
return false;
}
$slct.event_id = null; $slct.event_id = null;
$slct.event_obj = {}; $slct.event_obj = {};
@@ -453,11 +457,12 @@ async function handle_qry__event(
$idaa_loc.recovery_meetings.show_view__event_obj = false; $idaa_loc.recovery_meetings.show_view__event_obj = false;
$idaa_loc.recovery_meetings.show_edit__event_obj = true; $idaa_loc.recovery_meetings.show_edit__event_obj = true;
}} }}
class="btn_new_recovery_meeting ae_btn btn btn-secondary btn-sm variant-filled-warning" class="btn_new_recovery_meeting btn btn-sm variant-ghost-warning hover:variant-filled-warning transition text-xs"
disabled={true} disabled={true}
> >
<span class="fas fa-plus m-1"></span> Create new Meeting <span class="fas fa-plus m-1"></span> Create New Meeting
</button> </button>
{/if}
{#if $ae_loc.trusted_access} {#if $ae_loc.trusted_access}
<button <button
@@ -480,7 +485,7 @@ async function handle_qry__event(
}); });
}} }}
class="btn btn-sm variant-ghost-warning w-42 mb-1 export_data_btn text-xs" class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition w-42 mb-1 export_data_btn text-xs"
title={`Download sponsorship data for ${$ae_loc.account_name}`} title={`Download sponsorship data for ${$ae_loc.account_name}`}
> >
{#await ae_promises.download__events_export} {#await ae_promises.download__events_export}