feat: add prev/next buttons and watchlist dropdown below video player

This commit is contained in:
2026-05-03 15:24:04 +02:00
committed by Mikkel Elvers
parent 126fc3b9e3
commit 80e6894b96
3 changed files with 152 additions and 15 deletions

View File

@@ -74,6 +74,19 @@ func (h *Handler) HandleWatchPage(w http.ResponseWriter, r *http.Request) {
user := middleware.GetUser(r.Context())
var watchlistIDs []int64
var watchlistStatus string
if user != nil {
watchlist, _ := h.svc.db.GetUserWatchList(r.Context(), user.ID)
watchlistIDs = make([]int64, len(watchlist))
for i, entry := range watchlist {
watchlistIDs[i] = entry.AnimeID
if entry.AnimeID == int64(id) {
watchlistStatus = entry.Status
}
}
}
currentEpID := r.URL.Query().Get("ep")
if currentEpID == "" {
if user != nil {
@@ -146,12 +159,14 @@ func (h *Handler) HandleWatchPage(w http.ResponseWriter, r *http.Request) {
})
if err := templates.GetRenderer().ExecuteTemplate(r.Context(), w, "watch.gohtml", map[string]any{
"Anime": anime,
"Episodes": allEpisodes,
"WatchData": watchData,
"User": user,
"CurrentPath": r.URL.Path,
"CurrentEpID": currentEpID,
"Anime": anime,
"Episodes": allEpisodes,
"WatchData": watchData,
"User": user,
"CurrentPath": r.URL.Path,
"CurrentEpID": currentEpID,
"WatchlistIDs": watchlistIDs,
"WatchlistStatus": watchlistStatus,
}); err != nil {
log.Printf("render error: %v", err)
}