feat: add watchlist filtering and sorting UI

This commit is contained in:
2026-05-02 15:55:36 +02:00
committed by Mikkel Elvers
parent b03336a710
commit 4869bc055d
3 changed files with 289 additions and 65 deletions

View File

@@ -105,20 +105,23 @@ func (h *Handler) HandleGetWatchlist(w http.ResponseWriter, r *http.Request) {
watchlistByStatus := make(map[string][]database.GetUserWatchListRow)
allEntries := make([]database.GetUserWatchListRow, 0)
watchlistIDs := make([]int64, len(entries))
for _, entry := range entries {
for i, entry := range entries {
status := entry.Status
if status == "" {
status = "plan_to_watch"
}
watchlistByStatus[status] = append(watchlistByStatus[status], entry)
allEntries = append(allEntries, entry)
watchlistIDs[i] = entry.AnimeID
}
data := map[string]any{
"CurrentPath": r.URL.Path,
"WatchlistByStatus": watchlistByStatus,
"AllEntries": allEntries,
"WatchlistIDs": watchlistIDs,
"StatusOrder": []string{"watching", "plan_to_watch", "on_hold", "completed", "dropped"},
"StatusLabels": map[string]string{
"watching": "Currently Watching",