refactor(events, idaa): standardize on String-only IDs and remove '_random' suffix
Aligned the Events Badges, Templates, and IDAA Bulletin Board modules with Aether UI/UX v3 standards by prioritizing semantic String IDs (e.g., event_id, badge_id) over legacy '_random' variants in API helpers, Dexie processors, and UI components. - Refactored badge and template loaders to use clean ID field names. - Updated search and LiveQuery logic in badge management views. - Cleaned up unused imports and legacy code in +layout and +page components. - Standardized ID mapping in generic object processors. - Improved IDAA post creation UX with autofocus and empty title defaults.
This commit is contained in:
@@ -10,11 +10,11 @@
|
||||
// *** Import Svelte specific
|
||||
import { page } from '$app/state';
|
||||
import { browser } from '$app/environment';
|
||||
import { untrack } from 'svelte';
|
||||
// import { untrack } from 'svelte';
|
||||
// import { goto, invalidate, pushState, replaceState } from '$app/navigation';
|
||||
|
||||
// *** Import other supporting libraries
|
||||
import { Modal } from 'flowbite-svelte';
|
||||
// import { Modal } from 'flowbite-svelte';
|
||||
import { liveQuery } from 'dexie';
|
||||
|
||||
// *** Import Aether specific variables and functions
|
||||
@@ -83,33 +83,33 @@
|
||||
});
|
||||
});
|
||||
|
||||
let lq__post_obj = $derived.by(() => {
|
||||
const post_id = $idaa_slct.post_id ?? '';
|
||||
return liveQuery(async () => {
|
||||
if (!post_id) return null;
|
||||
return await db_posts.post.get(post_id);
|
||||
});
|
||||
});
|
||||
// let lq__post_obj = $derived.by(() => {
|
||||
// const post_id = $idaa_slct.post_id ?? '';
|
||||
// return liveQuery(async () => {
|
||||
// if (!post_id) return null;
|
||||
// return await db_posts.post.get(post_id);
|
||||
// });
|
||||
// });
|
||||
|
||||
let lq__post_comment_obj_li = $derived.by(() => {
|
||||
const post_id = $idaa_slct.post_id ?? '';
|
||||
return liveQuery(async () => {
|
||||
if (!post_id) return [];
|
||||
return await db_posts.comment
|
||||
.where('post_id')
|
||||
.equals(post_id)
|
||||
.reverse()
|
||||
.sortBy('updated_on');
|
||||
});
|
||||
});
|
||||
// let lq__post_comment_obj_li = $derived.by(() => {
|
||||
// const post_id = $idaa_slct.post_id ?? '';
|
||||
// return liveQuery(async () => {
|
||||
// if (!post_id) return [];
|
||||
// return await db_posts.comment
|
||||
// .where('post_id')
|
||||
// .equals(post_id)
|
||||
// .reverse()
|
||||
// .sortBy('updated_on');
|
||||
// });
|
||||
// });
|
||||
|
||||
let lq__post_comment_obj = $derived.by(() => {
|
||||
const comment_id = $idaa_slct.post_comment_id ?? '';
|
||||
return liveQuery(async () => {
|
||||
if (!comment_id) return null;
|
||||
return await db_posts.comment.get(comment_id);
|
||||
});
|
||||
});
|
||||
// let lq__post_comment_obj = $derived.by(() => {
|
||||
// const comment_id = $idaa_slct.post_comment_id ?? '';
|
||||
// return liveQuery(async () => {
|
||||
// if (!comment_id) return null;
|
||||
// return await db_posts.comment.get(comment_id);
|
||||
// });
|
||||
// });
|
||||
|
||||
// Handle Single Post Load Trigger
|
||||
$effect(() => {
|
||||
@@ -188,57 +188,57 @@
|
||||
// );
|
||||
}
|
||||
|
||||
function add_activity_log({
|
||||
action = 'idaa_bb_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_bb_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: 'post', // archive, post, event
|
||||
// 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,
|
||||
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: 'post', // archive, post, event
|
||||
// // 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,
|
||||
// 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>
|
||||
|
||||
@@ -473,6 +473,7 @@ Copy and paste link: <a href="${link_base_url}?post_id=${$idaa_slct.post_id}">${
|
||||
Title of BB post:
|
||||
</span>
|
||||
<input
|
||||
autofocus
|
||||
type="text"
|
||||
id="title"
|
||||
name="title"
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
// let search_submit_results: any = null;
|
||||
|
||||
if (log_lvl) console.log('** Component Loaded: ** Post Options');
|
||||
// if (log_lvl) console.log('** Component Loaded: ** Post Options');
|
||||
</script>
|
||||
|
||||
<!-- preset-filled-surface-500 -->
|
||||
@@ -180,7 +180,7 @@
|
||||
|
||||
let data_kv = {
|
||||
external_person_id: $idaa_loc.novi_uuid,
|
||||
title: 'Change NEW Post Title',
|
||||
title: '',
|
||||
full_name: $idaa_loc.novi_full_name,
|
||||
email: $idaa_loc.novi_email,
|
||||
enable: true
|
||||
|
||||
Reference in New Issue
Block a user