Files
bitvid/views/history.html
T
google-labs-jules[bot] c322fcee14 fix(watch-history): add manual refresh and fix dynamic pulling
This commit addresses issues with the watch history not updating dynamically and adds a manual refresh mechanism.

Changes:
- Added a "Refresh" button to the watch history view in `views/history.html` and `js/historyView.js`.
- Updated `watchHistoryService.js` to accept a `forceRefresh` option in `loadLatest`, which bypasses the cache freshness check and triggers a relay fetch.
- Updated `js/feedEngine/watchHistoryFeed.js` to propagate the `forceRefresh` flag from the runtime context to the service.
- Added user feedback (toast messages and logs) for "Clear Local History" and "Republish Now" actions.
- Updated `tests/watch-history.test.mjs` to align with the new `fetchHistory` signature.
2026-01-07 14:05:21 +00:00

114 lines
3.2 KiB
HTML

<!-- views/history.html -->
<section id="watchHistoryView" class="bv-stack" data-ds="new">
<div class="bv-stack bv-stack--tight">
<div
class="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between"
>
<div>
<h2 class="text-xl font-semibold text-text">Watch History</h2>
<p class="text-sm text-muted">
Review the videos you recently played, grouped by day.
</p>
</div>
<div class="flex flex-wrap gap-2" id="watchHistoryActions">
<button
type="button"
data-history-action="clear-cache"
class="btn-ghost"
>
Clear local history
</button>
<button
type="button"
data-history-action="republish"
class="btn"
>
Republish now
</button>
<button
type="button"
data-history-action="refresh"
class="btn-ghost"
aria-label="Refresh watch history from relays"
>
Refresh
</button>
</div>
</div>
<div
id="watchHistoryPrivacyBanner"
class="card hidden p-md"
role="status"
aria-live="polite"
>
<div
class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between"
>
<p id="watchHistoryPrivacyMessage" class="text-sm text-info">
Watch history only stores the event IDs of videos you've played.
Titles and thumbnails reload from relays when available.
</p>
<div class="flex flex-wrap gap-2">
<button id="watchHistoryPrivacyToggle" type="button" class="btn">
Got it
</button>
<button
id="watchHistoryPrivacyDismiss"
type="button"
class="btn-ghost"
>
Dismiss
</button>
</div>
</div>
</div>
<div id="watchHistoryInfo" class="card p-md text-sm">
Watch history keeps a lean list of event IDs. Details load on demand
from relays when you open this page.
</div>
<div
id="watchHistoryError"
class="card hidden p-md text-sm text-critical"
data-state="critical"
role="alert"
></div>
</div>
<div id="watchHistoryLoading">
<div id="watchHistoryStatus">
<div class="sidebar-loading-wrapper" role="status" aria-live="polite">
<div class="sidebar-loading-indicator">
<span
class="status-spinner status-spinner--inline"
aria-hidden="true"
></span>
<span class="sidebar-loading-text"
>Fetching watch history from relays…</span
>
</div>
</div>
</div>
</div>
<div
id="watchHistoryGrid"
class="grid-stack hidden"
data-variant="cards"
data-orientation="vertical"
></div>
<p id="watchHistoryEmpty" class="hidden py-12 text-center text-muted">
Your watch history is empty. Watch some videos to populate this list.
</p>
<button id="watchHistoryLoadMore" type="button" class="btn-ghost hidden w-full">
Load more
</button>
<div id="watchHistorySentinel" class="hidden h-1 w-full"></div>
<script type="module" src="js/historyView.js"></script>
</section>