Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Fixes with app drop icons and export helpers

Smaug6739d8af22c07110
diff --git a/frontend/app/components/AppDrop.vue b/frontend/app/components/AppDrop.vue
index e7298e5e..0b8d2664 100644
--- a/frontend/app/components/AppDrop.vue
+++ b/frontend/app/components/AppDrop.vue
@@ -14,11 +14,11 @@
<div class="list">
<div v-for="(file, index) in selectedFiles" :key="index" class="item">
<div class="icon">
- <Icon :name="getFileIcon(file.type)" size="20px" />
+ <Icon :name="resolveFileIcon(file.type)" />
</div>
<div class="details">
<span class="name">{{ file.name }}</span>
- <span class="meta">{{ readableFileSize(file.size) }} β€’ {{ getFileType(file.type) }}</span>
+ <span class="meta">{{ readableFileSize(file.size) }} β€’ {{ resolveFileType(file.type) }}</span>
</div>
<button class="remove" title="Remove file" @click.stop="removeFile(index)">
<Icon name="close" size="16px" />
@@ -40,7 +40,7 @@
</div>
</template>
<script setup lang="ts">
-import { readableFileSize } from '~/helpers/resources';
+import { readableFileSize, resolveFileIcon, resolveFileType } from '~/helpers/resources';
const props = withDefaults(
defineProps<{
@@ -59,24 +59,6 @@ const fileInput = ref<HTMLInputElement | null>(null);
const totalSize = computed(() => selectedFiles.value.reduce((acc, file) => acc + file.size, 0));
-const getFileIcon = (mimeType: string) => {
- if (mimeType.startsWith('image/')) return 'image';
- if (mimeType.startsWith('video/')) return 'video';
- if (mimeType.startsWith('audio/')) return 'music';
- if (mimeType.includes('pdf')) return 'file-pdf';
- if (mimeType.includes('zip') || mimeType.includes('archive')) return 'file-zip';
- return 'file';
-};
-
-const getFileType = (mimeType: string) => {
- if (mimeType.startsWith('image/')) return 'Image';
- if (mimeType.startsWith('video/')) return 'Video';
- if (mimeType.startsWith('audio/')) return 'Audio';
- if (mimeType.includes('pdf')) return 'PDF';
- if (mimeType.includes('zip') || mimeType.includes('archive')) return 'Archive';
- return 'File';
-};
-
const emit = defineEmits<{
select: [files: File | File[] | null];
}>();
@@ -256,7 +238,6 @@ defineExpose({ reset });
height: 36px;
border-radius: $radius-sm;
color: var(--primary);
- background: var(--bg-ui);
align-items: center;
flex-shrink: 0;
justify-content: center;
diff --git a/frontend/app/helpers/resources.ts b/frontend/app/helpers/resources.ts
index dd9aed71..2f3ff804 100644
--- a/frontend/app/helpers/resources.ts
+++ b/frontend/app/helpers/resources.ts
@@ -25,4 +25,23 @@ const resolvePreviewUrl = (node: Node): string => {
return '/file_placeholder.png';
};
-export { readableFileSize, resolvePreviewUrl, isImageFile };
+/** Resolve the appropriate icon for a file based on its role and properties */
+const resolveFileIcon = (mimeType: string) => {
+ if (mimeType.startsWith('image/')) return 'image';
+ if (mimeType.startsWith('video/')) return 'video';
+ if (mimeType.startsWith('audio/')) return 'music';
+ if (mimeType.includes('pdf')) return 'pdf';
+ return 'file';
+};
+
+/** Get human-readable type name for a file based on its MIME type */
+const resolveFileType = (mimeType: string) => {
+ if (mimeType.startsWith('image/')) return 'Image';
+ if (mimeType.startsWith('video/')) return 'Video';
+ if (mimeType.startsWith('audio/')) return 'Audio';
+ if (mimeType.includes('pdf')) return 'PDF';
+ if (mimeType.includes('zip') || mimeType.includes('archive')) return 'Archive';
+ return 'File';
+};
+
+export { readableFileSize, resolvePreviewUrl, isImageFile, resolveFileIcon, resolveFileType };
diff --git a/frontend/public/app-icons/pdf.svg b/frontend/public/app-icons/pdf.svg
index aacb4490..648bf4f9 100644
--- a/frontend/public/app-icons/pdf.svg
+++ b/frontend/public/app-icons/pdf.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path style="fill:var(--green);" d="M280-280h280v-80H280v80Zm0-160h400v-80H280v80Zm0-160h400v-80H280v80Zm-80 480q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"/></svg>
\ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M280-280h280v-80H280v80Zm0-160h400v-80H280v80Zm0-160h400v-80H280v80Zm-80 480q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/video.svg b/frontend/public/app-icons/video.svg
new file mode 100644
index 00000000..f05f8098
--- /dev/null
+++ b/frontend/public/app-icons/video.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-320h400L462-500l-92 120-62-80-108 140Zm-40 160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h480q33 0 56.5 23.5T720-720v180l160-160v440L720-420v180q0 33-23.5 56.5T640-160H160Zm0-80h480v-480H160v480Zm0 0v-480 480Z"/></svg>
\ No newline at end of file