fix: resolve templ compile errors

This commit is contained in:
2026-04-20 17:36:52 +02:00
parent 45ce8c1aa4
commit 29c2e5fdb7
9 changed files with 41 additions and 37 deletions

View File

@@ -2,14 +2,14 @@ package anime
import (
"mal/integrations/jikan"
"mal/web/components"
ui "mal/web/components"
)
templ Recommendations(recs []jikan.Anime) {
if len(recs) > 0 {
<div class="grid grid-cols-2 gap-3 sm:grid-cols-3 md:gap-4 lg:grid-cols-4 xl:grid-cols-5">
for _, anime := range recs {
@components.AnimeCard(components.AnimeCardProps{
@ui.AnimeCard(ui.AnimeCardProps{
ID: anime.MalID,
Title: anime.DisplayTitle(),
ImageURL: anime.ImageURL(),

View File

@@ -1,16 +1,15 @@
package anime
import (
"fmt"
"mal/integrations/jikan"
"mal/web/components"
ui "mal/web/components"
)
templ RelationsList(relations []jikan.RelationEntry) {
if len(relations) > 1 {
<div class="grid grid-cols-2 gap-3 sm:grid-cols-3 md:gap-4 lg:grid-cols-4 xl:grid-cols-5" id="relations-grid">
for _, rel := range relations {
@components.AnimeCard(components.AnimeCardProps{
@ui.AnimeCard(ui.AnimeCardProps{
ID: rel.Anime.MalID,
Title: rel.Anime.DisplayTitle(),
ImageURL: rel.Anime.ImageURL(),

View File

@@ -2,7 +2,6 @@ package watch
import (
"fmt"
"mal/web/components"
"mal/web/shared"
)
@@ -35,7 +34,7 @@ templ VideoPlayer(data shared.WatchPageData) {
preload="metadata"
crossorigin="anonymous"
playsinline
src={ buildStreamURL(data.InitialMode, streamToken) }
src={ shared.BuildStreamURL(data.InitialMode, streamToken) }
></video>
<div
data-loading

View File

@@ -2,7 +2,8 @@ package watchlist
import (
"fmt"
"mal/internal/db"
db "mal/internal/db"
"mal/web/shared"
)
templ Progress(entry db.GetUserWatchListRow) {
@@ -10,7 +11,7 @@ templ Progress(entry db.GetUserWatchListRow) {
<p class="m-0 mt-1 text-xs text-(--text-faint)">
Continue ep { fmt.Sprintf("%d", entry.CurrentEpisode.Int64) }
if entry.CurrentTimeSeconds > 0 {
{ fmt.Sprintf(" · %s", formatProgressTime(entry.CurrentTimeSeconds)) }
{ fmt.Sprintf(" · %s", shared.FormatProgressTime(entry.CurrentTimeSeconds)) }
}
</p>
}

View File

@@ -2,8 +2,9 @@ package templates
import (
"fmt"
"mal/internal/db"
"mal/web/components"
db "mal/internal/db"
ui "mal/web/components"
"mal/web/shared"
"mal/web/shared/layout"
)
@@ -34,11 +35,11 @@ templ ContinueWatching(entries []db.GetContinueWatchingEntriesRow) {
if entry.CurrentEpisode.Valid && entry.CurrentEpisode.Int64 > 0 {
<span class="text-xs text-(--text-faint)">Continue ep { fmt.Sprintf("%d", entry.CurrentEpisode.Int64) }</span>
}
if entry.CurrentTimeSeconds > 0 {
<span class="text-xs text-(--text-faint)">{ formatProgressTime(entry.CurrentTimeSeconds) }</span>
}
</div>
if entry.CurrentTimeSeconds > 0 {
<span class="text-xs text-(--text-faint)">{ shared.FormatProgressTime(entry.CurrentTimeSeconds) }</span>
}
</div>
</div>
}
<button
class="absolute right-2 top-2 h-6 w-6 cursor-pointer border-0 bg-(--overlay-subtle) text-(--text-muted) opacity-0 transition-opacity duration-150 group-hover:opacity-100 hover:text-(--danger)"

View File

@@ -3,8 +3,8 @@ package templates
import (
"fmt"
"mal/internal/db"
"mal/web/components"
db "mal/internal/db"
components "mal/web/components"
"mal/web/components/watchlist"
"mal/web/shared"
"mal/web/shared/layout"
@@ -140,7 +140,7 @@ templ Watchlist(
id={ fmt.Sprintf("watchlist-entry-%d", entry.AnimeID) }
>
<a
href={ templ.URL(shared.AnimeURL(entry.AnimeID)) }
href={ templ.URL(shared.AnimeURL(int(entry.AnimeID))) }
class="flex flex-col bg-transparent text-inherit no-underline"
>
<div class="flex w-full aspect-2/3 justify-center overflow-hidden">
@@ -185,7 +185,7 @@ templ Watchlist(
id={ fmt.Sprintf("watchlist-entry-%d", entry.AnimeID) }
>
<td class="p-2.5">
<a href={ templ.URL(shared.AnimeURL(entry.AnimeID)) }>
<a href={ templ.URL(shared.AnimeURL(int(entry.AnimeID))) }>
<img
src={ entry.ImageUrl }
alt={ entry.DisplayTitle() }
@@ -195,7 +195,7 @@ templ Watchlist(
</a>
</td>
<td class="p-2.5 font-medium">
<a href={ templ.URL(shared.AnimeURL(entry.AnimeID)) }>
<a href={ templ.URL(shared.AnimeURL(int(entry.AnimeID))) }>
{ entry.DisplayTitle() }
</a>
@watchlist.Progress(entry)