From fc55cbf3d751b982c49883f7b916eca71fe5edd4 Mon Sep 17 00:00:00 2001 From: 01zulfi <85733202+01zulfi@users.noreply.github.com> Date: Wed, 26 Nov 2025 15:34:51 +0500 Subject: [PATCH] web: show total notes count in export dialog Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com> --- apps/web/src/common/export.ts | 6 +++++- apps/web/src/utils/streams/export-stream.ts | 12 +++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/apps/web/src/common/export.ts b/apps/web/src/common/export.ts index 21d3e4822..df9804f31 100644 --- a/apps/web/src/common/export.ts +++ b/apps/web/src/common/export.ts @@ -92,7 +92,11 @@ export async function exportNotes( const { createZipStream } = await import("../utils/streams/zip-stream"); const errors: Error[] = []; - const exportStream = new ExportStream(report, (e) => errors.push(e)); + const exportStream = new ExportStream( + report, + (e) => errors.push(e), + await notes.count() + ); await fromAsyncIterator( _exportNotes(notes, { format, unlockVault: Vault.unlockVault }) ) diff --git a/apps/web/src/utils/streams/export-stream.ts b/apps/web/src/utils/streams/export-stream.ts index 9263929e4..b991f64bd 100644 --- a/apps/web/src/utils/streams/export-stream.ts +++ b/apps/web/src/utils/streams/export-stream.ts @@ -28,8 +28,13 @@ export class ExportStream extends TransformStream< > { progress = 0; constructor( - report: (progress: { text: string; current?: number }) => void, - handleError: (error: Error) => void + report: (progress: { + text: string; + current?: number; + total?: number; + }) => void, + handleError: (error: Error) => void, + totalItems?: number ) { super({ transform: async (item, controller) => { @@ -69,7 +74,8 @@ export class ExportStream extends TransformStream< controller.enqueue(item); report({ current: this.progress++, - text: `Exporting note: ${item.path}` + text: `Exporting note: ${item.path}`, + total: totalItems }); } }