From b6880b9910ce46e01e3b090ee362e162150daad7 Mon Sep 17 00:00:00 2001 From: Richard Roberson Date: Sat, 25 Jan 2025 22:36:28 -0700 Subject: [PATCH] Fix end of document reached --- src/contexts/TTSContext.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/contexts/TTSContext.tsx b/src/contexts/TTSContext.tsx index f3669b4..6724df8 100644 --- a/src/contexts/TTSContext.tsx +++ b/src/contexts/TTSContext.tsx @@ -134,6 +134,10 @@ export function TTSProvider({ children }: { children: React.ReactNode }) { setCurrDocPage(currDocPage - 1); return 0; + } else if (nextIndex >= sentences.length && currDocPage >= currDocPages!) { + console.log('Reached end of document'); + setIsPlaying(false); + return prev; } return prev; });