From b9698615be44b51a197ef570f52e6c7233dde0fa Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Tue, 5 Nov 2024 17:05:46 -0500 Subject: [PATCH] Now the list of archives shows. --- src/lib/ae_archives/ae_archives__archive.ts | 2 +- src/lib/ae_archives/ae_archives_functions.ts | 4 +- src/routes/idaa/(idaa)/archives/+layout.ts | 46 +++++++ src/routes/idaa/(idaa)/archives/+page.svelte | 86 +++++++++++- .../ae_idaa_comp__archive_obj_li.svelte | 123 ++++++++++++++++++ .../bb/ae_idaa_comp__post_obj_li.svelte | 2 +- 6 files changed, 257 insertions(+), 6 deletions(-) create mode 100644 src/routes/idaa/(idaa)/archives/+layout.ts create mode 100644 src/routes/idaa/(idaa)/archives/ae_idaa_comp__archive_obj_li.svelte diff --git a/src/lib/ae_archives/ae_archives__archive.ts b/src/lib/ae_archives/ae_archives__archive.ts index e5cdccb5..11e80697 100644 --- a/src/lib/ae_archives/ae_archives__archive.ts +++ b/src/lib/ae_archives/ae_archives__archive.ts @@ -3,7 +3,7 @@ import { api } from '$lib/api'; import { db_archives } from "$lib/db_archives"; -import { load_ae_obj_li__archive_content } from "$lib/ae_archives__archive_content"; +import { load_ae_obj_li__archive_content } from "$lib/ae_archives/ae_archives__archive_content"; let ae_promises: key_val = {}; diff --git a/src/lib/ae_archives/ae_archives_functions.ts b/src/lib/ae_archives/ae_archives_functions.ts index 40d91bcd..e3f2a559 100644 --- a/src/lib/ae_archives/ae_archives_functions.ts +++ b/src/lib/ae_archives/ae_archives_functions.ts @@ -7,7 +7,7 @@ import { update_ae_obj__archive, // qry__archive, db_save_ae_obj_li__archive, -} from "$lib/ae_archives__archive"; +} from "$lib/ae_archives/ae_archives__archive"; import { @@ -17,7 +17,7 @@ import { update_ae_obj__archive_content, // qry__archive_content, db_save_ae_obj_li__archive_content, -} from "$lib/ae_archives__archive_content"; +} from "$lib/ae_archives/ae_archives__archive_content"; let export_obj = { diff --git a/src/routes/idaa/(idaa)/archives/+layout.ts b/src/routes/idaa/(idaa)/archives/+layout.ts new file mode 100644 index 00000000..ff37a180 --- /dev/null +++ b/src/routes/idaa/(idaa)/archives/+layout.ts @@ -0,0 +1,46 @@ +/** @type {import('./$types').LayoutLoad} */ +console.log(`IDAA BB - [account_id] +layout.ts start`); + +import { error } from '@sveltejs/kit'; +import { browser } from '$app/environment'; +import { archives_func } from '$lib/ae_archives/ae_archives_functions'; + +export async function load({ params, parent }) { // route + let log_lvl = 0; + + let data = await parent(); + data.log_lvl = log_lvl; + + let account_id = data.account_id; + let ae_acct = data[account_id]; + // console.log(`ae_acct = `, ae_acct); + + if (!account_id) { + console.log(`ae IDAA Archives - [account_id] +page.ts: The account_id was not found!!!`); + error(404, { + message: 'Account ID not found' + }); + } + + ae_acct.slct.account_id = account_id; + + if (browser) { + let load_event_obj_li = archives_func.load_ae_obj_li__archive({ + api_cfg: ae_acct.api, + for_obj_type: 'account', + for_obj_id: account_id, + inc_content_li: true, + order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'name': 'ASC'}, + params: {qry__enabled: 'enabled', qry__hidden: 'all', qry__limit: 200}, + try_cache: true, + log_lvl: log_lvl + }); + console.log(`load_event_obj_li = `, load_event_obj_li); + ae_acct.slct.event_obj_li = load_event_obj_li; + } + + // WARNING: Precaution against shared data between sites and sessions. + data[account_id] = ae_acct; + + return data; +} diff --git a/src/routes/idaa/(idaa)/archives/+page.svelte b/src/routes/idaa/(idaa)/archives/+page.svelte index d91f842f..f216f075 100644 --- a/src/routes/idaa/(idaa)/archives/+page.svelte +++ b/src/routes/idaa/(idaa)/archives/+page.svelte @@ -1,8 +1,90 @@ + + +
+ + + +{#if $lq__archive_obj_li && $lq__archive_obj_li?.length } + +{:else} +

No archives available to show.

+{/if} + + +
\ No newline at end of file diff --git a/src/routes/idaa/(idaa)/archives/ae_idaa_comp__archive_obj_li.svelte b/src/routes/idaa/(idaa)/archives/ae_idaa_comp__archive_obj_li.svelte new file mode 100644 index 00000000..55d53dc8 --- /dev/null +++ b/src/routes/idaa/(idaa)/archives/ae_idaa_comp__archive_obj_li.svelte @@ -0,0 +1,123 @@ + + + +
+{#if $lq__archive_obj_li && $lq__archive_obj_li.length} + +{#each $lq__archive_obj_li as idaa_archive_obj, index} +
+ +
+

+ {@html idaa_archive_obj.name} +

+ + {#if idaa_archive_obj.original_location} + — +

+ + {idaa_archive_obj.original_location} +

+ {/if} +
+ + {#if idaa_archive_obj.description}
{@html idaa_archive_obj.description}
{/if} + +
+ + + {#if $ae_loc.administrator_access} + + {/if} +
+ + + + +
+{/each} + +{:else} + No archives found at this time +{/if} +
+ diff --git a/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_obj_li.svelte b/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_obj_li.svelte index da1d41db..79e98585 100644 --- a/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_obj_li.svelte +++ b/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_obj_li.svelte @@ -130,7 +130,7 @@ onMount(() => { {/each} - + {:else} No posts found at this time {/if}