From bbc90095bdba3ff3e7d659ee2ca3fb45d3f6b93a Mon Sep 17 00:00:00 2001 From: mkelvers Date: Wed, 8 Apr 2026 18:17:49 +0200 Subject: [PATCH] ui: final sweep extracting SortFilter and standardizing empty notifications to ui.EmptyState --- .../{templates => shared/ui}/sort_filter.templ | 2 +- internal/templates/notifications.templ | 14 ++++++-------- internal/templates/watchlist.templ | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) rename internal/{templates => shared/ui}/sort_filter.templ (98%) diff --git a/internal/templates/sort_filter.templ b/internal/shared/ui/sort_filter.templ similarity index 98% rename from internal/templates/sort_filter.templ rename to internal/shared/ui/sort_filter.templ index 13243a9..2c59d2a 100644 --- a/internal/templates/sort_filter.templ +++ b/internal/shared/ui/sort_filter.templ @@ -1,4 +1,4 @@ -package templates +package ui type SortFilterOptions struct { Sort string // "title", "date", "score" diff --git a/internal/templates/notifications.templ b/internal/templates/notifications.templ index 101c39b..0530ada 100644 --- a/internal/templates/notifications.templ +++ b/internal/templates/notifications.templ @@ -17,10 +17,9 @@ templ Notifications(watching []WatchingAnimeWithDetails) {

Shows you're currently watching or planning to watch.

if len(watching) == 0 { -
-

No airing anime in your watching list.

-

Add currently airing shows to your watching list to see upcoming episodes here.

-
+ @ui.EmptyState("No airing anime in your watching list.") { + Add currently airing shows to your watching list to see upcoming episodes here. + } } else {
for _, item := range watching { @@ -52,10 +51,9 @@ func splitUpcomingSeasons(items []database.GetUpcomingSeasonsRow) (airing []data templ UpcomingSeasonsList(upcomingSeasons []database.GetUpcomingSeasonsRow) { if len(upcomingSeasons) == 0 { -
-

No upcoming seasons for anime you've watched.

-

As you watch more shows, new seasons will appear here.

-
+ @ui.EmptyState("No upcoming seasons for anime you've watched.") { + As you watch more shows, new seasons will appear here. + } } else { @renderSplitSeasons(upcomingSeasons) } diff --git a/internal/templates/watchlist.templ b/internal/templates/watchlist.templ index 9a788aa..3d27524 100644 --- a/internal/templates/watchlist.templ +++ b/internal/templates/watchlist.templ @@ -31,7 +31,7 @@ templ Watchlist(entries []database.GetUserWatchListRow, layout string, currentSt Dropped Completed
- @SortFilter(SortFilterOptions{Sort: sortBy, Order: sortOrder, View: layout, Status: currentStatus}) + @ui.SortFilter(ui.SortFilterOptions{Sort: sortBy, Order: sortOrder, View: layout, Status: currentStatus}) if len(entries) == 0 { @ui.EmptyState("Nothing here yet") { if currentStatus == "all" {