Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: show total notes count in export dialog Signed-off-by: 01zulfi <[email protected]>

01zulfifc55cbf3d751
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
});
}
}