diff --git a/internal/anime/handler/handler.go b/internal/anime/handler/handler.go index ee76649..72e4a17 100644 --- a/internal/anime/handler/handler.go +++ b/internal/anime/handler/handler.go @@ -253,10 +253,22 @@ func (h *AnimeHandler) HandleAnimeDetails(c *gin.Context) { } user, _ := c.Get("User") + ep := 1 + var cwSeconds float64 + if u, ok := user.(*domain.User); ok { + cwEntry, err := h.watchlistSvc.GetContinueWatchingEntry(c.Request.Context(), u.ID, int64(id)) + if err == nil && cwEntry.CurrentEpisode.Valid { + ep = int(cwEntry.CurrentEpisode.Int64) + cwSeconds = cwEntry.CurrentTimeSeconds + } + } + c.HTML(http.StatusOK, "anime.gohtml", gin.H{ - "Anime": anime, - "CurrentPath": fmt.Sprintf("/anime/%d", id), - "User": user, + "Anime": anime, + "CurrentPath": fmt.Sprintf("/anime/%d", id), + "User": user, + "ContinueWatchingEp": ep, + "ContinueWatchingTime": cwSeconds, }) } diff --git a/templates/anime.gohtml b/templates/anime.gohtml index 1069a8e..2c49b48 100644 --- a/templates/anime.gohtml +++ b/templates/anime.gohtml @@ -85,7 +85,7 @@ {{if $anime.ShortRating}}•{{$anime.ShortRating}}{{end}} - {{template "watchlist_actions" dict "Anime" $anime "User" .User "Status" .Status}} + {{template "watchlist_actions" dict "Anime" $anime "User" .User "Status" .Status "ContinueWatchingEp" .ContinueWatchingEp "ContinueWatchingTime" .ContinueWatchingTime}}