package templates import "bookhoard/internal/handlers" templ Devices(user User, devices []handlers.DeviceInfo, errorMessage string, baseURL string) { Device Management - Bookhoard @Header(user, "/devices")
@Icon("device", "h-5 w-5")

Device Management

Manage your reading devices and sync settings

if len(devices) == 0 {
@Icon("device", "h-7 w-7")

No Devices Yet

Add your reading devices to enable cross-device sync

} if len(devices) > 0 {
for _, device := range devices {
if device.DeviceType == "koreader" { @Icon("book-open", "h-5 w-5") } else if device.DeviceType == "kobo" { @Icon("library", "h-5 w-5") } else if device.DeviceType == "web" { @Icon("globe", "h-5 w-5") } else { @Icon("device", "h-5 w-5") }

{ device.DeviceName }

{ device.DeviceType }

Sync Status if device.SyncEnabled { Enabled } else { Disabled }
Last Sync if device.LastSync != nil { { FormatInTimezone(*device.LastSync, user.Timezone) } } else { Never }
Last Seen if device.LastSeen != nil { { FormatInTimezone(*device.LastSeen, user.Timezone) } } else { Never }

Device Sync Configuration

if device.DeviceType == "kobo" {

Paste this URL into Kobo's api_endpoint setting

} if device.DeviceType == "koreader" {

Enter this token in the KOReader plugin settings

}

Old token will immediately stop working

}
}
@ErrorToast(errorMessage) } // PairingLookupResult renders inside #pairing-lookup-result after a // pairing-code lookup — the confirm card on a hit, otherwise why not. // Swapped by htmx from POST /devices/pairing/lookup. templ PairingLookupResult(deviceName string, deviceType string, pairingCode string, status string) { if status == "found" {

Found: { deviceName }

{ deviceType } device · Pair it with your account? Its reading progress will sync here.

} else if status == "invalid" {

No waiting device matches that code — check the digits on your e-reader's screen.

} else if status == "expired" {

That code expired. Tap Register device on the device again for a fresh one.

} else if status == "claimed" {

That code was already used. If the device isn't listed above, register it again from the device.

} else if status == "rate_limited" {

Too many pairing attempts — wait a minute and try again.

} }