From ec7ec7b5661150806d1962b56bf95b2178caa168 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Mon, 30 Jun 2025 18:09:08 -0400 Subject: [PATCH] Moving away from using modal with iframes. Scroll issues. Especially with Safari. --- src/lib/ae_posts/db_posts.ts | 2 + .../(idaa)/archives/[archive_id]/+page.svelte | 28 +++ src/routes/idaa/(idaa)/bb/+page.svelte | 5 +- .../idaa/(idaa)/bb/[post_id]/+page.svelte | 210 ++++++++++++++++++ src/routes/idaa/(idaa)/bb/[post_id]/+page.ts | 42 ++++ .../bb/ae_idaa_comp__post_obj_li.svelte | 30 ++- .../recovery_meetings/[event_id]/+page.svelte | 1 + 7 files changed, 314 insertions(+), 4 deletions(-) create mode 100644 src/routes/idaa/(idaa)/bb/[post_id]/+page.svelte create mode 100644 src/routes/idaa/(idaa)/bb/[post_id]/+page.ts diff --git a/src/lib/ae_posts/db_posts.ts b/src/lib/ae_posts/db_posts.ts index 7b67eef1..0c560c5a 100644 --- a/src/lib/ae_posts/db_posts.ts +++ b/src/lib/ae_posts/db_posts.ts @@ -114,6 +114,7 @@ export class MySubClassedDexie extends Dexie { id, post_id, account_id, topic_id, topic, + name, title, full_name, email, archive, archive_on, @@ -123,6 +124,7 @@ export class MySubClassedDexie extends Dexie { comment: ` id, post_comment_id, post_id, + name, title, full_name, email, tmp_sort_1, tmp_sort_2, diff --git a/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte b/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte index 26d1bf83..1d3b785a 100644 --- a/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte +++ b/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte @@ -267,6 +267,20 @@ if (browser) { lq__archive_obj={lq__archive_obj} /> + {#snippet footer()} + + {/snippet} + @@ -317,6 +331,20 @@ if (browser) { lq__archive_content_obj={lq__archive_content_obj} /> + {#snippet footer()} + + {/snippet} + diff --git a/src/routes/idaa/(idaa)/bb/+page.svelte b/src/routes/idaa/(idaa)/bb/+page.svelte index 2af37e80..3ca1858a 100644 --- a/src/routes/idaa/(idaa)/bb/+page.svelte +++ b/src/routes/idaa/(idaa)/bb/+page.svelte @@ -87,6 +87,7 @@ let lq__post_comment_obj = $derived(liveQuery(async () => { $effect(() => { if ($idaa_trig.post_li) { $idaa_trig.post_li = false; + log_lvl = 1; if (log_lvl) { console.log(`Triggered: $idaa_trig.post_li`); @@ -114,7 +115,7 @@ $effect(() => { hidden: $idaa_loc.bb.qry__hidden, limit: $idaa_loc.bb.qry__limit, order_by_li: $idaa_loc.bb.qry__order_by_li, - try_cache: true, + // try_cache: true, log_lvl: log_lvl, }); } @@ -136,7 +137,7 @@ $effect(() => { hidden: $idaa_loc.bb.qry__hidden, limit: $idaa_loc.bb.qry__limit, inc_comment_li: true, - try_cache: true, + // try_cache: true, log_lvl: log_lvl, }) .then((post_obj) => { diff --git a/src/routes/idaa/(idaa)/bb/[post_id]/+page.svelte b/src/routes/idaa/(idaa)/bb/[post_id]/+page.svelte new file mode 100644 index 00000000..4e64e0d5 --- /dev/null +++ b/src/routes/idaa/(idaa)/bb/[post_id]/+page.svelte @@ -0,0 +1,210 @@ + + + + + + + IDAA Bulletin Board: + {$lq__post_obj?.name ? ae_util.shorten_string({ string: $lq__post_obj?.name, max_length: 20, begin_length: 10, end_length: 4 }) : ''} + - Novi - {$ae_loc?.name} + + + +
+

+ + + {$lq__post_obj?.name ? $lq__post_obj?.name : 'BB Post'} +

+ +
+ {#if $lq__post_obj?.topic_id} {$lq__post_obj?.topic_name}{/if} + + + + {#if $lq__post_obj?.topic_name} + {$lq__post_obj?.topic_name} + {/if} + {#if $ae_loc.trusted_access && $lq__post_obj?.hide} + Hidden + {/if} + {#if $ae_loc.administrator_access && !$lq__post_obj?.enable} + Not enabled + {/if} + +
+ +
+ +
+ + + Back to Posts List + + + + + {#if $idaa_sess.bb.edit__post_id} + + {:else} + + {#if ($ae_loc.trusted_access && $ae_loc.edit_mode) || $lq__post_obj?.external_person_id === $idaa_loc.novi_uuid || $lq__post_obj?.contact_li_json[0].email === $idaa_loc.novi_email} + + {/if} + {/if} +
+ + + +{#if $idaa_sess.bb.edit__post_id} + + EDIT GOES HERE? +{:else} + +{/if} diff --git a/src/routes/idaa/(idaa)/bb/[post_id]/+page.ts b/src/routes/idaa/(idaa)/bb/[post_id]/+page.ts new file mode 100644 index 00000000..57f1e144 --- /dev/null +++ b/src/routes/idaa/(idaa)/bb/[post_id]/+page.ts @@ -0,0 +1,42 @@ +import type { PageLoad } from './$types'; + +console.log(`ae_idaa_bulletin_board [post_id] +page.ts start`); + +import { browser } from '$app/environment'; +import { posts_func } from '$lib/ae_posts/ae_posts_functions'; + +export const load = (async ({ params, parent }) => { // route + let log_lvl: number = 0; + + let data = await parent(); + data.log_lvl = log_lvl; + + let account_id = data.account_id; + let ae_acct = data[account_id]; + + let post_id = params.post_id; + + ae_acct.slct.post_id = post_id; + + if (browser) { + if (log_lvl) { + console.log(`ae_idaa_posts posts [post_id] +page.ts: post_id = `, post_id); + } + // Load post post object + let load_post_obj = await posts_func.load_ae_obj_id__post({ + api_cfg: ae_acct.api, + post_id: post_id, + inc_comment_li: true, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log(`load_post_obj = `, load_post_obj); + } + ae_acct.slct.post_obj = load_post_obj; + } + + data[account_id] = ae_acct; + + return data; + // return {}; +}) satisfies PageLoad; \ No newline at end of file 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 6c9336c6..4b3d58d3 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 @@ -56,7 +56,31 @@ onMount(() => { {/if}
+ + + + View Post + + {#if idaa_post_obj?.post_comment_count} + + {(idaa_post_obj?.post_comment_count == 1 ? `${idaa_post_obj?.post_comment_count} comment` : `${idaa_post_obj?.post_comment_count} comments` )} + + {/if} + + {#if idaa_post_obj?.linked_li_json?.length} + + {idaa_post_obj?.linked_li_json?.length} + {(idaa_post_obj?.linked_li_json?.length == 1 ? ' file' : ' files')} + + {/if} +