fix: break import cycle by moving Layout to shared package and fix import paths
This commit is contained in:
@@ -7,16 +7,17 @@ import (
|
||||
"mal/web/components"
|
||||
"mal/web/components/watchlist"
|
||||
"mal/web/shared"
|
||||
"mal/web/shared/layout"
|
||||
)
|
||||
|
||||
templ Watchlist(
|
||||
entries []db.GetUserWatchListRow,
|
||||
layout string,
|
||||
viewLayout string,
|
||||
currentStatus string,
|
||||
sortBy string,
|
||||
sortOrder string,
|
||||
) {
|
||||
@Layout("mal - watchlist", true) {
|
||||
@layout.Layout("mal - watchlist", true) {
|
||||
<div
|
||||
class="mb-4 flex items-end justify-between gap-4 max-lg:flex-col max-lg:items-start"
|
||||
>
|
||||
@@ -60,14 +61,14 @@ templ Watchlist(
|
||||
class="flex flex-wrap gap-2 max-md:flex-nowrap max-md:overflow-x-auto max-md:pb-1"
|
||||
>
|
||||
<a
|
||||
href={ templ.URL(shared.WatchlistURL("grid", currentStatus, sortBy, sortOrder)) }
|
||||
class={ shared.TabClass(layout == "grid") }
|
||||
>
|
||||
Grid
|
||||
</a>
|
||||
<a
|
||||
href={ templ.URL(shared.WatchlistURL("table", currentStatus, sortBy, sortOrder)) }
|
||||
class={ shared.TabClass(layout == "table") }
|
||||
href={ templ.URL(shared.WatchlistURL(viewLayout, "all", sortBy, sortOrder)) }
|
||||
class={ shared.TabClass(viewLayout == "grid") }
|
||||
>
|
||||
Grid
|
||||
</a>
|
||||
<a
|
||||
href={ templ.URL(shared.WatchlistURL(viewLayout, "table", sortBy, sortOrder)) }
|
||||
class={ shared.TabClass(viewLayout == "table") }
|
||||
>
|
||||
Table
|
||||
</a>
|
||||
@@ -78,48 +79,48 @@ templ Watchlist(
|
||||
class="mb-3 flex flex-wrap gap-2 max-md:flex-nowrap max-md:overflow-x-auto max-md:pb-1"
|
||||
>
|
||||
<a
|
||||
href={ templ.URL(shared.WatchlistURL(layout, "all", sortBy, sortOrder)) }
|
||||
href={ templ.URL(shared.WatchlistURL(viewLayout, "all", sortBy, sortOrder)) }
|
||||
class={ shared.TabClass(currentStatus == "all") }
|
||||
>
|
||||
All
|
||||
</a>
|
||||
<a
|
||||
href={ templ.URL(shared.WatchlistURL(layout, "watching", sortBy, sortOrder)) }
|
||||
href={ templ.URL(shared.WatchlistURL(viewLayout, "watching", sortBy, sortOrder)) }
|
||||
class={ shared.TabClass(currentStatus == "watching") }
|
||||
>
|
||||
Watching
|
||||
</a>
|
||||
<a
|
||||
href={ templ.URL(shared.WatchlistURL(layout, "on_hold", sortBy, sortOrder)) }
|
||||
href={ templ.URL(shared.WatchlistURL(viewLayout, "on_hold", sortBy, sortOrder)) }
|
||||
class={ shared.TabClass(currentStatus == "on_hold") }
|
||||
>
|
||||
On hold
|
||||
</a>
|
||||
<a
|
||||
href={ templ.URL(shared.WatchlistURL(layout, "plan_to_watch", sortBy, sortOrder)) }
|
||||
href={ templ.URL(shared.WatchlistURL(viewLayout, "plan_to_watch", sortBy, sortOrder)) }
|
||||
class={ shared.TabClass(currentStatus == "plan_to_watch") }
|
||||
>
|
||||
Plan to watch
|
||||
</a>
|
||||
<a
|
||||
href={ templ.URL(shared.WatchlistURL(layout, "dropped", sortBy, sortOrder)) }
|
||||
href={ templ.URL(shared.WatchlistURL(viewLayout, "dropped", sortBy, sortOrder)) }
|
||||
class={ shared.TabClass(currentStatus == "dropped") }
|
||||
>
|
||||
Dropped
|
||||
</a>
|
||||
<a
|
||||
href={ templ.URL(shared.WatchlistURL(layout, "completed", sortBy, sortOrder)) }
|
||||
href={ templ.URL(shared.WatchlistURL(viewLayout, "completed", sortBy, sortOrder)) }
|
||||
class={ shared.TabClass(currentStatus == "completed") }
|
||||
>
|
||||
Completed
|
||||
</a>
|
||||
</div>
|
||||
@components.SortFilter(components.SortFilterOptions{
|
||||
Sort: sortBy,
|
||||
Order: sortOrder,
|
||||
View: layout,
|
||||
Status: currentStatus,
|
||||
})
|
||||
@components.SortFilter(components.SortFilterOptions{
|
||||
Sort: sortBy,
|
||||
Order: sortOrder,
|
||||
View: viewLayout,
|
||||
Status: currentStatus,
|
||||
})
|
||||
if len(entries) == 0 {
|
||||
@components.EmptyState("Nothing here yet") {
|
||||
if currentStatus == "all" {
|
||||
@@ -129,7 +130,7 @@ templ Watchlist(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if layout == "grid" {
|
||||
if viewLayout == "grid" {
|
||||
<div
|
||||
class="grid grid-cols-2 gap-3 sm:grid-cols-3 md:gap-4 lg:grid-cols-4 xl:grid-cols-5"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user