ui: final sweep extracting SortFilter and standardizing empty notifications to ui.EmptyState

This commit is contained in:
2026-04-08 18:17:49 +02:00
parent c0516b7118
commit bbc90095bd
3 changed files with 8 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
package templates package ui
type SortFilterOptions struct { type SortFilterOptions struct {
Sort string // "title", "date", "score" Sort string // "title", "date", "score"

View File

@@ -17,10 +17,9 @@ templ Notifications(watching []WatchingAnimeWithDetails) {
<p class="notifications-subtitle">Shows you're currently watching or planning to watch.</p> <p class="notifications-subtitle">Shows you're currently watching or planning to watch.</p>
if len(watching) == 0 { if len(watching) == 0 {
<div class="no-notifications"> @ui.EmptyState("No airing anime in your watching list.") {
<p>No airing anime in your watching list.</p> <span style="font-size: var(--text-sm); margin-top: var(--space-sm); display: block;">Add currently airing shows to your watching list to see upcoming episodes here.</span>
<p class="hint">Add currently airing shows to your watching list to see upcoming episodes here.</p> }
</div>
} else { } else {
<div class="notifications-list"> <div class="notifications-list">
for _, item := range watching { for _, item := range watching {
@@ -52,10 +51,9 @@ func splitUpcomingSeasons(items []database.GetUpcomingSeasonsRow) (airing []data
templ UpcomingSeasonsList(upcomingSeasons []database.GetUpcomingSeasonsRow) { templ UpcomingSeasonsList(upcomingSeasons []database.GetUpcomingSeasonsRow) {
if len(upcomingSeasons) == 0 { if len(upcomingSeasons) == 0 {
<div class="no-notifications"> @ui.EmptyState("No upcoming seasons for anime you've watched.") {
<p>No upcoming seasons for anime you've watched.</p> <span style="font-size: var(--text-sm); margin-top: var(--space-sm); display: block;">As you watch more shows, new seasons will appear here.</span>
<p class="hint">As you watch more shows, new seasons will appear here.</p> }
</div>
} else { } else {
@renderSplitSeasons(upcomingSeasons) @renderSplitSeasons(upcomingSeasons)
} }

View File

@@ -31,7 +31,7 @@ templ Watchlist(entries []database.GetUserWatchListRow, layout string, currentSt
<a href={ templ.URL(fmt.Sprintf("/watchlist?view=%s&status=dropped&sort=%s&order=%s", layout, sortBy, sortOrder)) } class={ tabClass(currentStatus == "dropped") }>Dropped</a> <a href={ templ.URL(fmt.Sprintf("/watchlist?view=%s&status=dropped&sort=%s&order=%s", layout, sortBy, sortOrder)) } class={ tabClass(currentStatus == "dropped") }>Dropped</a>
<a href={ templ.URL(fmt.Sprintf("/watchlist?view=%s&status=completed&sort=%s&order=%s", layout, sortBy, sortOrder)) } class={ tabClass(currentStatus == "completed") }>Completed</a> <a href={ templ.URL(fmt.Sprintf("/watchlist?view=%s&status=completed&sort=%s&order=%s", layout, sortBy, sortOrder)) } class={ tabClass(currentStatus == "completed") }>Completed</a>
</div> </div>
@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 { if len(entries) == 0 {
@ui.EmptyState("Nothing here yet") { @ui.EmptyState("Nothing here yet") {
if currentStatus == "all" { if currentStatus == "all" {