From d78b4e7848f06bfbeeba98a59e292891a49e6944 Mon Sep 17 00:00:00 2001 From: mkelvers Date: Tue, 14 Apr 2026 22:22:52 +0200 Subject: [PATCH] refactor: clean template helpers --- internal/templates/anime.templ | 12 ------------ internal/templates/notifications.templ | 11 ++--------- internal/templates/watchlist.templ | 27 ++++++++++---------------- 3 files changed, 12 insertions(+), 38 deletions(-) diff --git a/internal/templates/anime.templ b/internal/templates/anime.templ index cd1462c..08948a2 100644 --- a/internal/templates/anime.templ +++ b/internal/templates/anime.templ @@ -241,18 +241,6 @@ templ dropdownStatusOption(animeID int, animeTitle string, animeTitleEnglish str } -templ statusOption(anime jikan.Anime, status string, currentStatus string) { - -} - func formatStatus(status string) string { switch status { case "watching": diff --git a/internal/templates/notifications.templ b/internal/templates/notifications.templ index dcd430a..c4f9837 100644 --- a/internal/templates/notifications.templ +++ b/internal/templates/notifications.templ @@ -15,8 +15,8 @@ templ Notifications(watching []WatchingAnimeWithDetails, activeTab string) {

Notifications

if activeTab == "sequels" { @@ -147,10 +147,3 @@ templ NotificationCard(item WatchingAnimeWithDetails) { func displayTitle(entry database.GetWatchingAnimeRow) string { return database.DisplayTitle(entry.TitleEnglish, entry.TitleJapanese, entry.TitleOriginal) } - -func truncate(s string, max int) string { - if len(s) <= max { - return s - } - return s[:max-3] + "..." -} diff --git a/internal/templates/watchlist.templ b/internal/templates/watchlist.templ index 152320b..fa30217 100644 --- a/internal/templates/watchlist.templ +++ b/internal/templates/watchlist.templ @@ -20,19 +20,19 @@ templ Watchlist(entries []database.GetUserWatchListRow, layout string, currentSt
- Grid - Table + Grid + Table
- All - Watching - Continuing - On hold - Plan to watch - Dropped - Completed + All + Watching + Continuing + On hold + Plan to watch + Dropped + Completed
@ui.SortFilter(ui.SortFilterOptions{Sort: sortBy, Order: sortOrder, View: layout, Status: currentStatus}) if len(entries) == 0 { @@ -103,14 +103,7 @@ templ Watchlist(entries []database.GetUserWatchListRow, layout string, currentSt } } -func viewClass(active bool) string { - if active { - return "active" - } - return "" -} - -func tabClass(active bool) string { +func activeClass(active bool) string { if active { return "active" }