From eaab2012db572f6cf096f892d15f1b5085acec76 Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Sat, 20 Sep 2025 10:52:41 +0200 Subject: [PATCH] Improves staggered prompt display timing Ensures prompt notifications display correctly by adjusting the notification duration based on the configured delay. Prevents potential overlap between successive prompts. --- commands/staggeredPrompts.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/commands/staggeredPrompts.ts b/commands/staggeredPrompts.ts index d27bdfe..ed87593 100644 --- a/commands/staggeredPrompts.ts +++ b/commands/staggeredPrompts.ts @@ -32,7 +32,7 @@ export class StaggeredPromptsCommand { this.currentIndex = 0; // Show the first prompt immediately - this.showCurrentPrompt(); + this.showCurrentPrompt(settings.delaySeconds); // If there are more prompts, start the interval if (prompts.length > 1) { @@ -65,7 +65,7 @@ export class StaggeredPromptsCommand { this.currentIndex++; if (this.currentIndex < this.promptQueue.length) { - this.showCurrentPrompt(); + this.showCurrentPrompt(delaySeconds); } else { // We've shown all prompts, stop the interval this.stop(); @@ -74,16 +74,19 @@ export class StaggeredPromptsCommand { }, delaySeconds * 1000); } - private showCurrentPrompt(): void { + private showCurrentPrompt(delaySeconds: number): void { if (this.currentIndex < this.promptQueue.length) { const prompt = this.promptQueue[this.currentIndex]; const promptNumber = this.currentIndex + 1; const totalPrompts = this.promptQueue.length; - // Create a longer-lasting notice for the prompt + // Calculate notification duration: slightly less than delay to avoid overlap + // Subtract 500ms to allow for fade-out before next prompt appears + const notificationDuration = Math.max(1000, (delaySeconds * 1000) - 500); + const notice = new Notice( `Writing Prompt ${promptNumber}/${totalPrompts}:\n\n${prompt}`, - 8000 // Show for 8 seconds + notificationDuration ); // Add CSS class for styling