Just general code clean up. Also removing more of the extra _random bits.
This commit is contained in:
@@ -48,9 +48,6 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
// $idaa_slct.archive_id = ae_acct.slct.archive_id; // Not set here yet.
|
||||
|
||||
// *** Set initial variables
|
||||
</script>
|
||||
|
||||
{@render children?.()}
|
||||
|
||||
@@ -26,16 +26,6 @@ export async function load({ fetch, params, parent }) {
|
||||
}
|
||||
};
|
||||
}
|
||||
// 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) {
|
||||
const load_archive_obj_li = archives_func.load_ae_obj_li__archive({
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
// import { goto, invalidate, pushState, replaceState } from '$app/navigation';
|
||||
|
||||
// *** Import other supporting libraries
|
||||
// import { Modal } from 'flowbite-svelte';
|
||||
import { liveQuery } from 'dexie';
|
||||
|
||||
// *** Import Aether specific variables and functions
|
||||
@@ -90,58 +89,58 @@
|
||||
// );
|
||||
}
|
||||
|
||||
function add_activity_log({
|
||||
action = 'idaa_archives_page',
|
||||
action_with = 'none'
|
||||
}: {
|
||||
action?: string;
|
||||
action_with?: string;
|
||||
}) {
|
||||
let last_cache_refresh_iso = new Date($ae_loc?.last_cache_refresh);
|
||||
// function add_activity_log({
|
||||
// action = 'idaa_archives_page',
|
||||
// action_with = 'none'
|
||||
// }: {
|
||||
// action?: string;
|
||||
// action_with?: string;
|
||||
// }) {
|
||||
// let last_cache_refresh_iso = new Date($ae_loc?.last_cache_refresh);
|
||||
|
||||
let activity_description = `
|
||||
${$idaa_loc.novi_full_name ?? 'none'} ${$idaa_loc.novi_email ?? 'no-email'}
|
||||
allow=${$ae_loc?.allow_access}
|
||||
last_cache_refresh=${last_cache_refresh_iso.toLocaleString()}
|
||||
data_route=${data?.route.toString() ?? 'unknown'}
|
||||
`;
|
||||
// let activity_description = `
|
||||
// ${$idaa_loc.novi_full_name ?? 'none'} ${$idaa_loc.novi_email ?? 'no-email'}
|
||||
// allow=${$ae_loc?.allow_access}
|
||||
// last_cache_refresh=${last_cache_refresh_iso.toLocaleString()}
|
||||
// data_route=${data?.route.toString() ?? 'unknown'}
|
||||
// `;
|
||||
|
||||
let data_kv = {
|
||||
external_client_id: data?.route.id,
|
||||
name: `IDAA: ${$idaa_loc.novi_full_name ?? 'none'} ${$idaa_loc.novi_email ?? ''}`,
|
||||
description: activity_description ?? null,
|
||||
object_type: 'archive', // archive, post, event
|
||||
// object_id_random: data?.params?.archive_id ?? null,
|
||||
// object_id_random: ae_acct.slct.archive_id, // data?.params?.archive_id ?? null,
|
||||
url_root: data?.url.origin,
|
||||
// url_full_path: data?.url.href,
|
||||
url_full_path: data?.url.pathname,
|
||||
url_params: data?.url.searchParams.toString(),
|
||||
action: action,
|
||||
action_with: action_with ?? 'none',
|
||||
meta_json: {
|
||||
allow_access: $ae_loc?.allow_access,
|
||||
last_cache_refresh: $ae_loc?.last_cache_refresh,
|
||||
last_cache_refresh_iso: last_cache_refresh_iso.toISOString(),
|
||||
last_cache_refresh_locale:
|
||||
last_cache_refresh_iso.toLocaleString(),
|
||||
access_level: $ae_loc?.access_level,
|
||||
iframe: $ae_loc?.iframe
|
||||
// site_access_key: $ae_loc?.site_access_key,
|
||||
// site_domain_access_key: $ae_loc?.site_domain_access_key,
|
||||
// site_domain: $ae_loc?.site_domain,
|
||||
// extra_data: extra_data ?? '',
|
||||
// log_lvl: log_lvl,
|
||||
}
|
||||
};
|
||||
// let data_kv = {
|
||||
// external_client_id: data?.route.id,
|
||||
// name: `IDAA: ${$idaa_loc.novi_full_name ?? 'none'} ${$idaa_loc.novi_email ?? ''}`,
|
||||
// description: activity_description ?? null,
|
||||
// object_type: 'archive', // archive, post, event
|
||||
// // object_id: data?.params?.archive_id ?? null,
|
||||
// // object_id: ae_acct.slct.archive_id, // data?.params?.archive_id ?? null,
|
||||
// url_root: data?.url.origin,
|
||||
// // url_full_path: data?.url.href,
|
||||
// url_full_path: data?.url.pathname,
|
||||
// url_params: data?.url.searchParams.toString(),
|
||||
// action: action,
|
||||
// action_with: action_with ?? 'none',
|
||||
// meta_json: {
|
||||
// allow_access: $ae_loc?.allow_access,
|
||||
// last_cache_refresh: $ae_loc?.last_cache_refresh,
|
||||
// last_cache_refresh_iso: last_cache_refresh_iso.toISOString(),
|
||||
// last_cache_refresh_locale:
|
||||
// last_cache_refresh_iso.toLocaleString(),
|
||||
// access_level: $ae_loc?.access_level,
|
||||
// iframe: $ae_loc?.iframe
|
||||
// // site_access_key: $ae_loc?.site_access_key,
|
||||
// // site_domain_access_key: $ae_loc?.site_domain_access_key,
|
||||
// // site_domain: $ae_loc?.site_domain,
|
||||
// // extra_data: extra_data ?? '',
|
||||
// // log_lvl: log_lvl,
|
||||
// }
|
||||
// };
|
||||
|
||||
core_func.create_ae_obj__activity_log({
|
||||
api_cfg: $ae_api,
|
||||
account_id: $ae_loc.account_id,
|
||||
data_kv: data_kv,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
}
|
||||
// core_func.create_ae_obj__activity_log({
|
||||
// api_cfg: $ae_api,
|
||||
// account_id: $ae_loc.account_id,
|
||||
// data_kv: data_kv,
|
||||
// log_lvl: log_lvl
|
||||
// });
|
||||
// }
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
slct,
|
||||
slct_trigger
|
||||
} from '$lib/stores/ae_stores';
|
||||
import { idaa_loc, idaa_sess, idaa_slct } from '$lib/stores/ae_idaa_stores';
|
||||
// import { idaa_loc, idaa_sess, idaa_slct } from '$lib/stores/ae_idaa_stores';
|
||||
|
||||
interface Props {
|
||||
lq__archive_obj_li: any;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
// *** Import Svelte specific
|
||||
import { onDestroy, onMount } from 'svelte';
|
||||
import { onDestroy } from 'svelte';
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
// *** Import Aether specific variables and functions
|
||||
|
||||
@@ -13,14 +13,6 @@ export async function load({ params, 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;
|
||||
// // let post_id = params.post_id;
|
||||
// // let post_id = page.url.searchParams.has('post_id') ?? null;
|
||||
// // let post_id = page.url.searchParams.get('post_id') ?? null;
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
if ($idaa_trig.post_id) {
|
||||
const post_id = $idaa_trig.post_id;
|
||||
$idaa_trig.post_id = null;
|
||||
|
||||
|
||||
if (log_lvl) console.log(`Triggered: load post_id=${post_id}`);
|
||||
|
||||
// Non-blocking background refresh
|
||||
@@ -208,8 +208,8 @@
|
||||
name: `IDAA: ${$idaa_loc.novi_full_name ?? 'none'} ${$idaa_loc.novi_email ?? ''}`,
|
||||
description: activity_description ?? null,
|
||||
object_type: 'post', // archive, post, event
|
||||
// object_id_random: data?.params?.event_id ?? null,
|
||||
// object_id_random: ae_acct.slct.archive_id, // data?.params?.archive_id ?? null,
|
||||
// object_id: data?.params?.event_id ?? null,
|
||||
// object_id: ae_acct.slct.archive_id, // data?.params?.archive_id ?? null,
|
||||
url_root: data?.url.origin,
|
||||
// url_full_path: data?.url.href,
|
||||
url_full_path: data?.url.pathname,
|
||||
|
||||
@@ -39,6 +39,7 @@ export const load = (async ({ params, parent }) => {
|
||||
try_cache: true,
|
||||
log_lvl: log_lvl
|
||||
}).then(posts => {
|
||||
// REVIEW AGAIN: The backend now supports filtering out archived posts based on the 'archive_on' field.
|
||||
// Workaround: V3 Search does not permit 'archive_on' field yet.
|
||||
// Filter locally for posts that are not archived yet.
|
||||
const now = new Date();
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
// *** Import other supporting libraries
|
||||
// import { Modal } from 'flowbite-svelte';
|
||||
import { liveQuery } from 'dexie';
|
||||
|
||||
// *** Import Aether specific variables and functions
|
||||
|
||||
@@ -10,11 +10,12 @@
|
||||
|
||||
// *** Import Svelte specific
|
||||
import { browser } from '$app/environment';
|
||||
// import { untrack } from 'svelte';
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
import type { key_val } from '$lib/stores/ae_stores';
|
||||
// import type { key_val } from '$lib/stores/ae_stores';
|
||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||
import { api } from '$lib/api/api';
|
||||
// import { api } from '$lib/api/api';
|
||||
import {
|
||||
ae_snip,
|
||||
ae_loc,
|
||||
@@ -30,74 +31,18 @@
|
||||
import Comp__post_comment_obj_id_edit from './ae_idaa_comp__post_comment_obj_id_edit.svelte';
|
||||
import AE_Comp_Hosted_Files_Download_Button from '$lib/ae_core/ae_comp__hosted_files_download_button.svelte';
|
||||
|
||||
import { untrack } from 'svelte';
|
||||
|
||||
$effect(() => {
|
||||
if (browser && $lq__post_obj?.post_id) {
|
||||
document.body.scrollIntoView();
|
||||
}
|
||||
});
|
||||
|
||||
// onDestroy(() => {
|
||||
// console.log('** Component Destroyed: ** View - Post Obj');
|
||||
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.delete('post_id');
|
||||
// history.pushState({}, '', url);
|
||||
// });
|
||||
|
||||
// function handle_post_comment_obj_created(event) {
|
||||
// console.log('*** handle_post_comment_obj_created() ***');
|
||||
// console.log(event.detail);
|
||||
|
||||
// $idaa_slct.post_comment_id = null;
|
||||
// $idaa_slct.post_comment_obj = {};
|
||||
|
||||
// $idaa_trig = 'load__post_obj_li';
|
||||
// $idaa_trig = 'load__post_obj';
|
||||
// $idaa_trig = 'load__post_comment_obj_li';
|
||||
|
||||
// // $idaa_sess.bb.show_post_list = false;
|
||||
// // $idaa_sess.bb.show_edit__post_id = false;
|
||||
// // $idaa_sess.bb.show_view__post_id = true;
|
||||
// $idaa_sess.bb.show_edit__post_comment = false;
|
||||
// }
|
||||
// function handle_post_comment_obj_updated(event) {
|
||||
// console.log('*** handle_post_comment_obj_updated() ***');
|
||||
// console.log(event.detail);
|
||||
|
||||
// $idaa_trig = 'load__post_obj';
|
||||
// $idaa_trig = 'load__post_comment_obj_li';
|
||||
|
||||
// // $idaa_sess.bb.show_post_list = false;
|
||||
// // $idaa_sess.bb.show_edit__post_id = false;
|
||||
// // $idaa_sess.bb.show_view__post_id = true;
|
||||
// $idaa_sess.bb.show_edit__post_comment = false;
|
||||
// }
|
||||
// function handle_post_comment_obj_deleted(event) {
|
||||
// console.log('*** handle_post_comment_obj_deleted() ***');
|
||||
// console.log(event.detail);
|
||||
|
||||
// $idaa_trig = 'load__post_obj_li';
|
||||
// $idaa_trig = 'load__post_obj';
|
||||
// $idaa_trig = 'load__post_comment_obj_li';
|
||||
|
||||
// // $idaa_sess.bb.show_post_list = false;
|
||||
// // $idaa_sess.bb.show_edit__post_id = false;
|
||||
// // $idaa_sess.bb.show_view__post_id = true;
|
||||
// $idaa_sess.bb.show_edit__post_comment = false;
|
||||
// }
|
||||
</script>
|
||||
|
||||
<section
|
||||
bind:clientHeight={$ae_loc.iframe_height_modal_body}
|
||||
class="svelte_component ae_section ae_view post_obj view__post_obj space-y-2"
|
||||
>
|
||||
<!-- {#if $idaa_sess.bb.show__inline_edit__post_obj}
|
||||
<Comp__post_obj_id_edit
|
||||
lq__post_obj={lq__post_obj}
|
||||
/>
|
||||
{:else} -->
|
||||
|
||||
|
||||
<!-- <div class="post__header">
|
||||
<h2 class="post__title flex flex-row gap-2 items-center h3">
|
||||
@@ -123,18 +68,9 @@
|
||||
<span class="fas fa-paperclip"></span>
|
||||
<span class="text-sm text-gray-600 dark:text-gray-400 italic">Linked files:</span>
|
||||
{#each $lq__post_obj.linked_li_json as linked_obj, index}
|
||||
<!-- <a
|
||||
href={linked_obj.url}
|
||||
target="_blank"
|
||||
class="badge badge-info variant-filled-info"
|
||||
>
|
||||
<span class="fas fa-paperclip m-1"></span>
|
||||
{linked_obj.filename}
|
||||
({linked_obj.hosted_file_id_random})
|
||||
</a> -->
|
||||
|
||||
{#if $ae_loc.authenticated_access}
|
||||
{@const file_id = linked_obj?.hosted_file_id_random || linked_obj?.id || linked_obj?.hosted_file_id}
|
||||
{@const file_id = linked_obj?.hosted_file_id || linked_obj?.id}
|
||||
{#if file_id}
|
||||
{@const ext = (linked_obj.extension || linked_obj.file_extension || ae_util.guess_file_extension(linked_obj.filename) || '').toLowerCase()}
|
||||
{#if ['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg'].includes(ext)}
|
||||
|
||||
Reference in New Issue
Block a user