feat: replace notifications with continue watching

This commit is contained in:
2026-04-18 23:42:22 +02:00
parent dea66f2f6a
commit ed73400b83
9 changed files with 137 additions and 292 deletions

View File

@@ -314,51 +314,6 @@ func (h *Handler) HandleAPIDiscoverUpcoming(w http.ResponseWriter, r *http.Reque
templates.DiscoverItems(res.Animes, "upcoming", page+1, res.HasNextPage).Render(r.Context(), w)
}
func (h *Handler) HandleNotifications(w http.ResponseWriter, r *http.Request) {
userID := userIDFromRequest(r)
if userID == "" {
http.Redirect(w, r, "/login", http.StatusSeeOther)
return
}
tab := r.URL.Query().Get("tab")
if tab != "sequels" {
tab = "tracking"
}
var watching []templates.WatchingAnimeWithDetails
if tab == "tracking" {
var err error
watching, err = h.svc.GetWatchingAnime(r.Context(), userID)
if err != nil {
log.Printf("watching anime error: %v", err)
http.Error(w, "Failed to fetch watching anime", http.StatusInternalServerError)
return
}
}
templates.Notifications(watching, tab).Render(r.Context(), w)
}
func (h *Handler) HandleNotificationsUpcoming(w http.ResponseWriter, r *http.Request) {
userID := userIDFromRequest(r)
if userID == "" {
http.Error(w, "Unauthorized", http.StatusUnauthorized)
return
}
upcomingSeasons, err := h.svc.GetUpcomingSeasons(r.Context(), userID)
if err != nil {
log.Printf("upcoming seasons error: %v", err)
http.Error(w, "Failed to fetch upcoming seasons", http.StatusInternalServerError)
return
}
templates.UpcomingSeasonsList(upcomingSeasons).Render(r.Context(), w)
}
func (h *Handler) HandleStudioDetails(w http.ResponseWriter, r *http.Request) {
idStr := r.URL.Path[len("/studios/"):]
id, err := strconv.Atoi(idStr)