feat: show refresh button when viewing files, not just directories
- Move refresh button out of directory-only block in FileNavToolbar - When viewing a file, refresh reloads that file's content - When in directory view, refresh reloads the listing (unchanged)
This commit is contained in:
@@ -609,7 +609,14 @@
|
|||||||
{selectedFile}
|
{selectedFile}
|
||||||
{loading}
|
{loading}
|
||||||
onNavigate={loadDir}
|
onNavigate={loadDir}
|
||||||
onRefresh={() => loadDir(currentPath)}
|
onRefresh={() => {
|
||||||
|
if (selectedFile) {
|
||||||
|
const fileName = selectedFile.split('/').pop() ?? '';
|
||||||
|
openEntry({ name: fileName, type: 'file', size: 0 });
|
||||||
|
} else {
|
||||||
|
loadDir(currentPath);
|
||||||
|
}
|
||||||
|
}}
|
||||||
onNewFolder={startNewFolder}
|
onNewFolder={startNewFolder}
|
||||||
onNewFile={startNewFile}
|
onNewFile={startNewFile}
|
||||||
onUploadFiles={handleUploadFiles}
|
onUploadFiles={handleUploadFiles}
|
||||||
|
|||||||
@@ -81,27 +81,28 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if !selectedFile}
|
<Tooltip content={$i18n.t('Refresh')}>
|
||||||
<Tooltip content={$i18n.t('Refresh')}>
|
<button
|
||||||
<button
|
class="shrink-0 p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800 transition text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400"
|
||||||
class="shrink-0 p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800 transition text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400"
|
on:click={onRefresh}
|
||||||
on:click={onRefresh}
|
aria-label={$i18n.t('Refresh')}
|
||||||
aria-label={$i18n.t('Refresh')}
|
>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
fill="currentColor"
|
||||||
|
class="size-3.5 {loading ? 'animate-spin' : ''}"
|
||||||
>
|
>
|
||||||
<svg
|
<path
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
fill-rule="evenodd"
|
||||||
viewBox="0 0 20 20"
|
d="M15.312 11.424a5.5 5.5 0 0 1-9.201 2.466l-.312-.311h2.451a.75.75 0 0 0 0-1.5H4.5a.75.75 0 0 0-.75.75v3.75a.75.75 0 0 0 1.5 0v-2.127l.13.13a7 7 0 0 0 11.712-3.138.75.75 0 0 0-1.449-.39Zm-10.624-2.85a5.5 5.5 0 0 1 9.201-2.465l.312.31H11.75a.75.75 0 0 0 0 1.5h3.75a.75.75 0 0 0 .75-.75V3.42a.75.75 0 0 0-1.5 0v2.126l-.13-.129A7 7 0 0 0 3.239 8.555a.75.75 0 0 0 1.449.39Z"
|
||||||
fill="currentColor"
|
clip-rule="evenodd"
|
||||||
class="size-3.5 {loading ? 'animate-spin' : ''}"
|
/>
|
||||||
>
|
</svg>
|
||||||
<path
|
</button>
|
||||||
fill-rule="evenodd"
|
</Tooltip>
|
||||||
d="M15.312 11.424a5.5 5.5 0 0 1-9.201 2.466l-.312-.311h2.451a.75.75 0 0 0 0-1.5H4.5a.75.75 0 0 0-.75.75v3.75a.75.75 0 0 0 1.5 0v-2.127l.13.13a7 7 0 0 0 11.712-3.138.75.75 0 0 0-1.449-.39Zm-10.624-2.85a5.5 5.5 0 0 1 9.201-2.465l.312.31H11.75a.75.75 0 0 0 0 1.5h3.75a.75.75 0 0 0 .75-.75V3.42a.75.75 0 0 0-1.5 0v2.126l-.13-.129A7 7 0 0 0 3.239 8.555a.75.75 0 0 0 1.449.39Z"
|
|
||||||
clip-rule="evenodd"
|
{#if !selectedFile}
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</Tooltip>
|
|
||||||
<Tooltip content={$i18n.t('New Folder')}>
|
<Tooltip content={$i18n.t('New Folder')}>
|
||||||
<button
|
<button
|
||||||
class="shrink-0 p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800 transition text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400"
|
class="shrink-0 p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800 transition text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400"
|
||||||
|
|||||||
Reference in New Issue
Block a user