Starting real work on the IDAA BB (posts). Can at least view them and their comments now.

This commit is contained in:
Scott Idem
2024-11-05 12:37:46 -05:00
parent 4d2a78f80f
commit ac7016bb3e
19 changed files with 679 additions and 655 deletions

View File

@@ -1,7 +1,7 @@
<script lang="ts">
/** @type {import('./$types').PageData} */
export let data: any;
let log_lvl = 2;
let log_lvl = 1;
// console.log(`ae_idaa_bb +page.svelte data:`, data);
import { browser } from '$app/environment';
@@ -26,7 +26,13 @@ $: lq__post_obj_li = liveQuery(async () => {
let results = await db_posts.post
.where('account_id')
.equals($slct.account_id)
.sortBy('name');
// .orderBy('updated_on')
// .toArray()
.reverse()
.sortBy('updated_on');
// .sortBy('updated_on, created_on');
// .sortBy('[updated_on+created_on]');
// .sortBy('[created_on+updated_on]');
return results;
});
@@ -38,12 +44,23 @@ $: lq__post_obj = liveQuery(async () => {
return results;
});
$: lq__post_comment_obj_li = liveQuery(async () => {
let results = await db_posts.comment
.where('post_id')
.equals($idaa_slct.post_id)
.reverse()
.sortBy('updated_on');
// .sortBy('title');
return results;
});
</script>
<section
class="
ae_idaa__recovery_meetings
ae_idaa__bb
container h-full mx-auto
flex flex-col gap-1
py-1 px-2 pb-16
@@ -53,29 +70,59 @@ $: lq__post_obj = liveQuery(async () => {
"
>
<!-- <h1>Bulletin Board {$lq__post_obj_li?.length}</h1> -->
<h1>Bulletin Board {$lq__post_obj_li?.length}</h1>
{#if $lq__post_obj_li && $lq__post_obj_li?.length }
<Comp__post_obj_li
lq__post_obj_li={lq__post_obj_li}
/>
{:else}
<p>No posts available to show.</p>
{/if}
</section>
<!-- Main modal -->
<!-- Modal: Post (Bulletin Board) view ID -->
<Modal
title="{$lq__post_obj?.title} - {$lq__post_obj?.id}"
bind:open={$idaa_slct.post_id}
bind:open={$idaa_sess.bb.show__modal_view}
autoclose={false}
size="xl"
outsideclose={true}
placement="top-center"
size="lg"
class="bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200 rounded-lg border-gray-200 dark:border-gray-700 divide-gray-200 dark:divide-gray-700 shadow-md relative flex flex-col mx-auto w-full divide-y"
>
<svelte:fragment slot="header">
<div class="flex flex-row items-center justify-between w-full">
<h3 class="text-lg font-semibold">
{#if $ae_loc.trusted_access || $lq__post_obj?.external_person_id === $idaa_loc.novi_uuid}
<button
on:click={() => {
// const url = new URL(location);
// url.searchParams.set('post_id', $lq__post_obj?.post_id_random);
// history.pushState({}, '', url);
$idaa_sess.bb.show__modal_view = false;
$idaa_sess.bb.show__modal_edit = true;
}}
class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition"
title={`Edit meeting: ${$lq__post_obj?.title}`}
>
<span class="fas fa-edit m-1"></span> Edit
</button>
{/if}
{$lq__post_obj?.title}
</h3>
</div>
</svelte:fragment>
<Comp__post_obj_id_view
lq__post_obj={lq__post_obj}
lq__post_comment_obj_li={lq__post_comment_obj_li}
/>
</Modal>