From 52b2d232ded46705035debae2f2778cf951c7566 Mon Sep 17 00:00:00 2001 From: Marius Butz Date: Thu, 7 May 2026 15:19:10 +0200 Subject: [PATCH] add watched badge in library screen --- .../com/nuvio/app/features/library/LibraryScreen.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/composeApp/src/commonMain/kotlin/com/nuvio/app/features/library/LibraryScreen.kt b/composeApp/src/commonMain/kotlin/com/nuvio/app/features/library/LibraryScreen.kt index efe6ded9..1d0899a0 100644 --- a/composeApp/src/commonMain/kotlin/com/nuvio/app/features/library/LibraryScreen.kt +++ b/composeApp/src/commonMain/kotlin/com/nuvio/app/features/library/LibraryScreen.kt @@ -31,6 +31,8 @@ import com.nuvio.app.features.home.components.HomeEmptyStateCard import com.nuvio.app.features.home.components.HomePosterCard import com.nuvio.app.features.home.components.HomeSkeletonRow import com.nuvio.app.features.profiles.ProfileRepository +import com.nuvio.app.features.watched.WatchedRepository +import com.nuvio.app.features.watching.application.WatchingState import kotlinx.coroutines.launch import nuvio.composeapp.generated.resources.* import org.jetbrains.compose.resources.stringResource @@ -56,6 +58,7 @@ fun LibraryScreen( LibraryRepository.pullFromServer(ProfileRepository.activeProfileId) } } + val watchedUiState by WatchedRepository.uiState.collectAsStateWithLifecycle() LaunchedEffect(networkStatusUiState.condition, isTraktSource) { when (networkStatusUiState.condition) { @@ -162,6 +165,7 @@ fun LibraryScreen( else -> { librarySections( + watchedKeys = watchedUiState.watchedKeys, sections = uiState.sections, onPosterClick = onPosterClick, onSectionViewAllClick = onSectionViewAllClick, @@ -193,6 +197,7 @@ fun LibraryScreen( private fun LazyListScope.librarySections( sections: List, + watchedKeys: Set, onPosterClick: ((LibraryItem) -> Unit)?, onSectionViewAllClick: ((LibrarySection) -> Unit)?, onPosterLongClick: (LibraryItem) -> Unit, @@ -216,6 +221,10 @@ private fun LazyListScope.librarySections( key = { item -> "${item.type}:${item.id}" }, ) { item -> HomePosterCard( + isWatched = WatchingState.isPosterWatched( + watchedKeys = watchedKeys, + item = item.toMetaPreview(), + ), item = item.toMetaPreview(), onClick = onPosterClick?.let { { it(item) } }, onLongClick = { onPosterLongClick(item) },