Prettier for Event Launcher
This commit is contained in:
@@ -1,224 +1,235 @@
|
||||
<script lang="ts">
|
||||
interface Props {
|
||||
log_lvl?: number;
|
||||
event_file_id: string;
|
||||
event_file_obj: any;
|
||||
max_filename_length?: number;
|
||||
hide_launch_icon?: boolean;
|
||||
hide_meta?: boolean;
|
||||
hide_created_on?: boolean;
|
||||
hide_os?: boolean;
|
||||
hide_size?: boolean;
|
||||
hide_draft?: boolean;
|
||||
show_bak_download?: boolean;
|
||||
btn_size?: string;
|
||||
btn_text_align?: string;
|
||||
text_size?: string;
|
||||
text_size_md?: string;
|
||||
session_type?: string;
|
||||
open_method?: null | string;
|
||||
modal_title?: string;
|
||||
interface Props {
|
||||
log_lvl?: number;
|
||||
event_file_id: string;
|
||||
event_file_obj: any;
|
||||
max_filename_length?: number;
|
||||
hide_launch_icon?: boolean;
|
||||
hide_meta?: boolean;
|
||||
hide_created_on?: boolean;
|
||||
hide_os?: boolean;
|
||||
hide_size?: boolean;
|
||||
hide_draft?: boolean;
|
||||
show_bak_download?: boolean;
|
||||
btn_size?: string;
|
||||
btn_text_align?: string;
|
||||
text_size?: string;
|
||||
text_size_md?: string;
|
||||
session_type?: string;
|
||||
open_method?: null | string;
|
||||
modal_title?: string;
|
||||
|
||||
modal__title?: any;
|
||||
modal__open_event_file_id?: any;
|
||||
modal__event_file_obj?: any;
|
||||
}
|
||||
modal__title?: any;
|
||||
modal__open_event_file_id?: any;
|
||||
modal__event_file_obj?: any;
|
||||
}
|
||||
|
||||
let {
|
||||
log_lvl = $bindable(0),
|
||||
event_file_id,
|
||||
event_file_obj = $bindable({}),
|
||||
max_filename_length = $bindable(50),
|
||||
hide_launch_icon = $bindable(false),
|
||||
hide_meta = $bindable(false),
|
||||
hide_created_on = $bindable(false),
|
||||
hide_os = $bindable(false),
|
||||
hide_size = $bindable(false),
|
||||
hide_draft = $bindable(false),
|
||||
show_bak_download = false,
|
||||
btn_size = $bindable('btn-sm'),
|
||||
btn_text_align = $bindable('text-left'),
|
||||
text_size = $bindable('text-sm'),
|
||||
text_size_md = $bindable('md:text-base'),
|
||||
session_type = $bindable('oral'),
|
||||
open_method = $bindable('download'),
|
||||
modal_title = $bindable(''),
|
||||
let {
|
||||
log_lvl = $bindable(0),
|
||||
event_file_id,
|
||||
event_file_obj = $bindable({}),
|
||||
max_filename_length = $bindable(50),
|
||||
hide_launch_icon = $bindable(false),
|
||||
hide_meta = $bindable(false),
|
||||
hide_created_on = $bindable(false),
|
||||
hide_os = $bindable(false),
|
||||
hide_size = $bindable(false),
|
||||
hide_draft = $bindable(false),
|
||||
show_bak_download = false,
|
||||
btn_size = $bindable('btn-sm'),
|
||||
btn_text_align = $bindable('text-left'),
|
||||
text_size = $bindable('text-sm'),
|
||||
text_size_md = $bindable('md:text-base'),
|
||||
session_type = $bindable('oral'),
|
||||
open_method = $bindable('download'),
|
||||
modal_title = $bindable(''),
|
||||
|
||||
modal__title = $bindable(''),
|
||||
modal__open_event_file_id = $bindable(null),
|
||||
modal__event_file_obj = $bindable(null)
|
||||
}: Props = $props();
|
||||
modal__title = $bindable(''),
|
||||
modal__open_event_file_id = $bindable(null),
|
||||
modal__event_file_obj = $bindable(null)
|
||||
}: Props = $props();
|
||||
|
||||
import { onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
import { onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
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 { ae_loc, ae_api, ae_sess, slct } from '$lib/stores/ae_stores';
|
||||
import { core_func } from '$lib/ae_core/ae_core_functions';
|
||||
import {
|
||||
events_loc,
|
||||
events_sess,
|
||||
events_slct
|
||||
} from '$lib/stores/ae_events_stores';
|
||||
import { events_func } from '$lib/ae_events/ae_events_functions';
|
||||
import { AlertCircle, AlertTriangle, BarChart2, CalendarDays, FolderOpen, Laptop, LoaderCircle, Monitor, Save, Send } from '@lucide/svelte';
|
||||
import AE_Comp_Hosted_Files_Download_Button from '$lib/ae_core/ae_comp__hosted_files_download_button.svelte';
|
||||
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 { ae_loc, ae_api, ae_sess, slct } from '$lib/stores/ae_stores';
|
||||
import { core_func } from '$lib/ae_core/ae_core_functions';
|
||||
import {
|
||||
events_loc,
|
||||
events_sess,
|
||||
events_slct
|
||||
} from '$lib/stores/ae_events_stores';
|
||||
import { events_func } from '$lib/ae_events/ae_events_functions';
|
||||
import {
|
||||
AlertCircle,
|
||||
AlertTriangle,
|
||||
BarChart2,
|
||||
CalendarDays,
|
||||
FolderOpen,
|
||||
Laptop,
|
||||
LoaderCircle,
|
||||
Monitor,
|
||||
Save,
|
||||
Send
|
||||
} from '@lucide/svelte';
|
||||
import AE_Comp_Hosted_Files_Download_Button from '$lib/ae_core/ae_comp__hosted_files_download_button.svelte';
|
||||
|
||||
// Import the relay
|
||||
import * as native from '$lib/electron/electron_relay';
|
||||
// Import the relay
|
||||
import * as native from '$lib/electron/electron_relay';
|
||||
|
||||
let ae_promises: key_val = $state({});
|
||||
let ae_promises: key_val = $state({});
|
||||
|
||||
let open_file_clicked: null | boolean = $state(null);
|
||||
let open_file_status: null | string = $state(null);
|
||||
let open_file_status_message: null | string = $state(null);
|
||||
let open_file_clicked: null | boolean = $state(null);
|
||||
let open_file_status: null | string = $state(null);
|
||||
let open_file_status_message: null | string = $state(null);
|
||||
|
||||
let screen_saver_exts = ['jpg', 'png', 'PNG', 'webp'];
|
||||
let screen_saver_exts = ['jpg', 'png', 'PNG', 'webp'];
|
||||
|
||||
onMount(() => {
|
||||
if (screen_saver_exts.includes(event_file_obj.extension)) {
|
||||
if (!$events_loc.launcher.screen_saver_img_kv)
|
||||
$events_loc.launcher.screen_saver_img_kv = {};
|
||||
$events_loc.launcher.screen_saver_img_kv[event_file_id] = {
|
||||
...event_file_obj
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
async function handle_open_file() {
|
||||
if (log_lvl) console.log('*** handle_open_file() ***');
|
||||
if (open_file_clicked) return; // Hard Guard: Already processing
|
||||
|
||||
$events_slct.event_file_id = event_file_id;
|
||||
$events_slct.event_file_obj = event_file_obj;
|
||||
|
||||
// 1. NATIVE MODE (Electron)
|
||||
if ($ae_loc.is_native && $events_loc.launcher.app_mode === 'native') {
|
||||
const cache_root = $ae_loc.local_file_cache_path;
|
||||
const temp_root = $ae_loc.host_file_temp_path;
|
||||
|
||||
open_file_clicked = true;
|
||||
open_file_status = 'checking_cache';
|
||||
open_file_status_message = 'Checking local cache...';
|
||||
|
||||
const exists = await native.check_hash_file_cache({
|
||||
cache_root,
|
||||
hash: event_file_obj.hash_sha256,
|
||||
verify_hash: true // Hardened: Trust No One!
|
||||
});
|
||||
|
||||
if (!exists) {
|
||||
open_file_status = 'downloading_file';
|
||||
open_file_status_message = 'Downloading file to cache...';
|
||||
|
||||
// Use the PROVEN endpoint path from api.ts that is known to work in Default Mode.
|
||||
const url = `${$ae_api.base_url}/v3/action/hosted_file/${event_file_obj.hosted_file_id}/download?return_file=true&filename=${encodeURIComponent(event_file_obj.filename)}&key=${$ae_api.account_id}`;
|
||||
|
||||
const dl_result = await native.download_to_cache({
|
||||
url,
|
||||
cache_root,
|
||||
hash: event_file_obj.hash_sha256,
|
||||
api_key: $ae_api.api_secret_key,
|
||||
account_id: $ae_api.account_id
|
||||
});
|
||||
|
||||
if (!dl_result.success) {
|
||||
open_file_status = 'error';
|
||||
open_file_status_message = `Download failed: ${dl_result.error}`;
|
||||
setTimeout(() => (open_file_clicked = false), 5000);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
open_file_status = 'opening_file';
|
||||
open_file_status_message = 'Opening Application';
|
||||
|
||||
// Phase 2/5: Use the atomic copy-and-launch operation.
|
||||
// The main process handler (file_handlers.ts) now handles the
|
||||
// specialized LibreOffice/AppleScript logic internally after copying.
|
||||
const launch_result = await native.launch_from_cache({
|
||||
cache_root,
|
||||
hash: event_file_obj.hash_sha256,
|
||||
temp_root,
|
||||
filename: event_file_obj.filename
|
||||
});
|
||||
|
||||
if (!launch_result.success) {
|
||||
open_file_status = 'error';
|
||||
open_file_status_message = `Failed to open: ${launch_result.error}`;
|
||||
}
|
||||
|
||||
setTimeout(() => (open_file_clicked = false), 5000);
|
||||
return launch_result.success;
|
||||
}
|
||||
// 2. ONSITE MODE (Browser with Modified Extensions)
|
||||
else if ($events_loc.launcher.app_mode === 'onsite') {
|
||||
open_file_clicked = true;
|
||||
open_file_status = 'downloading_onsite';
|
||||
open_file_status_message = 'Downloading (Onsite Mode)...';
|
||||
|
||||
let filename = event_file_obj.filename;
|
||||
if (
|
||||
(event_file_obj.extension === 'ppt' ||
|
||||
event_file_obj.extension === 'pptx') &&
|
||||
event_file_obj.open_in_os === 'win'
|
||||
) {
|
||||
filename = event_file_obj.filename + 'win';
|
||||
}
|
||||
|
||||
const dl_promise = api.get_object({
|
||||
api_cfg: $ae_api,
|
||||
endpoint: `/v3/action/hosted_file/${event_file_obj.hosted_file_id}/download`,
|
||||
params: {
|
||||
filename: filename,
|
||||
x_no_account_id_token: 'direct-download'
|
||||
},
|
||||
filename: filename,
|
||||
return_blob: true,
|
||||
auto_download: true,
|
||||
log_lvl: 1
|
||||
});
|
||||
|
||||
setTimeout(() => (open_file_clicked = false), 5000);
|
||||
return dl_promise;
|
||||
}
|
||||
// 3. DEFAULT MODE (Standard Browser)
|
||||
else {
|
||||
open_file_clicked = true;
|
||||
open_file_status = 'downloading_default';
|
||||
open_file_status_message = 'Downloading...';
|
||||
|
||||
const dl_promise = api.get_object({
|
||||
api_cfg: $ae_api,
|
||||
endpoint: `/v3/action/hosted_file/${event_file_obj.hosted_file_id}/download`,
|
||||
params: {
|
||||
filename: event_file_obj.filename,
|
||||
x_no_account_id_token: 'direct-download'
|
||||
},
|
||||
filename: event_file_obj.filename,
|
||||
return_blob: true,
|
||||
auto_download: true,
|
||||
log_lvl: 1
|
||||
});
|
||||
|
||||
if ($events_loc.launcher.controller == 'local_push') {
|
||||
$events_sess.launcher.controller_cmd = `ae_download:hosted_file=${event_file_obj.hosted_file_id}:${event_file_obj.filename}:${event_file_obj.extension}`;
|
||||
$events_sess.launcher.controller_trigger_send = true;
|
||||
}
|
||||
|
||||
setTimeout(() => (open_file_clicked = false), 5000);
|
||||
return dl_promise;
|
||||
}
|
||||
}
|
||||
|
||||
function prevent_default<T extends Event>(fn: (event: T) => void) {
|
||||
return function (event: T) {
|
||||
event.preventDefault();
|
||||
fn(event);
|
||||
onMount(() => {
|
||||
if (screen_saver_exts.includes(event_file_obj.extension)) {
|
||||
if (!$events_loc.launcher.screen_saver_img_kv)
|
||||
$events_loc.launcher.screen_saver_img_kv = {};
|
||||
$events_loc.launcher.screen_saver_img_kv[event_file_id] = {
|
||||
...event_file_obj
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
async function handle_open_file() {
|
||||
if (log_lvl) console.log('*** handle_open_file() ***');
|
||||
if (open_file_clicked) return; // Hard Guard: Already processing
|
||||
|
||||
$events_slct.event_file_id = event_file_id;
|
||||
$events_slct.event_file_obj = event_file_obj;
|
||||
|
||||
// 1. NATIVE MODE (Electron)
|
||||
if ($ae_loc.is_native && $events_loc.launcher.app_mode === 'native') {
|
||||
const cache_root = $ae_loc.local_file_cache_path;
|
||||
const temp_root = $ae_loc.host_file_temp_path;
|
||||
|
||||
open_file_clicked = true;
|
||||
open_file_status = 'checking_cache';
|
||||
open_file_status_message = 'Checking local cache...';
|
||||
|
||||
const exists = await native.check_hash_file_cache({
|
||||
cache_root,
|
||||
hash: event_file_obj.hash_sha256,
|
||||
verify_hash: true // Hardened: Trust No One!
|
||||
});
|
||||
|
||||
if (!exists) {
|
||||
open_file_status = 'downloading_file';
|
||||
open_file_status_message = 'Downloading file to cache...';
|
||||
|
||||
// Use the PROVEN endpoint path from api.ts that is known to work in Default Mode.
|
||||
const url = `${$ae_api.base_url}/v3/action/hosted_file/${event_file_obj.hosted_file_id}/download?return_file=true&filename=${encodeURIComponent(event_file_obj.filename)}&key=${$ae_api.account_id}`;
|
||||
|
||||
const dl_result = await native.download_to_cache({
|
||||
url,
|
||||
cache_root,
|
||||
hash: event_file_obj.hash_sha256,
|
||||
api_key: $ae_api.api_secret_key,
|
||||
account_id: $ae_api.account_id
|
||||
});
|
||||
|
||||
if (!dl_result.success) {
|
||||
open_file_status = 'error';
|
||||
open_file_status_message = `Download failed: ${dl_result.error}`;
|
||||
setTimeout(() => (open_file_clicked = false), 5000);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
open_file_status = 'opening_file';
|
||||
open_file_status_message = 'Opening Application';
|
||||
|
||||
// Phase 2/5: Use the atomic copy-and-launch operation.
|
||||
// The main process handler (file_handlers.ts) now handles the
|
||||
// specialized LibreOffice/AppleScript logic internally after copying.
|
||||
const launch_result = await native.launch_from_cache({
|
||||
cache_root,
|
||||
hash: event_file_obj.hash_sha256,
|
||||
temp_root,
|
||||
filename: event_file_obj.filename
|
||||
});
|
||||
|
||||
if (!launch_result.success) {
|
||||
open_file_status = 'error';
|
||||
open_file_status_message = `Failed to open: ${launch_result.error}`;
|
||||
}
|
||||
|
||||
setTimeout(() => (open_file_clicked = false), 5000);
|
||||
return launch_result.success;
|
||||
}
|
||||
// 2. ONSITE MODE (Browser with Modified Extensions)
|
||||
else if ($events_loc.launcher.app_mode === 'onsite') {
|
||||
open_file_clicked = true;
|
||||
open_file_status = 'downloading_onsite';
|
||||
open_file_status_message = 'Downloading (Onsite Mode)...';
|
||||
|
||||
let filename = event_file_obj.filename;
|
||||
if (
|
||||
(event_file_obj.extension === 'ppt' ||
|
||||
event_file_obj.extension === 'pptx') &&
|
||||
event_file_obj.open_in_os === 'win'
|
||||
) {
|
||||
filename = event_file_obj.filename + 'win';
|
||||
}
|
||||
|
||||
const dl_promise = api.get_object({
|
||||
api_cfg: $ae_api,
|
||||
endpoint: `/v3/action/hosted_file/${event_file_obj.hosted_file_id}/download`,
|
||||
params: {
|
||||
filename: filename,
|
||||
x_no_account_id_token: 'direct-download'
|
||||
},
|
||||
filename: filename,
|
||||
return_blob: true,
|
||||
auto_download: true,
|
||||
log_lvl: 1
|
||||
});
|
||||
|
||||
setTimeout(() => (open_file_clicked = false), 5000);
|
||||
return dl_promise;
|
||||
}
|
||||
// 3. DEFAULT MODE (Standard Browser)
|
||||
else {
|
||||
open_file_clicked = true;
|
||||
open_file_status = 'downloading_default';
|
||||
open_file_status_message = 'Downloading...';
|
||||
|
||||
const dl_promise = api.get_object({
|
||||
api_cfg: $ae_api,
|
||||
endpoint: `/v3/action/hosted_file/${event_file_obj.hosted_file_id}/download`,
|
||||
params: {
|
||||
filename: event_file_obj.filename,
|
||||
x_no_account_id_token: 'direct-download'
|
||||
},
|
||||
filename: event_file_obj.filename,
|
||||
return_blob: true,
|
||||
auto_download: true,
|
||||
log_lvl: 1
|
||||
});
|
||||
|
||||
if ($events_loc.launcher.controller == 'local_push') {
|
||||
$events_sess.launcher.controller_cmd = `ae_download:hosted_file=${event_file_obj.hosted_file_id}:${event_file_obj.filename}:${event_file_obj.extension}`;
|
||||
$events_sess.launcher.controller_trigger_send = true;
|
||||
}
|
||||
|
||||
setTimeout(() => (open_file_clicked = false), 5000);
|
||||
return dl_promise;
|
||||
}
|
||||
}
|
||||
|
||||
function prevent_default<T extends Event>(fn: (event: T) => void) {
|
||||
return function (event: T) {
|
||||
event.preventDefault();
|
||||
fn(event);
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<div
|
||||
@@ -227,24 +238,22 @@
|
||||
class:hidden={hide_draft &&
|
||||
(event_file_obj.file_purpose == 'outline' ||
|
||||
event_file_obj.file_purpose == 'draft')}
|
||||
class="event_launcher_file_cont grow flex flex-col md:flex-row flex-wrap gap-1 items-center justify-center max-w-full transition-all"
|
||||
>
|
||||
class="event_launcher_file_cont flex max-w-full grow flex-col flex-wrap items-center justify-center gap-1 transition-all md:flex-row">
|
||||
{#if open_file_clicked}
|
||||
<div
|
||||
class="open_file_clicked alert"
|
||||
in:fade={{ duration: 250 }}
|
||||
out:fade={{ duration: 2000 }}
|
||||
>
|
||||
out:fade={{ duration: 2000 }}>
|
||||
<div class="alert_msg_pulse">
|
||||
<strong
|
||||
>*** {open_file_status_message ||
|
||||
'Please wait while this file downloads...'} ***</strong
|
||||
>
|
||||
'Please wait while this file downloads...'} ***</strong>
|
||||
</div>
|
||||
{#if $ae_loc.is_native && $events_loc.launcher.app_mode === 'native'}
|
||||
<p>Most files will automatically be opened full screen.</p>
|
||||
<p>
|
||||
PowerPoint or KeyNote will attempt to display in presenter view.
|
||||
PowerPoint or KeyNote will attempt to display in presenter
|
||||
view.
|
||||
</p>
|
||||
<p>Please close the file when finished.</p>
|
||||
{/if}
|
||||
@@ -252,8 +261,7 @@
|
||||
{/if}
|
||||
|
||||
<span
|
||||
class="event_file_action grow max-w-full flex flex-row flex-wrap gap-1 items-center justify-center"
|
||||
>
|
||||
class="event_file_action flex max-w-full grow flex-row flex-wrap items-center justify-center gap-1">
|
||||
{#if session_type == 'poster' || open_method == 'modal'}
|
||||
<AE_Comp_Hosted_Files_Download_Button
|
||||
hosted_file_id={event_file_id}
|
||||
@@ -267,17 +275,24 @@
|
||||
$events_slct.event_file_id = event_file_id;
|
||||
$events_slct.event_file_obj = event_file_obj;
|
||||
// Push the open command to the remote display when in local_push mode
|
||||
if ($events_loc.launcher.controller == 'local_push' && $events_sess.launcher.ws_connect_status == 'connected') {
|
||||
if (
|
||||
$events_loc.launcher.controller == 'local_push' &&
|
||||
$events_sess.launcher.ws_connect_status == 'connected'
|
||||
) {
|
||||
$events_sess.launcher.controller_cmd = `ae_open:event_file=${event_file_id}`;
|
||||
$events_sess.launcher.controller_trigger_send = true;
|
||||
}
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
{#snippet label()}
|
||||
{#if screen_saver_exts.includes(event_file_obj.extension)}
|
||||
<BarChart2 size="1em" class="{hide_launch_icon ? 'hidden' : ''} m-1" /> Open Poster
|
||||
<BarChart2
|
||||
size="1em"
|
||||
class="{hide_launch_icon ? 'hidden' : ''} m-1" /> Open
|
||||
Poster
|
||||
{:else}
|
||||
<Send size="1em" class="{hide_launch_icon ? 'hidden' : ''} m-1" />
|
||||
<Send
|
||||
size="1em"
|
||||
class="{hide_launch_icon ? 'hidden' : ''} m-1" />
|
||||
{ae_util.shorten_filename({
|
||||
filename: event_file_obj.filename,
|
||||
max_length: max_filename_length
|
||||
@@ -291,13 +306,14 @@
|
||||
hosted_file_obj={event_file_obj}
|
||||
require_auth={false}
|
||||
classes="btn {btn_size} gap-1 justify-between min-w-full w-full max-w-96 preset-tonal-primary border border-primary-500"
|
||||
click={handle_open_file}
|
||||
>
|
||||
click={handle_open_file}>
|
||||
{#snippet label()}
|
||||
{@const file_id = event_file_obj.hosted_file_id}
|
||||
<span class="shrink text-xs border-r border-gray-400 pr-1">
|
||||
<span class="shrink border-r border-gray-400 pr-1 text-xs">
|
||||
{#await ae_promises[event_file_id]}
|
||||
<LoaderCircle size="1em" class="inline animate-spin mx-0.5" />
|
||||
<LoaderCircle
|
||||
size="1em"
|
||||
class="mx-0.5 inline animate-spin" />
|
||||
<span>
|
||||
{#if $ae_sess.api_download_kv[file_id]}
|
||||
{$ae_sess.api_download_kv[file_id]
|
||||
@@ -307,24 +323,28 @@
|
||||
{/if}
|
||||
</span>
|
||||
{:then result}
|
||||
{@const FileIcon = ae_util.file_extension_icon_lucide(event_file_obj.extension)}
|
||||
<FileIcon size="1em" class="inline mx-0.5" />
|
||||
{@const FileIcon =
|
||||
ae_util.file_extension_icon_lucide(
|
||||
event_file_obj.extension
|
||||
)}
|
||||
<FileIcon size="1em" class="mx-0.5 inline" />
|
||||
{event_file_obj.extension}
|
||||
{#if result === null || result === false}
|
||||
<span class="text-error-500"
|
||||
><AlertTriangle size="1em" class="inline mx-1" />Failed!</span
|
||||
>
|
||||
><AlertTriangle
|
||||
size="1em"
|
||||
class="mx-1 inline" />Failed!</span>
|
||||
{/if}
|
||||
{:catch error}
|
||||
<span class="text-error-500" title={error?.message}
|
||||
><AlertCircle size="1em" class="inline mx-0.5" />Error!</span
|
||||
>
|
||||
><AlertCircle
|
||||
size="1em"
|
||||
class="mx-0.5 inline" />Error!</span>
|
||||
{/await}
|
||||
</span>
|
||||
|
||||
<span
|
||||
class="grow {text_size} {text_size_md} w-full max-w-full overflow-hidden text-ellipsis {btn_text_align}"
|
||||
>
|
||||
class="grow {text_size} {text_size_md} w-full max-w-full overflow-hidden text-ellipsis {btn_text_align}">
|
||||
{ae_util.shorten_string({
|
||||
string: event_file_obj.filename_no_ext,
|
||||
begin_length: 45,
|
||||
@@ -333,9 +353,8 @@
|
||||
</span>
|
||||
|
||||
<span
|
||||
class="badge my-0 py-0.5 preset-tonal-success hover:preset-filled-success-500 text-xs xl:text-sm"
|
||||
class:hidden={!event_file_obj.file_purpose}
|
||||
>
|
||||
class="badge preset-tonal-success hover:preset-filled-success-500 my-0 py-0.5 text-xs xl:text-sm"
|
||||
class:hidden={!event_file_obj.file_purpose}>
|
||||
{event_file_obj.file_purpose}
|
||||
</span>
|
||||
{/snippet}
|
||||
@@ -344,9 +363,8 @@
|
||||
</span>
|
||||
|
||||
<span
|
||||
class="event_file_meta grow text-sm text-gray-500 flex flex-col sm:flex-row gap-1 wrap items-center justify-between w-64 max-w-80 font-mono"
|
||||
class:hidden={hide_meta}
|
||||
>
|
||||
class="event_file_meta wrap flex w-64 max-w-80 grow flex-col items-center justify-between gap-1 font-mono text-sm text-gray-500 sm:flex-row"
|
||||
class:hidden={hide_meta}>
|
||||
<button
|
||||
type="button"
|
||||
onclick={async () => {
|
||||
@@ -366,33 +384,33 @@
|
||||
log_lvl
|
||||
});
|
||||
}}
|
||||
class="btn btn-sm transition-all group"
|
||||
class="btn btn-sm group transition-all"
|
||||
class:preset-tonal-success={event_file_obj?.open_in_os == 'win'}
|
||||
class:preset-tonal-warning={event_file_obj?.open_in_os == 'mac'}
|
||||
disabled={!$ae_loc.trusted_access}
|
||||
>
|
||||
{#if event_file_obj?.open_in_os == 'win'}<Monitor size="1em" class="m-1" />
|
||||
{:else if event_file_obj?.open_in_os == 'mac'}<Laptop size="1em" class="m-1" />
|
||||
disabled={!$ae_loc.trusted_access}>
|
||||
{#if event_file_obj?.open_in_os == 'win'}<Monitor
|
||||
size="1em"
|
||||
class="m-1" />
|
||||
{:else if event_file_obj?.open_in_os == 'mac'}<Laptop
|
||||
size="1em"
|
||||
class="m-1" />
|
||||
{:else}<FolderOpen size="1em" class="m-1" />{/if}
|
||||
</button>
|
||||
|
||||
<span
|
||||
class="event_file_created_on text-xs text-center flex flex-row gap-1 items-center justify-end w-24 md:w-44 preset-filled-surface-100-900 rounded px-1 py-0.5"
|
||||
class:hidden={hide_created_on}
|
||||
>
|
||||
class="event_file_created_on preset-filled-surface-100-900 flex w-24 flex-row items-center justify-end gap-1 rounded px-1 py-0.5 text-center text-xs md:w-44"
|
||||
class:hidden={hide_created_on}>
|
||||
<CalendarDays size="0.85em" class="inline" />
|
||||
<span class="w-18"
|
||||
>{ae_util.iso_datetime_formatter(
|
||||
event_file_obj.created_on,
|
||||
'date_short'
|
||||
)}</span
|
||||
>
|
||||
)}</span>
|
||||
</span>
|
||||
|
||||
<span
|
||||
class="event_file_size text-xs text-center flex flex-row gap-1 items-center justify-end preset-filled-surface-100-900 w-22 max-w-28 rounded py-0.5"
|
||||
class:hidden={hide_size}
|
||||
>
|
||||
class="event_file_size preset-filled-surface-100-900 flex w-22 max-w-28 flex-row items-center justify-end gap-1 rounded py-0.5 text-center text-xs"
|
||||
class:hidden={hide_size}>
|
||||
<Save size="0.85em" class="inline" />
|
||||
{#if event_file_obj.file_size}{ae_util.format_bytes(
|
||||
event_file_obj.file_size
|
||||
|
||||
Reference in New Issue
Block a user