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.

fix(cdn): improve mobile upload experience (#755)

Hassanat Oyediran7b8ad190a899
diff --git a/frontend/app/components/AppDrop.vue b/frontend/app/components/AppDrop.vue
index bfbfbeef..759ee5c7 100644
--- a/frontend/app/components/AppDrop.vue
+++ b/frontend/app/components/AppDrop.vue
@@ -7,6 +7,7 @@
@dragenter.prevent="dragEnter"
@dragleave.prevent="dragLeave"
@paste.prevent="handlePaste"
+ @click="handleDropAreaClick"
>
<input ref="fileInput" type="file" :multiple="multiple" :webkitdirectory="allowFolders" @change="handleFileSelect" />
@@ -28,7 +29,10 @@
<div v-else class="empty">
<Icon name="layers" size="40px" />
- <p v-if="multiple">
+ <p v-if="isMobile" class="mobile-prompt">
+ {{ t('cdn.appdrop.promptMobile') }}
+ </p>
+ <p v-else-if="multiple">
<i18n-t scope="global" keypath="cdn.appdrop.promptPlural">
<template #link>
<span class="link" @click="triggerFileSelect">{{ t('cdn.appdrop.link') }}</span>
@@ -67,6 +71,7 @@ const emit = defineEmits<{
}>();
const { t } = useI18nT();
+const { isMobile } = useDevice();
const selectedFiles = ref<File[]>([]);
const isDragOver = ref(false);
@@ -77,6 +82,12 @@ const totalSize = computed(() => selectedFiles.value.reduce((acc, file) => acc +
// Actions
const triggerFileSelect = () => fileInput.value!.click();
+const handleDropAreaClick = () => {
+ if (isMobile.value && !selectedFiles.value.length) {
+ triggerFileSelect();
+ }
+};
+
const addFiles = (files?: FileList | File[] | null) => {
if (!files) return;
const fileArray = Array.from(files);
@@ -192,6 +203,11 @@ defineExpose({ reset });
margin: 0;
}
+ .mobile-prompt {
+ max-width: 160px;
+ text-align: center;
+ }
+
.hint {
font-size: 12px;
color: var(--text-secondary);
@@ -236,4 +252,5 @@ footer {
text-decoration: underline;
}
}
+
</style>
diff --git a/frontend/i18n/locales/de/cdn.ts b/frontend/i18n/locales/de/cdn.ts
index 8b177a20..113f6663 100644
--- a/frontend/i18n/locales/de/cdn.ts
+++ b/frontend/i18n/locales/de/cdn.ts
@@ -14,6 +14,7 @@ export default {
link: 'hier klicken',
max: 'Maximal {n} Dateien',
prompt: 'Ziehe deine Datei hierher oder klicke auf {link}, um sie auszuwählen',
+ promptMobile: 'Tippe hier, um Dateien von deinem Gerät auszuwählen',
promptPlural: 'Ziehe deine Dateien hierher oder klicke auf {link}, um sie auszuwählen',
removeFile: 'Datei entfernen',
},
diff --git a/frontend/i18n/locales/en/cdn.ts b/frontend/i18n/locales/en/cdn.ts
index 5cf61ba0..d3d57fad 100644
--- a/frontend/i18n/locales/en/cdn.ts
+++ b/frontend/i18n/locales/en/cdn.ts
@@ -14,6 +14,7 @@ export default {
link: 'click here',
max: 'Maximum {n} files',
prompt: 'Drag and drop your file here or {link} to select',
+ promptMobile: 'Tap to select files from your device',
promptPlural: 'Drag and drop your files here or {link} to select',
removeFile: 'Remove file',
},
diff --git a/frontend/i18n/locales/fr/cdn.ts b/frontend/i18n/locales/fr/cdn.ts
index 82f07f2a..1bc7b70a 100644
--- a/frontend/i18n/locales/fr/cdn.ts
+++ b/frontend/i18n/locales/fr/cdn.ts
@@ -14,6 +14,7 @@ export default {
link: 'cliquez ici',
max: 'Maximum {n} fichiers',
prompt: 'Glissez-déposez votre fichier ici ou {link} pour sélectionner',
+ promptMobile: 'Appuyez pour sélectionner des fichiers depuis votre appareil',
promptPlural: 'Glissez-déposez vos fichiers ici ou {link} pour sélectionner',
removeFile: 'Supprimer le fichier',
},
diff --git a/frontend/i18n/locales/it/cdn.ts b/frontend/i18n/locales/it/cdn.ts
index 84d8f284..0aec38b8 100644
--- a/frontend/i18n/locales/it/cdn.ts
+++ b/frontend/i18n/locales/it/cdn.ts
@@ -14,6 +14,7 @@ export default {
link: 'clicca qui',
max: 'Massimo {n} file',
prompt: 'Trascina e rilascia il tuo file qui o {link} per selezionarlo',
+ promptMobile: 'Tocca per selezionare i file dal tuo dispositivo',
promptPlural: 'Trascina e rilascia i tuoi file qui o {link} per selezionarli',
removeFile: 'Rimuovi file',
},
diff --git a/frontend/i18n/locales/ko/cdn.ts b/frontend/i18n/locales/ko/cdn.ts
index b685f24b..e19f039d 100644
--- a/frontend/i18n/locales/ko/cdn.ts
+++ b/frontend/i18n/locales/ko/cdn.ts
@@ -14,6 +14,7 @@ export default {
link: '여기를 클릭',
max: '최대 {n}개 파일',
prompt: '파일을 여기로 드래그 앤 드롭하거나 {link}해서 선택하세요',
+ promptMobile: '기기에서 파일을 선택하려면 탭하세요',
promptPlural: '파일을 여기로 드래그 앤 드롭하거나 {link}해서 선택하세요',
removeFile: '파일 제거',
},
diff --git a/frontend/i18n/locales/uk/cdn.ts b/frontend/i18n/locales/uk/cdn.ts
index 17649588..8a40bdd8 100644
--- a/frontend/i18n/locales/uk/cdn.ts
+++ b/frontend/i18n/locales/uk/cdn.ts
@@ -14,6 +14,7 @@ export default {
link: 'натисніть тут',
max: 'Максимум {n} файлів',
prompt: 'Перетягніть файл сюди або {link}, щоб вибрати',
+ promptMobile: 'Торкніться, щоб вибрати файли з пристрою',
promptPlural: 'Перетягніть файли сюди або {link}, щоб вибрати',
removeFile: 'Видалити файл',
},
diff --git a/frontend/i18n/locales/zh-CN/cdn.ts b/frontend/i18n/locales/zh-CN/cdn.ts
index 438c7fd3..679cd290 100644
--- a/frontend/i18n/locales/zh-CN/cdn.ts
+++ b/frontend/i18n/locales/zh-CN/cdn.ts
@@ -14,6 +14,7 @@ export default {
link: '点击这里',
max: '最多 {n} 个文件',
prompt: '将文件拖拽至此,或{link}选择文件',
+ promptMobile: '轻触以选择设备中的文件',
promptPlural: '将文件拖拽至此,或{link}选择文件',
removeFile: '移除文件',
},
diff --git a/frontend/i18n/locales/zh-TW/cdn.ts b/frontend/i18n/locales/zh-TW/cdn.ts
index 75174397..eec8093f 100644
--- a/frontend/i18n/locales/zh-TW/cdn.ts
+++ b/frontend/i18n/locales/zh-TW/cdn.ts
@@ -14,6 +14,7 @@ export default {
link: '按這裡',
max: '最多 {n} 個檔案',
prompt: '將檔案拖曳至此,或{link}選擇檔案',
+ promptMobile: '輕觸以選擇裝置中的檔案',
promptPlural: '將檔案拖曳至此,或{link}選擇檔案',
removeFile: '移除檔案',
},