Repository navigation
feat(detail): show the collections a movie or series is in on its page #1007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Quick104
merged 11 commits into
Silo-Server:main
from
Rhainland:feat/item-also-in-collections
Nov 22, 2026
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d057919
feat(detail): show the collections a movie or series is in on its page
Rhainland 7e88c59
fix(detail): keep book titles off the TV collections row and return f…
Rhainland ebd36d7
refactor(tv-detail): name the rail a focus return belongs to
Rhainland ce2ca3e
refactor(detail): simplify the collections row wiring
Rhainland dc11ace
refactor(tv-detail): place the collections row from smart-cast values
Rhainland a3b6176
fix(detail): open collection preview titles without a library
Rhainland 4846f22
fix(tv-detail): keep hidden libraries' collections off the collection…
Quick104 ee3458c
fix(detail): give a collection preview's cards one shape
Quick104 b69e858
Merge main into feat/item-also-in-collections
Quick104 cda9bd3
test(api): re-sync the API v2 fixtures from server main
Quick104 bcf0cdb
perf(tv-detail): read the known library list for the collections row
Quick104 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
...c/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/ItemCollectionsRail.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| package org.siloserver.silo.android.ui.screens.detail | ||
|
|
||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.PaddingValues | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.foundation.lazy.LazyRow | ||
| import androidx.compose.foundation.lazy.items | ||
| import androidx.compose.foundation.lazy.rememberLazyListState | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.remember | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.res.stringResource | ||
| import androidx.compose.ui.unit.dp | ||
| import org.siloserver.silo.android.ui.components.CardStyle | ||
| import org.siloserver.silo.android.ui.components.CollectionPosterRow | ||
| import org.siloserver.silo.android.ui.components.ExploreAllCard | ||
| import org.siloserver.silo.android.ui.components.MediaCard | ||
| import org.siloserver.silo.android.ui.components.rememberCollectionOwnerName | ||
| import org.siloserver.silo.android.ui.components.sharedArtworkAspectRatio | ||
| import org.siloserver.silo.common.R as CommonR | ||
| import org.siloserver.silo.common.cards.LocalCardPresentation | ||
| import org.siloserver.silo.common.i18n.stringResourceWithNames | ||
| import org.siloserver.silo.common.ui.components.DeferImagePresentationWhileScrolling | ||
| import org.siloserver.silo.model.catalog.BrowseItem | ||
| import org.siloserver.silo.model.section.SectionCollectionCard | ||
| import org.siloserver.silo.overlays.OverlayDataExtractor | ||
| import org.siloserver.silo.viewmodel.DetailSeeds | ||
| import org.siloserver.silo.viewmodel.ItemCollectionsRow | ||
|
|
||
| /** | ||
| * The collections row on a movie or series page (web `ItemCollectionsRow`). | ||
| * When one collection holds the title, its other titles show under the | ||
| * collection's name, ended by an Explore all card that opens the collection. | ||
| * Otherwise an "Also in" row shows a poster card for every collection. | ||
| */ | ||
| @Composable | ||
| internal fun ItemCollectionsRail( | ||
| row: ItemCollectionsRow, | ||
| onCollectionClick: (SectionCollectionCard) -> Unit, | ||
| onItemClick: (BrowseItem) -> Unit, | ||
| modifier: Modifier = Modifier, | ||
| ) { | ||
| val cardWidth = 120.dp * LocalCardPresentation.current.posterSize.posterScale | ||
| Column( | ||
| verticalArrangement = Arrangement.spacedBy(14.dp), | ||
| modifier = modifier, | ||
| ) { | ||
| when (row) { | ||
| is ItemCollectionsRow.Preview -> { | ||
| SectionHeader(title = row.collection.title) | ||
| // Square covers when every title is an audiobook; one card height otherwise. | ||
| val posterAspectRatio = remember(row.items) { sharedArtworkAspectRatio(row.items.map { it.type }) } | ||
| ItemCollectionsLazyRow { | ||
| items(row.items, key = { it.contentId }, contentType = { "collection-title" }) { item -> | ||
| MediaCard( | ||
| width = cardWidth, | ||
| title = item.title, | ||
| posterUrl = item.posterUrl, | ||
| posterThumbhash = item.posterThumbhash, | ||
| detailBackdropUrl = item.backdropUrl, | ||
| detailBackdropThumbhash = item.backdropThumbhash, | ||
| year = item.year?.takeIf { it > 0 }, | ||
| type = item.type, | ||
| userState = item.userState, | ||
| progress = null, | ||
| onClick = { | ||
| DetailSeeds.offer(item) | ||
| onItemClick(item) | ||
| }, | ||
| artworkAspectRatio = posterAspectRatio, | ||
| overlay = OverlayDataExtractor.fromBrowseItem(item), | ||
| sharedContentId = item.contentId, | ||
| widthIsExact = true, | ||
| ) | ||
| } | ||
| item(key = "explore-all", contentType = "explore-all") { | ||
| ExploreAllCard( | ||
| cardStyle = CardStyle.Poster, | ||
| onClick = { onCollectionClick(row.collection) }, | ||
| width = cardWidth, | ||
| posterAspectRatio = posterAspectRatio, | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| is ItemCollectionsRow.AlsoIn -> { | ||
| val title = stringResource(CommonR.string.detail_alsoIn) | ||
| SectionHeader(title = title) | ||
| val ownerName = rememberCollectionOwnerName() | ||
| CollectionPosterRow( | ||
| title = title, | ||
| cards = row.cards, | ||
| onCardClick = onCollectionClick, | ||
| byline = { card -> | ||
| ownerName(card)?.let { stringResourceWithNames(CommonR.string.collections_posterCard_byOwner, it) } | ||
| }, | ||
| showHeader = false, | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Composable | ||
| private fun ItemCollectionsLazyRow(content: androidx.compose.foundation.lazy.LazyListScope.() -> Unit) { | ||
| val rowState = rememberLazyListState() | ||
| DeferImagePresentationWhileScrolling(rowState) { | ||
| LazyRow( | ||
| state = rowState, | ||
| contentPadding = PaddingValues(horizontal = SafePadding), | ||
| horizontalArrangement = Arrangement.spacedBy(12.dp), | ||
| modifier = Modifier.fillMaxWidth(), | ||
| content = content, | ||
| ) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.