diff --git a/src/lib/ae_idaa_stores.ts b/src/lib/ae_idaa_stores.ts index e430a31e..a6bda515 100644 --- a/src/lib/ae_idaa_stores.ts +++ b/src/lib/ae_idaa_stores.ts @@ -19,6 +19,12 @@ let idaa_local_data_struct: key_val = { name: 'Aether - IDAA (SvelteKit 2.x Svelte 4.x)', title: `OSIT's Æ IDAA`, // - Dev SvelteKit`, // Æ + novi_uuid: null, + novi_email: null, + novi_full_name: null, + novi_admin_li: [], + novi_trusted_li: [], + 'ds': {}, 'idaa_cfg_json': {}, @@ -34,8 +40,8 @@ let idaa_local_data_struct: key_val = { }, - posts: { - + bb: { + show_list__post_obj_li: true, }, recovery_meetings: { @@ -64,7 +70,7 @@ let idaa_session_data_struct: key_val = { }, - posts: { + bb: { }, @@ -110,4 +116,11 @@ let idaa_slct_obj_template: key_val = { export let idaa_slct = writable(idaa_slct_obj_template); // This works and uses *local* storage: -// export let idaa_slct: Writable = localStorageStore('ae_idaa_slct', idaa_slct_obj_template); \ No newline at end of file +// export let idaa_slct: Writable = localStorageStore('ae_idaa_slct', idaa_slct_obj_template); + + +/* *** BEGIN *** Initialize idaa_trigger */ +// Intended for temporary session storage. +// Updated 2024-03-06 +export let idaa_trigger: any = writable(null); +// console.log(`AE IDAA Stores - IDAA Trigger:`, idaa_trigger); diff --git a/src/lib/ae_posts__post.ts b/src/lib/ae_posts__post.ts index 7083f6d0..1d6cd3bd 100644 --- a/src/lib/ae_posts__post.ts +++ b/src/lib/ae_posts__post.ts @@ -97,7 +97,7 @@ export async function load_ae_obj_li__post( for_obj_type = 'account', for_obj_id, inc_comment_li = false, - order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, + order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'title': 'ASC'}, params = {}, try_cache = true, log_lvl = 0 @@ -591,6 +591,7 @@ export function db_save_ae_obj_li__post( topic_id: obj.topic_id, topic: obj.topic, + topic_name: obj.topic_name, title: obj.title, content: obj.content, diff --git a/src/lib/db_posts.ts b/src/lib/db_posts.ts index fef522e1..a55280e0 100644 --- a/src/lib/db_posts.ts +++ b/src/lib/db_posts.ts @@ -21,6 +21,7 @@ export interface Post { topic_id?: string; topic?: string; // or topic_name? + topic_name?: string; // name: null|string; // summary?: null|string; diff --git a/src/routes/idaa/(idaa)/bb/+layout.svelte b/src/routes/idaa/(idaa)/bb/+layout.svelte new file mode 100644 index 00000000..bda31631 --- /dev/null +++ b/src/routes/idaa/(idaa)/bb/+layout.svelte @@ -0,0 +1,21 @@ + + + + diff --git a/src/routes/idaa/(idaa)/bb/+layout.ts b/src/routes/idaa/(idaa)/bb/+layout.ts new file mode 100644 index 00000000..4d940a61 --- /dev/null +++ b/src/routes/idaa/(idaa)/bb/+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 { posts_func } from '$lib/ae_posts_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 BB - [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 = posts_func.load_ae_obj_li__post({ + api_cfg: ae_acct.api, + for_obj_type: 'account', + for_obj_id: account_id, + inc_comment_li: true, + order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'title': '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)/bb/+page.svelte b/src/routes/idaa/(idaa)/bb/+page.svelte new file mode 100644 index 00000000..76ced725 --- /dev/null +++ b/src/routes/idaa/(idaa)/bb/+page.svelte @@ -0,0 +1,81 @@ + + + +
+ + +

Bulletin Board {$lq__post_obj_li?.length}

+{#if $lq__post_obj_li && $lq__post_obj_li?.length } + +{/if} + + +
+ + + + + + + + \ No newline at end of file diff --git a/src/routes/idaa/(idaa)/posts/0_posts__main.svelte b/src/routes/idaa/(idaa)/bb/0_posts__main.svelte similarity index 99% rename from src/routes/idaa/(idaa)/posts/0_posts__main.svelte rename to src/routes/idaa/(idaa)/bb/0_posts__main.svelte index a3fbf85f..e50f60c1 100644 --- a/src/routes/idaa/(idaa)/posts/0_posts__main.svelte +++ b/src/routes/idaa/(idaa)/bb/0_posts__main.svelte @@ -16,7 +16,7 @@ import { slct, slct_trigger, ae_app } from './stores'; // *** Import Aether module components import Edit_post_obj from './10_edit__post_obj.svelte'; -import View_post_obj from './10_view__post_obj.svelte'; +import View_post_obj from './ae_idaa_comp__post_obj_id_view.svelte'; // *** Export/Exposed variables and functions for component export let account_id: string = $ae_app.account_id; diff --git a/src/routes/idaa/(idaa)/posts/10_edit__post_comment_obj.svelte b/src/routes/idaa/(idaa)/bb/10_edit__post_comment_obj.svelte similarity index 100% rename from src/routes/idaa/(idaa)/posts/10_edit__post_comment_obj.svelte rename to src/routes/idaa/(idaa)/bb/10_edit__post_comment_obj.svelte diff --git a/src/routes/idaa/(idaa)/posts/10_edit__post_obj.svelte b/src/routes/idaa/(idaa)/bb/10_edit__post_obj.svelte similarity index 100% rename from src/routes/idaa/(idaa)/posts/10_edit__post_obj.svelte rename to src/routes/idaa/(idaa)/bb/10_edit__post_obj.svelte diff --git a/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_obj_id_view.svelte b/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_obj_id_view.svelte new file mode 100644 index 00000000..8363544d --- /dev/null +++ b/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_obj_id_view.svelte @@ -0,0 +1,263 @@ + + + +
+ +
+

+ {@html $idaa_slct.post_obj.title} + {#if $idaa_slct.post_obj.topic_id} {$idaa_slct.post_obj.topic_name}{/if} +

+
+ +
{@html $idaa_slct.post_obj.content}
+ + + + + +{#if $idaa_loc.posts.show_edit__post_comment} +
+ + { + $idaa_slct.post_comment_id = null; + $idaa_slct.post_comment_obj = {}; + + // $idaa_loc.posts.show_post_list = true; + // $idaa_loc.posts.show_edit__post_id = false; + // $idaa_loc.posts.show_view__post_id = false; + $idaa_loc.posts.show_edit__post_comment = false; + }} + > + Comment on: {($idaa_slct.post_obj.title ? $idaa_slct.post_obj.title : '')} + + +
+ +
+
+
+
+{/if} + +{#if $idaa_slct.post_comment_obj_li.length} +{#each $idaa_slct.post_comment_obj_li as idaa_post_comment_obj, index} +
+
{@html idaa_post_comment_obj.content}
+ + +
+
+ + Comment by: + {#if idaa_post_comment_obj.anonymous} + + Anonymous + {:else} + + {idaa_post_comment_obj.full_name} + + {/if} +
+ Created on: + {ae_util.iso_datetime_formatter(idaa_post_comment_obj.created_on, 'datetime_iso_no_seconds')} + {#if idaa_post_comment_obj.updated_on} + Updated on: + {ae_util.iso_datetime_formatter(idaa_post_comment_obj.updated_on, 'datetime_iso_no_seconds')} + {/if} +
+
+ + {#if $ae_loc.trusted_access || idaa_post_comment_obj.external_person_id === $ae_app.novi_uuid} +
+ +
+ {/if} +
+ +{/each} +{/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 new file mode 100644 index 00000000..cb98f339 --- /dev/null +++ b/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_obj_li.svelte @@ -0,0 +1,154 @@ + + + + +
+{#if $lq__post_obj_li} + +{#each $lq__post_obj_li as idaa_post_obj, index} +
+
+

+ {@html idaa_post_obj.title} + {#if idaa_post_obj.topic_id} {idaa_post_obj.topic_name}{/if} +

+
+ + {#if idaa_post_obj.content}
{@html idaa_post_obj.content}
{/if} + +
+ + + {#if $ae_loc.trusted_access || idaa_post_obj.external_person_id === $idaa_loc.novi_uuid || idaa_post_obj.email === $idaa_loc.novi_email} + + {/if} + + + +
+ + + +
+{/each} + +{:else} + No posts found at this time +{/if} +
+ \ No newline at end of file diff --git a/src/routes/idaa/(idaa)/posts/10_view__post_obj.svelte b/src/routes/idaa/(idaa)/posts/10_view__post_obj.svelte deleted file mode 100644 index 680c3b26..00000000 --- a/src/routes/idaa/(idaa)/posts/10_view__post_obj.svelte +++ /dev/null @@ -1,261 +0,0 @@ - - - -
- -
-

- {@html $slct.post_obj.title} - {#if $slct.post_obj.topic_id} {$slct.post_obj.topic_name}{/if} -

-
- -
{@html $slct.post_obj.content}
- - - - - -{#if $ae_app.posts.show_edit__post_comment} -
- - { - $slct.post_comment_id = null; - $slct.post_comment_obj = {}; - - // $ae_app.posts.show_post_list = true; - // $ae_app.posts.show_edit__post_id = false; - // $ae_app.posts.show_view__post_id = false; - $ae_app.posts.show_edit__post_comment = false; - }} - > - Comment on: {($slct.post_obj.title ? $slct.post_obj.title : '')} - - -
- -
-
-
-
-{/if} - -{#if $slct.post_comment_obj_li.length} -{#each $slct.post_comment_obj_li as idaa_post_comment_obj, index} -
-
{@html idaa_post_comment_obj.content}
- - -
-
- - Comment by: - {#if idaa_post_comment_obj.anonymous} - - Anonymous - {:else} - - {idaa_post_comment_obj.full_name} - - {/if} -
- Created on: - {ae.util.iso_datetime_formatter(idaa_post_comment_obj.created_on, 'datetime_iso_no_seconds')} - {#if idaa_post_comment_obj.updated_on} - Updated on: - {ae.util.iso_datetime_formatter(idaa_post_comment_obj.updated_on, 'datetime_iso_no_seconds')} - {/if} -
-
- - {#if $ae_app.trusted_access || idaa_post_comment_obj.external_person_id === $ae_app.novi_uuid} -
- -
- {/if} -
- -{/each} -{/if} - -
- - - diff --git a/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_id_view.svelte b/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_id_view.svelte index ce4f1484..0871d013 100644 --- a/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_id_view.svelte +++ b/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_id_view.svelte @@ -348,7 +348,7 @@ onMount(() => { $idaa_loc.recovery_meetings.show_view__event_obj = false; $idaa_loc.recovery_meetings.show_edit__event_obj = true; }} - class="btn btn-md variant-ghost-warning hover:variant-filled-warning transition" + class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition" title={`Edit meeting: ${$lq__event_obj?.name}`} > Edit diff --git a/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_li.svelte b/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_li.svelte index 4d22902d..92ede5bb 100644 --- a/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_li.svelte +++ b/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_li.svelte @@ -99,7 +99,7 @@ onMount(() => { $idaa_loc.recovery_meetings.show_view__event_obj = false; $idaa_loc.recovery_meetings.show_edit__event_obj = true; }} - class="btn btn-md variant-ghost-warning hover:variant-filled-warning transition" + class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition" title={`Edit meeting: ${idaa_event_obj.name}`} >