diff --git a/src/lib/components/chat/FileNav.svelte b/src/lib/components/chat/FileNav.svelte index e92ceba1d4..93b72ee0e1 100644 --- a/src/lib/components/chat/FileNav.svelte +++ b/src/lib/components/chat/FileNav.svelte @@ -5,7 +5,7 @@ @@ -335,169 +315,28 @@ {/if} - -
-
- {#each breadcrumbs as crumb, i} - {#if i > 1} - / - {/if} - - {/each} - {#if selectedFile} - / - - {selectedFile.split('/').pop()} - - {/if} -
- - {#if !selectedFile} - - - - - - - - - - { - if (!uploadInput?.files?.length || !configured) return; - uploading = true; - for (const file of Array.from(uploadInput.files)) { - await uploadToTerminal(terminalUrl, terminalKey, currentPath, file); - } - uploading = false; - uploadInput.value = ''; - await loadDir(currentPath); - }} - /> - {/if} -
+ loadDir(currentPath)} + onNewFolder={startNewFolder} + onUploadFiles={handleUploadFiles} + /> -
+
{#if selectedFile !== null} - -
- {#if fileImageUrl !== null} - - - - {/if} - -
- - {#if fileLoading} -
- {:else if fileImageUrl !== null} -
- {selectedFile?.split('/').pop()} -
- {:else if filePdfData !== null} - - {:else if fileContent !== null} -
{fileContent}
- {:else} -
- {$i18n.t('Could not read file.')} -
- {/if} + downloadFile(selectedFile)} + /> {:else} {#if uploading} @@ -539,117 +378,16 @@ {#if entries.length > 0 || creatingFolder}
    {#each entries as entry} -
  • -
    - - - - e.stopPropagation()} - aria-label={$i18n.t('More')} - > - - - - - {#if entry.type !== 'directory'} - { - e.stopPropagation(); - downloadFile(`${currentPath}${entry.name}`); - }} - > - - - - -
    {$i18n.t('Download')}
    -
    - {/if} - - { - e.stopPropagation(); - deleteTarget = { - path: `${currentPath}${entry.name}`, - name: entry.name - }; - showDeleteConfirm = true; - }} - > - -
    {$i18n.t('Delete')}
    -
    -
    -
    -
    -
  • + {/each}
{/if} diff --git a/src/lib/components/chat/FileNav/FileEntryRow.svelte b/src/lib/components/chat/FileNav/FileEntryRow.svelte new file mode 100644 index 0000000000..45f420900a --- /dev/null +++ b/src/lib/components/chat/FileNav/FileEntryRow.svelte @@ -0,0 +1,130 @@ + + +
  • +
    + + + + e.stopPropagation()} + aria-label={$i18n.t('More')} + > + + + + + {#if entry.type !== 'directory'} + { + e.stopPropagation(); + onDownload(`${currentPath}${entry.name}`); + }} + > + + + + +
    {$i18n.t('Download')}
    +
    + {/if} + + { + e.stopPropagation(); + onDelete(`${currentPath}${entry.name}`, entry.name); + }} + > + +
    {$i18n.t('Delete')}
    +
    +
    +
    +
    +
  • diff --git a/src/lib/components/chat/FileNav/FileNavToolbar.svelte b/src/lib/components/chat/FileNav/FileNavToolbar.svelte new file mode 100644 index 0000000000..f731cbbdcd --- /dev/null +++ b/src/lib/components/chat/FileNav/FileNavToolbar.svelte @@ -0,0 +1,125 @@ + + +
    +
    + {#each breadcrumbs as crumb, i} + {#if i > 1} + / + {/if} + + {/each} + {#if selectedFile} + / + + {selectedFile.split('/').pop()} + + {/if} +
    + + {#if !selectedFile} + + + + + + + + + + { + if (!uploadInput?.files?.length) return; + onUploadFiles(Array.from(uploadInput.files)); + uploadInput.value = ''; + }} + /> + {/if} +
    diff --git a/src/lib/components/chat/FileNav/FilePreview.svelte b/src/lib/components/chat/FileNav/FilePreview.svelte new file mode 100644 index 0000000000..e2e52f6ed6 --- /dev/null +++ b/src/lib/components/chat/FileNav/FilePreview.svelte @@ -0,0 +1,106 @@ + + +
    + +
    + {#if fileImageUrl !== null} + + + + {/if} + +
    + + + {#if fileLoading} +
    + {:else if fileImageUrl !== null} +
    + {selectedFile?.split('/').pop()} +
    + {:else if filePdfData !== null} + + {:else if fileContent !== null} +
    {fileContent}
    + {:else} +
    + {$i18n.t('Could not read file.')} +
    + {/if} +