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

@@ -1,5 +1,6 @@
<script lang="ts">
import { createEventDispatcher, onMount } from 'svelte';
import { onDestroy } from 'svelte';
import { browser } from '$app/environment';
// import { fade } from 'svelte/transition';
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;
const dispatch = createEventDispatcher();
if ($idaa_slct.event_id) {
console.log(`Event ID selected: ${$idaa_slct.event_id}`);
console.log(`Event Object selected: ${$lq__event_obj}`)
@@ -17,8 +16,18 @@ if ($idaa_slct.event_id) {
$slct_trigger = 'load__event_obj';
}
onMount(() => {
console.log('** Component Mounted: ** View - Event Obj');
$: if (browser && $lq__event_obj?.event_id) {
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>
<!-- 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
on:click={() => {
$idaa_slct.event_id = idaa_event_obj?.event_id;

View File

@@ -439,8 +439,12 @@ async function handle_qry__event(
</button>
{/if}
{#if ($ae_loc.trusted_access && $ae_loc.edit_mode) || $idaa_loc.novi_uuid}
<button
on:click={() => {
if (!confirm('Create new meeting?')) {
return false;
}
$slct.event_id = null;
$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_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}
>
<span class="fas fa-plus m-1"></span> Create new Meeting
<span class="fas fa-plus m-1"></span> Create New Meeting
</button>
{/if}
{#if $ae_loc.trusted_access}
<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}`}
>
{#await ae_promises.download__events_export}