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.

feat: add placeholder files pdf and organize files

Smaug673988c78a002c5f
diff --git a/frontend/app/composables/useApi.ts b/frontend/app/composables/useApi.ts
index 72ce42a8..527a20b5 100644
--- a/frontend/app/composables/useApi.ts
+++ b/frontend/app/composables/useApi.ts
@@ -7,7 +7,7 @@ export function useApi() {
const cdnEndpoint = config.public.cdnEndpoint || '';
function avatarURL(user?: User | PublicUser | null): string {
- if (!user?.avatar) return '/default_avatar.avif';
+ if (!user?.avatar) return '/placeholder/avatar.avif';
if (user.avatar.startsWith('http://') || user.avatar.startsWith('https://')) {
return user.avatar;
}
diff --git a/frontend/app/helpers/resources.ts b/frontend/app/helpers/resources.ts
index 70805003..61d04055 100644
--- a/frontend/app/helpers/resources.ts
+++ b/frontend/app/helpers/resources.ts
@@ -31,7 +31,10 @@ const resolvePreviewUrl = (node: Node): string => {
if (isImageFile((node.metadata?.filetype as string) || '')) {
return resourceURL(node);
}
- return '/file_placeholder.png';
+ if (isPdfFile((node.metadata?.filetype as string) || '')) {
+ return '/placeholder/pdf.webp';
+ }
+ return '/placeholder/file.webp';
};
/** Resolve the appropriate icon for a file based on its role and properties */
diff --git a/frontend/app/pages/dashboard/cdn/index.vue b/frontend/app/pages/dashboard/cdn/index.vue
index a1ecb68e..fb9bb2b8 100644
--- a/frontend/app/pages/dashboard/cdn/index.vue
+++ b/frontend/app/pages/dashboard/cdn/index.vue
@@ -63,7 +63,7 @@
@click="router.push(`/dashboard/cdn/${image.id}/preview`)"
@contextmenu="event => showContextMenu(event, image)"
>
- <img :src="previewURL(image)" :alt="image.name" class="image-preview" />
+ <img :src="resolvePreviewUrl(image)" :alt="image.name" class="image-preview" />
<div class="image-info">
<span class="image-name">{{ image.name }}</span>
<span class="image-size">{{ readableFileSize(image.size ?? 0) }}</span>
@@ -81,7 +81,7 @@
<script setup lang="ts">
import DeleteNodeModal from '~/components/Node/Modals/Delete.vue';
import ResourceContextMenu from '~/components/Node/Action/ResourceContextMenu.vue';
-import { readableFileSize } from '~/helpers/resources';
+import { readableFileSize, resolvePreviewUrl } from '~/helpers/resources';
import type { Field } from '~/components/DataTable.vue';
import type { Node } from '~/stores';
@@ -158,10 +158,6 @@ const submitFiles = async () => {
}
};
-const previewURL = (resource: Node) => {
- if ((resource.metadata?.filetype || '')?.includes('image/')) return resourceURL(resource);
- return '/file_placeholder.png';
-};
const headers = [
{ label: 'Name', key: 'name' },
{ label: 'Size', key: 'size' },
@@ -341,7 +337,7 @@ const bulkDelete = async (lines: Field[]) => {
padding: 16px 0;
flex: 1;
gap: 16px;
- grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
+ grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.image-item {
diff --git a/frontend/public/file_placeholder.png b/frontend/public/file_placeholder.png
deleted file mode 100644
index 4a71017a..00000000
Binary files a/frontend/public/file_placeholder.png and /dev/null differ
diff --git a/frontend/public/default_avatar.avif b/frontend/public/placeholder/avatar.avif
similarity index 100%
rename from frontend/public/default_avatar.avif
rename to frontend/public/placeholder/avatar.avif
diff --git a/frontend/public/placeholder/file.webp b/frontend/public/placeholder/file.webp
new file mode 100644
index 00000000..a1ff36df
Binary files /dev/null and b/frontend/public/placeholder/file.webp differ
diff --git a/frontend/public/placeholder/pdf.webp b/frontend/public/placeholder/pdf.webp
new file mode 100644
index 00000000..ebe375f2
Binary files /dev/null and b/frontend/public/placeholder/pdf.webp differ