Show favorite status in grid view

This commit is contained in:
FooIbar committed 2025-05-14 18:49:13 +08:00
1 parent 4cdf5a8ba6
commit 85bc6fdd28
3 files changed
+15

No files matched your search

@@ -153,6 +153,8 @@ object EhUtils {
val categoryTextColor = Color(0xffe6e0e9)
val favoriteIconColor = Color(0xffff3040)
fun signOut() {
EhCookieStore.removeAllCookies()
Settings.displayName.value = null
@@ -213,6 +213,7 @@ fun GalleryInfoGridItem(
modifier: Modifier = Modifier,
showLanguage: Boolean = true,
showPages: Boolean = true,
showFavoriteStatus: Boolean = true,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
) = ElevatedCard(
modifier = modifier,
@@ -258,6 +259,17 @@ fun GalleryInfoGridItem(
Text(text = info.simpleLanguage.orEmpty())
}
}
if (showFavoriteStatus) {
val isFavorited by FavouriteStatusRouter.collectAsState(info) { it != NOT_FAVORITED }
if (isFavorited) {
Icon(
imageVector = Icons.Default.Favorite,
contentDescription = null,
modifier = Modifier.align(Alignment.BottomEnd).padding(2.dp),
tint = EhUtils.favoriteIconColor,
)
}
}
}
}
@@ -332,6 +332,7 @@ fun AnimatedVisibilityScope.FavouritesScreen(navigator: DestinationsNavigator) =
},
info = info,
showPages = showPages,
showFavoriteStatus = false,
interactionSource = interactionSource,
)
}