Fix clicking genre cards on home page (#953)

## Description
Fixes clicking on a genre card added to the home page

### Related issues
Fixes #952

### Testing
Emulator

## Screenshots
N/A

## AI or LLM usage
None
This commit is contained in:
Ray 2026-02-22 20:18:18 -05:00 committed by GitHub
parent e8c9b4e208
commit a51d9e9c65
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 78 additions and 28 deletions

View file

@ -25,6 +25,7 @@ import org.jellyfin.sdk.model.api.BaseItemDto
import org.jellyfin.sdk.model.api.BaseItemKind
import org.jellyfin.sdk.model.extensions.ticks
import java.util.Locale
import java.util.UUID
import kotlin.time.Duration
@Serializable
@ -33,6 +34,7 @@ data class BaseItem(
val data: BaseItemDto,
val useSeriesForPrimary: Boolean,
val imageUrlOverride: String? = null,
val destinationOverride: Destination? = null,
) : CardGridItem {
val id get() = data.id
@ -166,6 +168,7 @@ data class BaseItem(
}?.toIntOrNull()
fun destination(index: Int? = null): Destination {
if (destinationOverride != null) return destinationOverride
val result =
// Redirect episodes & seasons to their series if possible
when (type) {
@ -234,3 +237,28 @@ data class BaseItemUi(
val episodeUnplayedCornerText: String?,
val quickDetails: AnnotatedString,
)
fun createGenreDestination(
genreId: UUID,
genreName: String,
parentId: UUID,
parentName: String?,
includeItemTypes: List<BaseItemKind>?,
) = Destination.FilteredCollection(
itemId = parentId,
filter =
CollectionFolderFilter(
nameOverride =
listOfNotNull(
genreName,
parentName,
).joinToString(" "),
filter =
GetItemsFilter(
genres = listOf(genreId),
includeItemTypes = includeItemTypes,
),
useSavedLibraryDisplayInfo = false,
),
recursive = true,
)