package templates import "bookhoard/internal/handlers" // ConflictsListContent renders the inner content of #conflicts-list: // bulk-select controls, the empty state, or the conflict cards. Shared by // the conflicts page and the /conflicts/list partial route. templ ConflictsListContent(user User, conflicts []handlers.ConflictDetailResponse) { if len(conflicts) == 0 {
@Icon("check-circle", "h-7 w-7")

No Conflicts

Your devices are in sync! No conflicts to resolve.

} for _, conflict := range conflicts {
@Icon("alert", "h-5 w-5")

{ conflict.MediaItemTitle }

Type: { conflict.ConflictType }

Created: { FormatInTimezone(conflict.CreatedAt, user.Timezone) } if conflict.ResolvedBy != "" { | Resolved by: { conflict.ResolvedBy } }
} } // ConflictStatsBar renders the total/unresolved/resolved stat cards. templ ConflictStatsBar(total int, unresolved int) {
{ total }
Total
{ unresolved }
Unresolved
{ total - unresolved }
Resolved
} // ConflictsRefreshFragment is the /conflicts/list partial response: a // fresh list plus the stats bar as an out-of-band swap. The client swaps // this instead of re-rendering conflict cards from JSON (rendering // ownership: templ renders, JS only swaps). templ ConflictsRefreshFragment(user User, conflicts []handlers.ConflictDetailResponse, total int, unresolved int) {
@ConflictsListContent(user, conflicts)
@ConflictStatsBar(total, unresolved)
} templ Conflicts(user User, conflicts []handlers.ConflictDetailResponse, total int, unresolved int, errorMessage string) { Sync Conflicts - Bookhoard @Header(user, "/conflicts")
@Icon("alert", "h-5 w-5")

Sync Conflicts

Resolve conflicts when reading progress differs across devices

@ConflictStatsBar(total, unresolved)
@ConflictsListContent(user, conflicts)
@ErrorToast(errorMessage) }