Unify player into single compact row, remove orphaned circle button
Some checks failed
CI / Lint (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Build (push) Has been cancelled

This commit is contained in:
Admin
2026-03-02 09:38:54 +05:00
parent e4ab8664e9
commit 5cfb411530

View File

@@ -1937,10 +1937,10 @@ const chapterTmpl = `
</label> </label>
</div> </div>
<div class="max-w-2xl mx-auto px-3 py-2 flex flex-col gap-1.5"> <div class="max-w-2xl mx-auto px-3 py-2 flex flex-col gap-0">
<!-- Row 1: chapter nav + title + status + settings --> <!-- Single control row -->
<div class="flex items-center gap-2"> <div class="flex items-center gap-1.5 h-11">
<!-- Prev chapter --> <!-- Prev chapter -->
{{if .PrevN}} {{if .PrevN}}
@@ -1951,23 +1951,31 @@ const chapterTmpl = `
hx-swap="innerHTML" hx-swap="innerHTML"
title="Previous chapter" title="Previous chapter"
aria-label="Previous chapter" aria-label="Previous chapter"
class="flex-shrink-0 px-2 py-1 rounded-md text-zinc-400 hover:text-zinc-100 text-xs transition-colors no-underline bg-zinc-800 hover:bg-zinc-700"> class="flex-shrink-0 flex items-center justify-center w-8 h-8 rounded-lg text-zinc-400 hover:text-zinc-100 hover:bg-zinc-800 text-sm transition-colors no-underline">
&#8592; Prev &#8592;
</a> </a>
{{else}} {{else}}
<span class="flex-shrink-0 w-[3.5rem]"></span> <span class="flex-shrink-0 w-8"></span>
{{end}} {{end}}
<!-- Title + state badge --> <!-- Play/Pause -->
<div class="flex-1 min-w-0 flex items-center gap-2"> <button id="player-play-btn"
<span id="player-title" class="text-[0.78rem] font-medium text-zinc-300 truncate">Ch.&#x00A0;{{.ChapterN}}</span> type="button"
onclick="ttsToggle()"
aria-label="Play/Pause"
class="flex-shrink-0 flex items-center justify-center w-8 h-8 rounded-lg bg-zinc-800 hover:bg-zinc-700 text-amber-400 text-sm border-none cursor-pointer transition-colors">
<span id="player-play-icon" aria-hidden="true">&#9654;</span>
</button>
<!-- Chapter title + state badge -->
<div class="flex-1 min-w-0 flex items-center gap-2 px-1">
<span id="player-title" class="text-[0.8rem] font-medium text-zinc-300 truncate">Ch.&#x00A0;{{.ChapterN}}</span>
<span id="player-state-badge" class="queue-badge queue-badge-idle flex-shrink-0">idle</span> <span id="player-state-badge" class="queue-badge queue-badge-idle flex-shrink-0">idle</span>
</div> </div>
<!-- Next chapter prefetch info --> <!-- Next prefetch badge (shown at 80%) -->
<div id="player-next-row" hidden class="flex-shrink-0 flex items-center gap-1.5"> <div id="player-next-row" hidden class="flex-shrink-0 flex items-center gap-1">
<span class="text-[0.65rem] text-zinc-600 uppercase tracking-wide font-semibold">Next</span> <span id="player-next-badge" class="queue-badge queue-badge-idle">next</span>
<span id="player-next-badge" class="queue-badge queue-badge-idle">—</span>
</div> </div>
<!-- Settings --> <!-- Settings -->
@@ -1976,7 +1984,7 @@ const chapterTmpl = `
onclick="toggleSettings()" onclick="toggleSettings()"
aria-label="Reader settings" aria-label="Reader settings"
aria-haspopup="dialog" aria-haspopup="dialog"
class="flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md bg-transparent border-none cursor-pointer text-zinc-500 hover:text-amber-400 text-sm transition-colors"> class="flex-shrink-0 flex items-center justify-center w-8 h-8 rounded-lg bg-transparent border-none cursor-pointer text-zinc-500 hover:text-amber-400 transition-colors">
&#9881; &#9881;
</button> </button>
@@ -1989,34 +1997,22 @@ const chapterTmpl = `
hx-swap="innerHTML" hx-swap="innerHTML"
title="Next chapter" title="Next chapter"
aria-label="Next chapter" aria-label="Next chapter"
class="flex-shrink-0 px-2 py-1 rounded-md text-zinc-400 hover:text-zinc-100 text-xs transition-colors no-underline bg-zinc-800 hover:bg-zinc-700"> class="flex-shrink-0 flex items-center justify-center w-8 h-8 rounded-lg text-zinc-400 hover:text-zinc-100 hover:bg-zinc-800 text-sm transition-colors no-underline">
Next &#8594; &#8594;
</a> </a>
{{else}} {{else}}
<span class="flex-shrink-0 w-[3.5rem]"></span> <span class="flex-shrink-0 w-8"></span>
{{end}} {{end}}
</div> </div>
<!-- Row 2: play button + native audio --> <!-- Native audio seek bar (hidden until audio loads) -->
<div class="flex items-center gap-2"> <audio id="tts-audio-native"
<!-- Play/Pause button (triggers generation on first press) --> controls
<button id="player-play-btn" preload="none"
type="button" class="w-full h-8"
onclick="ttsToggle()" style="display:none; color-scheme:dark; accent-color:#f59e0b;">
aria-label="Play/Pause" </audio>
class="flex-shrink-0 flex items-center justify-center w-8 h-8 rounded-full bg-amber-500 hover:bg-amber-400 text-zinc-950 text-sm border-none cursor-pointer transition-colors">
<span id="player-play-icon" aria-hidden="true">&#9654;</span>
</button>
<!-- Native audio element (visible, controls shown after src is set) -->
<audio id="tts-audio-native"
controls
preload="none"
class="flex-1 h-8 min-w-0 rounded-lg [&::-webkit-media-controls-panel]:bg-zinc-800 [&::-webkit-media-controls-current-time-display]:text-zinc-300 [&::-webkit-media-controls-time-remaining-display]:text-zinc-500"
style="display:none; color-scheme:dark;">
</audio>
</div>
</div> </div>
</aside> </aside>
@@ -2058,11 +2054,16 @@ const chapterTmpl = `
.queue-badge-paused { background: #1c1917; color: #d6d3d1; } .queue-badge-paused { background: #1c1917; color: #d6d3d1; }
.queue-badge-error { background: #450a0a; color: #f87171; } .queue-badge-error { background: #450a0a; color: #f87171; }
/* Native audio element dark theme */ /* Native audio dark theme, hide redundant play button */
#tts-audio-native { #tts-audio-native {
color-scheme: dark; color-scheme: dark;
accent-color: #f59e0b; accent-color: #f59e0b;
} }
/* Chrome/Safari: hide the play button inside the native controls */
#tts-audio-native::-webkit-media-controls-play-button { display: none !important; }
#tts-audio-native::-webkit-media-controls-panel { background: #18181b; border-radius: 0.5rem; }
/* Tighten bottom padding now that audio bar can appear */
#mini-player { padding-bottom: env(safe-area-inset-bottom, 0); }
</style> </style>
<script> <script>