Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

feat(documents): implement document upload context with status (#212)

Corentin Thomasset7be56455b0d5
diff --git a/apps/papra-client/src/locales/en.yml b/apps/papra-client/src/locales/en.yml
index b172763d..4aadac3f 100644
--- a/apps/papra-client/src/locales/en.yml
+++ b/apps/papra-client/src/locales/en.yml
@@ -202,3 +202,18 @@ trash:
success:
title: Document deleted
description: The document has been permanently deleted.
+
+import-documents:
+ title:
+ error: '{{ count }} documents failed'
+ success: '{{ count }} documents imported'
+ pending: '{{ count }} / {{ total }} documents imported'
+ none: Import documents
+ no-import-in-progress: No document import in progress
+
+api-errors:
+ document.already_exists: The document already exists
+ document.file_too_big: The document file is too big
+ intake_email.limit_reached: The maximum number of intake emails for this organization has been reached. Please upgrade your plan to create more intake emails.
+ user.max_organization_count_reached: You have reached the maximum number of organizations you can create, if you need to create more, please contact support.
+ default: An error occurred while processing your request.
diff --git a/apps/papra-client/src/modules/demo/demo-api-mock.ts b/apps/papra-client/src/modules/demo/demo-api-mock.ts
index 78c9378d..0954bdd8 100644
--- a/apps/papra-client/src/modules/demo/demo-api-mock.ts
+++ b/apps/papra-client/src/modules/demo/demo-api-mock.ts
@@ -130,6 +130,9 @@ const inMemoryApiMock: Record<string, { handler: any }> = {
await documentFileStorage.setItem(key, await serializeFile(file));
await documentStorage.setItem(key, document);
+ // Simulate a slow response
+ await new Promise(resolve => setTimeout(resolve, 500));
+
return { document };
},
}),
diff --git a/apps/papra-client/src/modules/documents/components/document-import-status.component.tsx b/apps/papra-client/src/modules/documents/components/document-import-status.component.tsx
new file mode 100644
index 00000000..7177f291
--- /dev/null
+++ b/apps/papra-client/src/modules/documents/components/document-import-status.component.tsx
@@ -0,0 +1,208 @@
+import type { ParentComponent } from 'solid-js';
+import type { Document } from '../documents.types';
+import { useI18n } from '@/modules/i18n/i18n.provider';
+import { promptUploadFiles } from '@/modules/shared/files/upload';
+import { useI18nApiErrors } from '@/modules/shared/http/composables/i18n-api-errors';
+import { cn } from '@/modules/shared/style/cn';
+import { Button } from '@/modules/ui/components/button';
+import { safely } from '@corentinth/chisels';
+import { A } from '@solidjs/router';
+import { throttle } from 'lodash-es';
+import { createContext, createSignal, For, Match, Show, Switch, useContext } from 'solid-js';
+import { Portal } from 'solid-js/web';
+import { invalidateOrganizationDocumentsQuery } from '../documents.composables';
+import { uploadDocument } from '../documents.services';
+
+const DocumentUploadContext = createContext<{
+ uploadDocuments: (args: { files: File[]; organizationId: string }) => Promise<void>;
+}>();
+
+export function useDocumentUpload({ organizationId }: { organizationId: string }) {
+ const context = useContext(DocumentUploadContext);
+
+ if (!context) {
+ throw new Error('DocumentUploadContext not found');
+ }
+
+ const { uploadDocuments } = context;
+
+ return {
+ uploadDocuments: async ({ files }: { files: File[] }) => uploadDocuments({ files, organizationId }),
+ promptImport: async () => {
+ const { files } = await promptUploadFiles();
+
+ await uploadDocuments({ files, organizationId });
+ },
+ };
+}
+
+type TaskSuccess = {
+ file: File;
+ status: 'success';
+ document: Document;
+};
+
+type TaskError = {
+ file: File;
+ status: 'error';
+ error: Error;
+};
+
+type Task = TaskSuccess | TaskError | {
+ file: File;
+ status: 'pending' | 'uploading' ;
+};
+
+export const DocumentUploadProvider: ParentComponent = (props) => {
+ const throttledInvalidateOrganizationDocumentsQuery = throttle(invalidateOrganizationDocumentsQuery, 500);
+ const { getErrorMessage } = useI18nApiErrors();
+ const { t } = useI18n();
+
+ const [getState, setState] = createSignal<'open' | 'closed' | 'collapsed'>('closed');
+ const [getTasks, setTasks] = createSignal<Task[]>([]);
+
+ const updateTaskStatus = (args: { file: File; status: 'success'; document: Document } | { file: File; status: 'error'; error: Error } | { file: File; status: 'pending' | 'uploading' }) => {
+ setTasks(tasks => tasks.map(task => task.file === args.file ? { ...task, ...args } : task));
+ };
+
+ const uploadDocuments = async ({ files, organizationId }: { files: File[]; organizationId: string }) => {
+ setTasks(tasks => [...tasks, ...files.map(file => ({ file, status: 'pending' } as const))]);
+ setState('open');
+
+ await Promise.all(files.map(async (file) => {
+ updateTaskStatus({ file, status: 'uploading' });
+
+ const [result, error] = await safely(uploadDocument({ file, organizationId }));
+
+ if (error) {
+ updateTaskStatus({ file, status: 'error', error });
+ } else {
+ const { document } = result;
+
+ updateTaskStatus({ file, status: 'success', document });
+ }
+
+ await throttledInvalidateOrganizationDocumentsQuery({ organizationId });
+ }));
+ };
+
+ const getTitle = () => {
+ if (getTasks().length === 0) {
+ return t('import-documents.title.none');
+ }
+
+ const successCount = getTasks().filter(task => task.status === 'success').length;
+ const errorCount = getTasks().filter(task => task.status === 'error').length;
+ const totalCount = getTasks().length;
+
+ if (errorCount > 0) {
+ return t('import-documents.title.error', { count: errorCount });
+ }
+
+ if (successCount === totalCount) {
+ return t('import-documents.title.success', { count: successCount });
+ }
+
+ return t('import-documents.title.pending', { count: successCount, total: totalCount });
+ };
+
+ const close = () => {
+ setState('closed');
+ setTasks([]);
+ };
+
+ return (
+ <DocumentUploadContext.Provider value={{ uploadDocuments }}>
+ {props.children}
+
+ <Portal>
+ <Show when={getState() !== 'closed'}>
+ <div class="fixed bottom-0 right-0 sm:right-20px w-full sm:w-400px bg-card border-l border-t border-r sm:rounded-t-xl shadow-lg">
+ <div class="flex items-center gap-1 pl-6 pr-4 py-3 border-b">
+ <h2 class="text-base font-bold flex-1">{getTitle()}</h2>
+
+ <Button variant="ghost" size="icon" onClick={() => setState(state => state === 'open' ? 'collapsed' : 'open')}>
+ <div class={cn('i-tabler-chevron-down size-5 transition-transform', getState() === 'collapsed' && 'rotate-180')} />
+ </Button>
+
+ <Button variant="ghost" size="icon" onClick={close}>
+ <div class="i-tabler-x size-5"></div>
+ </Button>
+
+ </div>
+
+ <Show when={getState() === 'open'}>
+ <div class="flex flex-col overflow-y-auto h-[450px] pb-4">
+ <For each={getTasks()}>
+ {task => (
+
+ <Switch>
+ <Match when={task.status === 'success'}>
+ <A
+ href={`/organizations/${(task as TaskSuccess).document.organizationId}/documents/${(task as TaskSuccess).document.id}`}
+ class="text-sm truncate min-w-0 flex items-center gap-4 min-h-48px group hover:bg-muted/50 transition-colors px-6 border-b border-border/80"
+ >
+ <div class="flex-1 truncate">
+ {task.file.name}
+ </div>
+
+ <div class="flex-none">
+ <div class="i-tabler-circle-check text-primary size-5.5 group-hover:hidden"></div>
+ <div class="i-tabler-arrow-right text-muted-foreground size-5.5 hidden group-hover:block"></div>
+ </div>
+ </A>
+ </Match>
+
+ <Match when={task.status === 'error'}>
+ <div class="text-sm truncate min-w-0 flex items-center gap-4 min-h-48px px-6 border-b border-border/80">
+ <div class="flex-1 truncate">
+ <div class="flex-1 truncate">{task.file.name}</div>
+
+ <div class="text-xs text-muted-foreground truncate text-red-500">
+ {getErrorMessage({ error: (task as TaskError).error })}
+ </div>
+ </div>
+
+ <div class="flex-none">
+ <div class="i-tabler-circle-x text-red-500 size-5.5"></div>
+ </div>
+ </div>
+ </Match>
+
+ <Match when={['pending', 'uploading'].includes(task.status)}>
+ <div class="text-sm truncate min-w-0 flex items-center gap-4 min-h-48px px-6 border-b border-border/80">
+ <div class="flex-1 truncate">
+ {task.file.name}
+ </div>
+
+ <div class="flex-none">
+ <div class="i-tabler-loader-2 animate-spin text-muted-foreground size-5.5"></div>
+ </div>
+ </div>
+ </Match>
+ </Switch>
+
+ )}
+ </For>
+
+ <Show when={getTasks().length === 0}>
+ <div class="flex flex-col items-center justify-center gap-2 h-full mb-10">
+ <div class="flex flex-col items-center justify-center gap-2 ">
+ <div class="i-tabler-file-import size-10 text-muted-foreground"></div>
+ </div>
+
+ <div class="text-sm text-muted-foreground text-center mt-2">
+ {t('import-documents.no-import-in-progress')}
+ </div>
+ </div>
+ </Show>
+ </div>
+
+ </Show>
+
+ </div>
+ </Show>
+ </Portal>
+ </DocumentUploadContext.Provider>
+ );
+};
diff --git a/apps/papra-client/src/modules/documents/documents.composables.tsx b/apps/papra-client/src/modules/documents/documents.composables.tsx
index 0cbbdcce..2a9515e4 100644
--- a/apps/papra-client/src/modules/documents/documents.composables.tsx
+++ b/apps/papra-client/src/modules/documents/documents.composables.tsx
@@ -9,7 +9,7 @@ import { queryClient } from '../shared/query/query-client';
import { createToast } from '../ui/components/sonner';
import { deleteDocument, restoreDocument, uploadDocument } from './documents.services';
-function invalidateOrganizationDocumentsQuery({ organizationId }: { organizationId: string }) {
+export function invalidateOrganizationDocumentsQuery({ organizationId }: { organizationId: string }) {
return queryClient.invalidateQueries({
queryKey: ['organizations', organizationId],
});
diff --git a/apps/papra-client/src/modules/i18n/locales.types.ts b/apps/papra-client/src/modules/i18n/locales.types.ts
index ad73b9a3..d3beabd2 100644
--- a/apps/papra-client/src/modules/i18n/locales.types.ts
+++ b/apps/papra-client/src/modules/i18n/locales.types.ts
@@ -1,2 +1,2 @@
// Dynamically generated file. Use "pnpm script:generate-i18n-types" to update.
-export type LocaleKeys = 'auth.request-password-reset.title' | 'auth.request-password-reset.description' | 'auth.request-password-reset.requested' | 'auth.request-password-reset.back-to-login' | 'auth.request-password-reset.form.email.label' | 'auth.request-password-reset.form.email.placeholder' | 'auth.request-password-reset.form.email.required' | 'auth.request-password-reset.form.email.invalid' | 'auth.request-password-reset.form.submit' | 'auth.reset-password.title' | 'auth.reset-password.description' | 'auth.reset-password.reset' | 'auth.reset-password.back-to-login' | 'auth.reset-password.form.new-password.label' | 'auth.reset-password.form.new-password.placeholder' | 'auth.reset-password.form.new-password.required' | 'auth.reset-password.form.new-password.min-length' | 'auth.reset-password.form.new-password.max-length' | 'auth.reset-password.form.submit' | 'auth.email-provider.open' | 'auth.login.title' | 'auth.login.description' | 'auth.login.login-with-provider' | 'auth.login.no-account' | 'auth.login.register' | 'auth.login.form.email.label' | 'auth.login.form.email.placeholder' | 'auth.login.form.email.required' | 'auth.login.form.email.invalid' | 'auth.login.form.password.label' | 'auth.login.form.password.placeholder' | 'auth.login.form.password.required' | 'auth.login.form.remember-me.label' | 'auth.login.form.forgot-password.label' | 'auth.login.form.submit' | 'auth.register.title' | 'auth.register.description' | 'auth.register.register-with-email' | 'auth.register.register-with-provider' | 'auth.register.providers.google' | 'auth.register.providers.github' | 'auth.register.have-account' | 'auth.register.login' | 'auth.register.registration-disabled.title' | 'auth.register.registration-disabled.description' | 'auth.register.form.email.label' | 'auth.register.form.email.placeholder' | 'auth.register.form.email.required' | 'auth.register.form.email.invalid' | 'auth.register.form.password.label' | 'auth.register.form.password.placeholder' | 'auth.register.form.password.required' | 'auth.register.form.password.min-length' | 'auth.register.form.password.max-length' | 'auth.register.form.name.label' | 'auth.register.form.name.placeholder' | 'auth.register.form.name.required' | 'auth.register.form.name.max-length' | 'auth.register.form.submit' | 'auth.email-validation-required.title' | 'auth.email-validation-required.description' | 'auth.legal-links.description' | 'auth.legal-links.terms' | 'auth.legal-links.privacy' | 'tags.no-tags.title' | 'tags.no-tags.description' | 'tags.no-tags.create-tag' | 'layout.menu.home' | 'layout.menu.documents' | 'layout.menu.tags' | 'layout.menu.tagging-rules' | 'layout.menu.integrations' | 'layout.menu.deleted-documents' | 'layout.menu.organization-settings' | 'tagging-rules.field.name' | 'tagging-rules.field.content' | 'tagging-rules.operator.equals' | 'tagging-rules.operator.not-equals' | 'tagging-rules.operator.contains' | 'tagging-rules.operator.not-contains' | 'tagging-rules.operator.starts-with' | 'tagging-rules.operator.ends-with' | 'tagging-rules.list.title' | 'tagging-rules.list.description' | 'tagging-rules.list.demo-warning' | 'tagging-rules.list.no-tagging-rules.title' | 'tagging-rules.list.no-tagging-rules.description' | 'tagging-rules.list.no-tagging-rules.create-tagging-rule' | 'tagging-rules.list.card.no-conditions' | 'tagging-rules.list.card.one-condition' | 'tagging-rules.list.card.conditions' | 'tagging-rules.list.card.delete' | 'tagging-rules.list.card.edit' | 'tagging-rules.create.title' | 'tagging-rules.create.success' | 'tagging-rules.create.error' | 'tagging-rules.create.submit' | 'tagging-rules.form.name.label' | 'tagging-rules.form.name.placeholder' | 'tagging-rules.form.name.min-length' | 'tagging-rules.form.name.max-length' | 'tagging-rules.form.description.label' | 'tagging-rules.form.description.placeholder' | 'tagging-rules.form.description.max-length' | 'tagging-rules.form.conditions.label' | 'tagging-rules.form.conditions.description' | 'tagging-rules.form.conditions.add-condition' | 'tagging-rules.form.conditions.no-conditions.title' | 'tagging-rules.form.conditions.no-conditions.description' | 'tagging-rules.form.conditions.no-conditions.confirm' | 'tagging-rules.form.conditions.no-conditions.cancel' | 'tagging-rules.form.conditions.field.label' | 'tagging-rules.form.conditions.operator.label' | 'tagging-rules.form.conditions.value.label' | 'tagging-rules.form.conditions.value.placeholder' | 'tagging-rules.form.conditions.value.min-length' | 'tagging-rules.form.tags.label' | 'tagging-rules.form.tags.description' | 'tagging-rules.form.tags.min-length' | 'tagging-rules.form.tags.add-tag' | 'tagging-rules.form.submit' | 'tagging-rules.update.title' | 'tagging-rules.update.success' | 'tagging-rules.update.error' | 'tagging-rules.update.submit' | 'tagging-rules.update.cancel' | 'demo.popup.description' | 'demo.popup.discord' | 'demo.popup.discord-link-label' | 'demo.popup.reset' | 'demo.popup.hide' | 'trash.delete-all.button' | 'trash.delete-all.confirm.title' | 'trash.delete-all.confirm.description' | 'trash.delete-all.confirm.label' | 'trash.delete-all.confirm.cancel' | 'trash.delete.button' | 'trash.delete.confirm.title' | 'trash.delete.confirm.description' | 'trash.delete.confirm.label' | 'trash.delete.confirm.cancel' | 'trash.deleted.success.title' | 'trash.deleted.success.description';
+export type LocaleKeys = 'auth.request-password-reset.title' | 'auth.request-password-reset.description' | 'auth.request-password-reset.requested' | 'auth.request-password-reset.back-to-login' | 'auth.request-password-reset.form.email.label' | 'auth.request-password-reset.form.email.placeholder' | 'auth.request-password-reset.form.email.required' | 'auth.request-password-reset.form.email.invalid' | 'auth.request-password-reset.form.submit' | 'auth.reset-password.title' | 'auth.reset-password.description' | 'auth.reset-password.reset' | 'auth.reset-password.back-to-login' | 'auth.reset-password.form.new-password.label' | 'auth.reset-password.form.new-password.placeholder' | 'auth.reset-password.form.new-password.required' | 'auth.reset-password.form.new-password.min-length' | 'auth.reset-password.form.new-password.max-length' | 'auth.reset-password.form.submit' | 'auth.email-provider.open' | 'auth.login.title' | 'auth.login.description' | 'auth.login.login-with-provider' | 'auth.login.no-account' | 'auth.login.register' | 'auth.login.form.email.label' | 'auth.login.form.email.placeholder' | 'auth.login.form.email.required' | 'auth.login.form.email.invalid' | 'auth.login.form.password.label' | 'auth.login.form.password.placeholder' | 'auth.login.form.password.required' | 'auth.login.form.remember-me.label' | 'auth.login.form.forgot-password.label' | 'auth.login.form.submit' | 'auth.register.title' | 'auth.register.description' | 'auth.register.register-with-email' | 'auth.register.register-with-provider' | 'auth.register.providers.google' | 'auth.register.providers.github' | 'auth.register.have-account' | 'auth.register.login' | 'auth.register.registration-disabled.title' | 'auth.register.registration-disabled.description' | 'auth.register.form.email.label' | 'auth.register.form.email.placeholder' | 'auth.register.form.email.required' | 'auth.register.form.email.invalid' | 'auth.register.form.password.label' | 'auth.register.form.password.placeholder' | 'auth.register.form.password.required' | 'auth.register.form.password.min-length' | 'auth.register.form.password.max-length' | 'auth.register.form.name.label' | 'auth.register.form.name.placeholder' | 'auth.register.form.name.required' | 'auth.register.form.name.max-length' | 'auth.register.form.submit' | 'auth.email-validation-required.title' | 'auth.email-validation-required.description' | 'auth.legal-links.description' | 'auth.legal-links.terms' | 'auth.legal-links.privacy' | 'tags.no-tags.title' | 'tags.no-tags.description' | 'tags.no-tags.create-tag' | 'layout.menu.home' | 'layout.menu.documents' | 'layout.menu.tags' | 'layout.menu.tagging-rules' | 'layout.menu.integrations' | 'layout.menu.deleted-documents' | 'layout.menu.organization-settings' | 'tagging-rules.field.name' | 'tagging-rules.field.content' | 'tagging-rules.operator.equals' | 'tagging-rules.operator.not-equals' | 'tagging-rules.operator.contains' | 'tagging-rules.operator.not-contains' | 'tagging-rules.operator.starts-with' | 'tagging-rules.operator.ends-with' | 'tagging-rules.list.title' | 'tagging-rules.list.description' | 'tagging-rules.list.demo-warning' | 'tagging-rules.list.no-tagging-rules.title' | 'tagging-rules.list.no-tagging-rules.description' | 'tagging-rules.list.no-tagging-rules.create-tagging-rule' | 'tagging-rules.list.card.no-conditions' | 'tagging-rules.list.card.one-condition' | 'tagging-rules.list.card.conditions' | 'tagging-rules.list.card.delete' | 'tagging-rules.list.card.edit' | 'tagging-rules.create.title' | 'tagging-rules.create.success' | 'tagging-rules.create.error' | 'tagging-rules.create.submit' | 'tagging-rules.form.name.label' | 'tagging-rules.form.name.placeholder' | 'tagging-rules.form.name.min-length' | 'tagging-rules.form.name.max-length' | 'tagging-rules.form.description.label' | 'tagging-rules.form.description.placeholder' | 'tagging-rules.form.description.max-length' | 'tagging-rules.form.conditions.label' | 'tagging-rules.form.conditions.description' | 'tagging-rules.form.conditions.add-condition' | 'tagging-rules.form.conditions.no-conditions.title' | 'tagging-rules.form.conditions.no-conditions.description' | 'tagging-rules.form.conditions.no-conditions.confirm' | 'tagging-rules.form.conditions.no-conditions.cancel' | 'tagging-rules.form.conditions.field.label' | 'tagging-rules.form.conditions.operator.label' | 'tagging-rules.form.conditions.value.label' | 'tagging-rules.form.conditions.value.placeholder' | 'tagging-rules.form.conditions.value.min-length' | 'tagging-rules.form.tags.label' | 'tagging-rules.form.tags.description' | 'tagging-rules.form.tags.min-length' | 'tagging-rules.form.tags.add-tag' | 'tagging-rules.form.submit' | 'tagging-rules.update.title' | 'tagging-rules.update.success' | 'tagging-rules.update.error' | 'tagging-rules.update.submit' | 'tagging-rules.update.cancel' | 'demo.popup.description' | 'demo.popup.discord' | 'demo.popup.discord-link-label' | 'demo.popup.reset' | 'demo.popup.hide' | 'trash.delete-all.button' | 'trash.delete-all.confirm.title' | 'trash.delete-all.confirm.description' | 'trash.delete-all.confirm.label' | 'trash.delete-all.confirm.cancel' | 'trash.delete.button' | 'trash.delete.confirm.title' | 'trash.delete.confirm.description' | 'trash.delete.confirm.label' | 'trash.delete.confirm.cancel' | 'trash.deleted.success.title' | 'trash.deleted.success.description' | 'import-documents.title.error' | 'import-documents.title.success' | 'import-documents.title.pending' | 'import-documents.title.none' | 'import-documents.no-import-in-progress' | 'api-errors.document.already_exists' | 'api-errors.document.file_too_big' | 'api-errors.intake_email.limit_reached' | 'api-errors.user.max_organization_count_reached' | 'api-errors.default';
diff --git a/apps/papra-client/src/modules/shared/http/composables/i18n-api-errors.ts b/apps/papra-client/src/modules/shared/http/composables/i18n-api-errors.ts
new file mode 100644
index 00000000..fdf0f4de
--- /dev/null
+++ b/apps/papra-client/src/modules/shared/http/composables/i18n-api-errors.ts
@@ -0,0 +1,29 @@
+import type { LocaleKeys } from '@/modules/i18n/locales.types';
+import { useI18n } from '@/modules/i18n/i18n.provider';
+import { get } from 'lodash-es';
+
+export function useI18nApiErrors({ t = useI18n().t }: { t?: ReturnType<typeof useI18n>['t'] } = {}) {
+ const getTranslationFromApiErrorCode = ({ code }: { code: string }) => {
+ return t(`api-errors.${code}` as LocaleKeys);
+ };
+
+ const getTranslationFromApiError = ({ error }: { error: unknown }) => {
+ const code = get(error, 'data.error.code') ?? get(error, 'code');
+
+ if (!code) {
+ return t('api-errors.default');
+ }
+
+ return getTranslationFromApiErrorCode({ code });
+ };
+
+ return {
+ getErrorMessage: (args: { error: unknown } | { code: string }) => {
+ if ('error' in args) {
+ return getTranslationFromApiError({ error: args.error });
+ }
+
+ return getTranslationFromApiErrorCode({ code: args.code });
+ },
+ };
+}
diff --git a/apps/papra-client/src/modules/ui/layouts/organization.layout.tsx b/apps/papra-client/src/modules/ui/layouts/organization.layout.tsx
index 2cb5538a..43363a92 100644
--- a/apps/papra-client/src/modules/ui/layouts/organization.layout.tsx
+++ b/apps/papra-client/src/modules/ui/layouts/organization.layout.tsx
@@ -1,7 +1,8 @@
import type { Organization } from '@/modules/organizations/organizations.types';
-import { useI18n } from '@/modules/i18n/i18n.provider';
+import { DocumentUploadProvider } from '@/modules/documents/components/document-import-status.component';
+import { useI18n } from '@/modules/i18n/i18n.provider';
import { fetchOrganization, fetchOrganizations } from '@/modules/organizations/organizations.services';
import { useNavigate, useParams } from '@solidjs/router';
import { createQueries, createQuery } from '@tanstack/solid-query';
@@ -166,9 +167,11 @@ export const OrganizationLayout: ParentComponent = (props) => {
));
return (
- <SidenavLayout
- children={props.children}
- sideNav={OrganizationLayoutSideNav}
- />
+ <DocumentUploadProvider>
+ <SidenavLayout
+ children={props.children}
+ sideNav={OrganizationLayoutSideNav}
+ />
+ </DocumentUploadProvider>
);
};
diff --git a/apps/papra-client/src/modules/ui/layouts/sidenav.layout.tsx b/apps/papra-client/src/modules/ui/layouts/sidenav.layout.tsx
index baf316cb..9a329df7 100644
--- a/apps/papra-client/src/modules/ui/layouts/sidenav.layout.tsx
+++ b/apps/papra-client/src/modules/ui/layouts/sidenav.layout.tsx
@@ -3,10 +3,10 @@ import { signOut } from '@/modules/auth/auth.services';
import { useCommandPalette } from '@/modules/command-palette/command-palette.provider';
import { useConfig } from '@/modules/config/config.provider';
+import { useDocumentUpload } from '@/modules/documents/components/document-import-status.component';
import { GlobalDropArea } from '@/modules/documents/components/global-drop-area.component';
-import { useUploadDocuments } from '@/modules/documents/documents.composables';
-import { useI18n } from '@/modules/i18n/i18n.provider';
+import { useI18n } from '@/modules/i18n/i18n.provider';
import { cn } from '@/modules/shared/style/cn';
import { useThemeStore } from '@/modules/theme/theme.store';
import { Button } from '@/modules/ui/components/button';
@@ -182,7 +182,7 @@ export const SidenavLayout: ParentComponent<{
const { openCommandPalette } = useCommandPalette();
const navigate = useNavigate();
- const { promptImport, uploadDocuments } = useUploadDocuments({ organizationId: params.organizationId });
+ const { promptImport, uploadDocuments } = useDocumentUpload({ organizationId: params.organizationId });
return (
<div class="flex flex-row h-screen min-h-0">