Using the hosted file select method is 90% working. It still needs to create a new hosted_file_link record.

This commit is contained in:
Scott Idem
2025-03-18 16:37:19 -04:00
parent 6749ecc4c3
commit 42ac7911f2
6 changed files with 817 additions and 217 deletions

View File

@@ -27,6 +27,9 @@ interface Props {
display_mode?: string; // 'default', 'compact', 'minimal', 'launcher'
max_file_count?: number;
file_type?: string; // 'image', 'video', 'audio', 'document', 'other'
slct_hosted_file_kv?: key_val;
slct_hosted_file_id?: any;
slct_hosted_file_obj?: any;
}
let {
@@ -38,7 +41,10 @@ let {
link_to_id,
display_mode = 'default',
max_file_count = 19,
file_type = 'all'
file_type = 'all',
slct_hosted_file_kv = $bindable({}),
slct_hosted_file_id = $bindable(null),
slct_hosted_file_obj = $bindable(null)
}: Props = $props();
// export let show_convert_btn: null|boolean = null;
@@ -146,9 +152,21 @@ ae_tmp.show__direct_download = $ae_loc.core?.show__direct_download ?? false;
if ($ae_loc.files.uploaded_file_kv[hosted_file_obj.hosted_file_id]) {
delete $ae_loc.files.uploaded_file_kv[hosted_file_obj.hosted_file_id];
$ae_loc.files.uploaded_file_kv = {...$ae_loc.files.uploaded_file_kv};
delete slct_hosted_file_kv[hosted_file_obj.hosted_file_id];
slct_hosted_file_id = null;
slct_hosted_file_obj = null;
} else {
$ae_loc.files.uploaded_file_kv[hosted_file_obj.hosted_file_id] = hosted_file_obj;
lq__hosted_file_obj_li[hosted_file_obj.hosted_file_id] = hosted_file_obj;
slct_hosted_file_kv[hosted_file_obj.hosted_file_id] = hosted_file_obj;
slct_hosted_file_id = hosted_file_obj.hosted_file_id;
slct_hosted_file_obj = hosted_file_obj;
}
log_lvl = 1;
if (log_lvl) {
console.log(`slct_hosted_file_kv:`, slct_hosted_file_kv);
}
}}
class="btn btn-sm variant-soft-secondary hover:variant-filled-secondary"

View File

@@ -25,6 +25,9 @@ interface Props {
allow_basic?: boolean; // Not used yet
allow_moderator?: boolean; // Not used yet
display_mode?: string; // 'default', 'compact', 'minimal', 'launcher'
slct_hosted_file_kv?: key_val;
slct_hosted_file_id?: any;
slct_hosted_file_obj?: any;
}
let {
@@ -34,7 +37,10 @@ let {
link_to_id,
allow_basic = false,
allow_moderator = false,
display_mode = 'default'
display_mode = 'default',
slct_hosted_file_kv = $bindable({}),
slct_hosted_file_id = $bindable(null),
slct_hosted_file_obj = $bindable(null)
}: Props = $props();
console.log(`HERE HERE HERE HERE: link_to_type: ${link_to_type} link_to_id: ${link_to_id}`);
@@ -95,6 +101,9 @@ let lq__hosted_file_obj_li = $derived(liveQuery(async () => {
class_li_default={class_li_default}
class_li={class_li}
display_mode={display_mode}
bind:slct_hosted_file_kv={slct_hosted_file_kv}
bind:slct_hosted_file_id={slct_hosted_file_id}
bind:slct_hosted_file_obj={slct_hosted_file_obj}
/>
<!-- allow_basic={allow_basic} -->
<!-- allow_moderator={allow_moderator} -->