feat: Add buffering indicator and improve queue item removal

Introduces a visual indicator for when the reader is buffering, meaning it's supposed to be playing but the current audio segment is not yet available.

Also, prevents accidental article selection when clicking the "Remove" button in the queue by adding `stopPropagation`.
This commit is contained in:
Anthony
2025-11-19 20:36:39 +08:00
parent dadebf8cd0
commit 0b10d71554
3 changed files with 84 additions and 19 deletions

View File

@@ -106,6 +106,8 @@ export const ReaderView: React.FC<ReaderViewProps> = ({ article, settings, onTog
{article.segments.length > 0 ? (
article.segments.map((segment, idx) => {
const isActive = article.currentSegmentIndex === idx;
const isBuffering = isActive && article.status === 'PLAYING' && !segment.audioUrl;
return (
<div
key={segment.id}
@@ -116,7 +118,7 @@ export const ReaderView: React.FC<ReaderViewProps> = ({ article, settings, onTog
transition-all duration-200 whitespace-pre-wrap rounded-xl p-3 sm:p-4 -mx-2 sm:-mx-4 border-l-4 mb-2
${getLeadingClass()}
${isActive
? 'text-slate-900 dark:text-white bg-blue-50 dark:bg-blue-900/20 border-blue-500 shadow-sm'
? `bg-blue-50 dark:bg-blue-900/20 border-blue-500 shadow-sm ${isBuffering ? 'animate-pulse opacity-70' : 'text-slate-900 dark:text-white'}`
: 'text-slate-700 dark:text-slate-300 border-transparent hover:bg-slate-100 dark:hover:bg-slate-800/50 cursor-pointer hover:border-slate-300 dark:hover:border-slate-600'
}
`}