diff --git a/src/lib/types.ts b/src/lib/types.ts index 7e2cb17c..2680302d 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -4,6 +4,7 @@ * Stored in /users/{uid}/files/{fileID} in Firebase. */ export type UserFile = { + type: string; id: string; // not stored in database; injected by client lastAccessTime: number; title: string; diff --git a/src/routes/(index)/components/Dashboard.svelte b/src/routes/(index)/components/Dashboard.svelte index 9ee6625c..444b28d3 100644 --- a/src/routes/(index)/components/Dashboard.svelte +++ b/src/routes/(index)/components/Dashboard.svelte @@ -1,131 +1,550 @@ -
{showRecentlyDeleted ? 'No deleted files' : 'No files or folders'}
+ {#if !showRecentlyDeleted} +Tap the + buttons above to create new items
+ {/if} +| 0 && 'px-2', - 'py-3.5 text-left text-sm font-semibold text-black dark:text-gray-100' - ]} - > - {col} - | - {/each} -- Actions - | -|||
|---|---|---|---|---|
| - {#if file.hidden} - - {file.title || '(Unnamed File)'} (Hidden) - - {:else} - - {file.title || '(Unnamed File)'} - - {/if} - | -- {formatCreationTime(file.lastAccessTime)} - | -- {file.creationTime ? formatCreationTime(file.creationTime) : 'Unknown'} - | -- {file.language ? formatLanguage(file.language) : 'Unknown'} - | -
+
+
+
+
+
+
+
+
+ Name
+ Date Modified
+ Size
+ Tags
+ handleRightClick(e)}
+ >
+ {#if files && files.length > 0}
+ {#each files as file (file.id)}
+ handleDragStart(e, file)}
+ ondragend={handleDragEnd}
+ ondragover={file.type === 'folder' ? handleDragOver : undefined}
+ ondrop={file.type === 'folder' ? (e) => handleDrop(e, file) : undefined}
+ oncontextmenu={(e) => handleRightClick(e, file)}
+ ondblclick={() => file.type === 'folder' ? openFolder(file) : (window.location.href = `/${file.id.substring(1)}`)}
+ >
+
+
+
+
+
+
+ {getFileIcon(file)}
+
+
+ {#if renameInput && renameInput.id === file.id}
+
+ {
+ if (e.key === 'Enter') confirmRename();
+ if (e.key === 'Escape') cancelRename();
+ }}
+ onblur={confirmRename}
+ class="bg-[#404040] text-white px-2 py-1 rounded text-sm border border-gray-500 focus:border-indigo-500 focus:outline-none"
+ autofocus
+ />
+ {:else}
+
+ {file.title || file.name || '(Unnamed)'}
+
+ {/if}
+
+ {formatCreationTime(file.lastAccessTime || file.creationTime || Date.now())}
+
+
+
+
+ {file.type === 'folder' ? '--' : formatFileSize(file.size || 0)}
+
+
+
+
+ {#each (file.tags || []) as tag}
+
+
+ {tag}
+
- |
-
No files or folders
+Right-click to create new items
++ Are you sure you want to delete "{fileToDelete.title || fileToDelete.name || '(Unnamed)'}"? + {#if fileToDelete.type === 'folder'} + This will also delete all files inside this folder. + {/if} + This action cannot be undone. +
+