Standardize Exhibit Leads module: Rich text support and naming alignment
- Integrated TipTap rich text editor for Booth Descriptions and Exhibitor Notes. - Implemented strip_html utility for clean search/preview of rich text fields. - Renamed exhibit loading functions to follow load_ae_obj_id__event_exhibit* pattern. - Hardened property processors with 'undefined' string guards and automatic reload triggers. - Resolved type mismatches and naming inconsistencies across the Leads module. - Verified zero-error state via svelte-check.
This commit is contained in:
@@ -341,6 +341,7 @@ import { load_ae_obj_id__archive_content } from '$lib/ae_archives/ae_archives__a
|
||||
|
||||
import { load_ae_obj_id__event } from '$lib/ae_events/ae_events__event';
|
||||
// import { load_ae_obj_id__event_badge } from "$lib/ae_events/ae_events__event_badge";
|
||||
import { load_ae_obj_id__event_exhibit } from '$lib/ae_events/ae_events__exhibit';
|
||||
import { load_ae_obj_id__event_device } from '$lib/ae_events/ae_events__event_device';
|
||||
// import { load_ae_obj_id__event_exhibit } from "$lib/ae_events/ae_events__event_exhibit";
|
||||
import { load_ae_obj_id__event_file } from '$lib/ae_events/ae_events__event_file';
|
||||
@@ -410,6 +411,7 @@ async function update_ae_obj_id_crud_v2({
|
||||
if (object_type == 'journal') load_ae_obj_id__journal({ api_cfg, journal_id: object_id, log_lvl });
|
||||
if (object_type == 'journal_entry') load_ae_obj_id__journal_entry({ api_cfg, journal_entry_id: object_id, log_lvl });
|
||||
if (object_type == 'event') load_ae_obj_id__event({ api_cfg, event_id: object_id, log_lvl });
|
||||
if (object_type == 'event_exhibit') load_ae_obj_id__event_exhibit({ api_cfg, exhibit_id: object_id, log_lvl });
|
||||
if (object_type == 'event_device') load_ae_obj_id__event_device({ api_cfg, event_device_id: object_id, log_lvl });
|
||||
if (object_type == 'event_file') load_ae_obj_id__event_file({ api_cfg, event_file_id: object_id, log_lvl });
|
||||
if (object_type == 'event_location') load_ae_obj_id__event_location({ api_cfg, event_location_id: object_id, log_lvl });
|
||||
|
||||
@@ -89,6 +89,11 @@ async function _process_generic_props<T extends Record<string, any>>({
|
||||
const updated = processed_obj.updated_on ?? processed_obj.created_on;
|
||||
const name = processed_obj.name ?? '';
|
||||
|
||||
// Guard: Prevent literal "undefined" string from showing in description
|
||||
if ((processed_obj as any).description === 'undefined') {
|
||||
(processed_obj as any).description = '';
|
||||
}
|
||||
|
||||
(processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
|
||||
(processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
|
||||
|
||||
@@ -119,7 +124,7 @@ export async function process_ae_obj__exhibit_props({
|
||||
/**
|
||||
* Load Single Exhibit (SWR Pattern)
|
||||
*/
|
||||
export async function load_ae_obj_id__exhibit({
|
||||
export async function load_ae_obj_id__event_exhibit({
|
||||
api_cfg,
|
||||
exhibit_id,
|
||||
view = 'default',
|
||||
@@ -134,7 +139,7 @@ export async function load_ae_obj_id__exhibit({
|
||||
}): Promise<ae_EventExhibit | null> {
|
||||
const start_time = performance.now();
|
||||
if (log_lvl) {
|
||||
console.log(`🔎 [Trace] load_ae_obj_id__exhibit: START (id=${exhibit_id}, try_cache=${try_cache})`);
|
||||
console.log(`🔎 [Trace] load_ae_obj_id__event_exhibit: START (id=${exhibit_id}, try_cache=${try_cache})`);
|
||||
}
|
||||
|
||||
// 1. FAST PATH: Return cached data immediately
|
||||
@@ -192,7 +197,7 @@ async function _refresh_exhibit_id_background({ api_cfg, exhibit_id, view, try_c
|
||||
/**
|
||||
* Load Collection of Exhibits (SWR Pattern)
|
||||
*/
|
||||
export async function load_ae_obj_li__exhibit({
|
||||
export async function load_ae_obj_li__event_exhibit({
|
||||
api_cfg,
|
||||
event_id,
|
||||
enabled = 'enabled',
|
||||
@@ -222,7 +227,7 @@ export async function load_ae_obj_li__exhibit({
|
||||
}): Promise<ae_EventExhibit[]> {
|
||||
const start_time = performance.now();
|
||||
if (log_lvl) {
|
||||
console.log(`🔎 [Trace] load_ae_obj_li__exhibit: START (event=${event_id}, try_cache=${try_cache})`);
|
||||
console.log(`🔎 [Trace] load_ae_obj_li__event_exhibit: START (event=${event_id}, try_cache=${try_cache})`);
|
||||
}
|
||||
|
||||
if (try_cache) {
|
||||
|
||||
@@ -101,6 +101,11 @@ async function _process_generic_props<T extends Record<string, any>>({
|
||||
const updated = processed_obj.updated_on ?? processed_obj.created_on;
|
||||
const name = processed_obj.event_badge_full_name ?? '';
|
||||
|
||||
// Guard: Prevent literal "undefined" string from showing in notes
|
||||
if ((processed_obj as any).exhibitor_notes === 'undefined') {
|
||||
(processed_obj as any).exhibitor_notes = '';
|
||||
}
|
||||
|
||||
(processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
|
||||
(processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
|
||||
|
||||
@@ -131,7 +136,7 @@ export async function process_ae_obj__exhibit_tracking_props({
|
||||
/**
|
||||
* Load Single Lead (SWR Pattern)
|
||||
*/
|
||||
export async function load_ae_obj_id__exhibit_tracking({
|
||||
export async function load_ae_obj_id__event_exhibit_tracking({
|
||||
api_cfg,
|
||||
exhibit_tracking_id,
|
||||
view = 'default',
|
||||
@@ -146,7 +151,7 @@ export async function load_ae_obj_id__exhibit_tracking({
|
||||
}): Promise<ae_EventExhibitTracking | null> {
|
||||
const start_time = performance.now();
|
||||
if (log_lvl) {
|
||||
console.log(`🔎 [Trace] load_ae_obj_id__exhibit_tracking: START (id=${exhibit_tracking_id}, try_cache=${try_cache})`);
|
||||
console.log(`🔎 [Trace] load_ae_obj_id__event_exhibit_tracking: START (id=${exhibit_tracking_id}, try_cache=${try_cache})`);
|
||||
}
|
||||
|
||||
// 1. FAST PATH: Return cached data immediately
|
||||
@@ -204,7 +209,7 @@ async function _refresh_tracking_id_background({ api_cfg, exhibit_tracking_id, v
|
||||
/**
|
||||
* Load Collection of Leads (SWR Pattern)
|
||||
*/
|
||||
export async function load_ae_obj_li__exhibit_tracking({
|
||||
export async function load_ae_obj_li__event_exhibit_tracking({
|
||||
api_cfg,
|
||||
exhibit_id,
|
||||
enabled = 'enabled',
|
||||
@@ -233,7 +238,7 @@ export async function load_ae_obj_li__exhibit_tracking({
|
||||
}): Promise<ae_EventExhibitTracking[]> {
|
||||
const start_time = performance.now();
|
||||
if (log_lvl) {
|
||||
console.log(`🔎 [Trace] load_ae_obj_li__exhibit_tracking: START (exhibit=${exhibit_id}, try_cache=${try_cache})`);
|
||||
console.log(`🔎 [Trace] load_ae_obj_li__event_exhibit_tracking: START (exhibit=${exhibit_id}, try_cache=${try_cache})`);
|
||||
}
|
||||
|
||||
if (try_cache) {
|
||||
|
||||
@@ -7,8 +7,8 @@ import * as event_device from '$lib/ae_events/ae_events__event_device';
|
||||
import * as event_file from '$lib/ae_events/ae_events__event_file';
|
||||
|
||||
import {
|
||||
load_ae_obj_id__exhibit,
|
||||
load_ae_obj_li__exhibit,
|
||||
load_ae_obj_id__event_exhibit,
|
||||
load_ae_obj_li__event_exhibit,
|
||||
search__exhibit,
|
||||
create_ae_obj__exhibit,
|
||||
update_ae_obj__exhibit
|
||||
@@ -16,8 +16,8 @@ import {
|
||||
|
||||
import {
|
||||
search__exhibit_tracking,
|
||||
load_ae_obj_id__exhibit_tracking,
|
||||
load_ae_obj_li__exhibit_tracking,
|
||||
load_ae_obj_id__event_exhibit_tracking,
|
||||
load_ae_obj_li__event_exhibit_tracking,
|
||||
create_ae_obj__exhibit_tracking,
|
||||
update_ae_obj__exhibit_tracking,
|
||||
download_export__event_exhibit_tracking
|
||||
@@ -73,13 +73,13 @@ const export_obj = {
|
||||
update_ae_obj__event_device: event_device.update_ae_obj__event_device,
|
||||
|
||||
// Event Exhibits
|
||||
load_ae_obj_id__exhibit: load_ae_obj_id__exhibit,
|
||||
load_ae_obj_li__exhibit: load_ae_obj_li__exhibit,
|
||||
load_ae_obj_id__event_exhibit: load_ae_obj_id__event_exhibit,
|
||||
load_ae_obj_li__event_exhibit: load_ae_obj_li__event_exhibit,
|
||||
search__exhibit: search__exhibit,
|
||||
create_ae_obj__exhibit: create_ae_obj__exhibit,
|
||||
update_ae_obj__exhibit: update_ae_obj__exhibit,
|
||||
load_ae_obj_id__exhibit_tracking: load_ae_obj_id__exhibit_tracking,
|
||||
load_ae_obj_li__exhibit_tracking: load_ae_obj_li__exhibit_tracking,
|
||||
load_ae_obj_id__event_exhibit_tracking: load_ae_obj_id__event_exhibit_tracking,
|
||||
load_ae_obj_li__event_exhibit_tracking: load_ae_obj_li__event_exhibit_tracking,
|
||||
search__exhibit_tracking: search__exhibit_tracking,
|
||||
create_ae_obj__exhibit_tracking: create_ae_obj__exhibit_tracking,
|
||||
update_ae_obj__exhibit_tracking: update_ae_obj__exhibit_tracking,
|
||||
|
||||
@@ -265,6 +265,14 @@ export const shorten_string = function shorten_string({
|
||||
return new_string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Strips HTML tags from a string.
|
||||
*/
|
||||
export function strip_html(html: string): string {
|
||||
if (!html) return '';
|
||||
return html.replace(/<[^>]*>?/gm, '');
|
||||
}
|
||||
|
||||
// Svelte action to set focus on an element
|
||||
function set_focus(node: HTMLElement, focus: boolean) {
|
||||
if (focus) {
|
||||
@@ -341,6 +349,7 @@ export const ae_util = {
|
||||
to_title_case: to_title_case,
|
||||
shorten_string: shorten_string,
|
||||
shorten_filename: shorten_filename,
|
||||
strip_html: strip_html,
|
||||
file_extension_icon: file_extension_icon,
|
||||
file_extension_icon_lucide: file_extension_icon_lucide,
|
||||
format_html: format_html,
|
||||
|
||||
@@ -101,6 +101,8 @@
|
||||
// import { ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||
|
||||
// *** Import Aether core components
|
||||
import AE_Comp_Editor_TipTap from '$lib/elements/AE_Comp_Editor_TipTap.svelte';
|
||||
|
||||
// *** Import Aether module variables and functions
|
||||
// *** Import Aether module components
|
||||
|
||||
@@ -364,6 +366,13 @@
|
||||
rows={textarea_rows}
|
||||
class="textarea"
|
||||
></textarea>
|
||||
{:else if field_type == 'tiptap'}
|
||||
<div class="w-full min-w-96 text-left">
|
||||
<AE_Comp_Editor_TipTap
|
||||
bind:content={new_field_value}
|
||||
placeholder="Start typing..."
|
||||
/>
|
||||
</div>
|
||||
{:else}
|
||||
<input bind:value={new_field_value} class="input w-fit" />
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user