diff --git a/core/appearance/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/appearance/repository/DefaultThemeRepository.kt b/core/appearance/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/appearance/repository/DefaultThemeRepository.kt index 1928d7197..e0683cb3e 100644 --- a/core/appearance/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/appearance/repository/DefaultThemeRepository.kt +++ b/core/appearance/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/appearance/repository/DefaultThemeRepository.kt @@ -24,6 +24,7 @@ internal class DefaultThemeRepository : ThemeRepository { override val saveColor = MutableStateFlow(null) override val postLayout = MutableStateFlow(PostLayout.Card) override val commentBarTheme = MutableStateFlow(CommentBarTheme.Blue) + override val commentBarThickness = MutableStateFlow(1) override fun changeUiTheme(value: UiTheme?) { uiTheme.value = value @@ -66,11 +67,11 @@ internal class DefaultThemeRepository : ThemeRepository { customSeedColor.value = color } - override fun changeUpvoteColor(color: Color?) { + override fun changeUpVoteColor(color: Color?) { upVoteColor.value = color } - override fun changeDownvoteColor(color: Color?) { + override fun changeDownVoteColor(color: Color?) { downVoteColor.value = color } @@ -128,4 +129,8 @@ internal class DefaultThemeRepository : ThemeRepository { this += Color(0xFFFF0000) } } + + override fun changeCommentBarThickness(value: Int) { + commentBarThickness.value = value + } } \ No newline at end of file diff --git a/core/appearance/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/appearance/repository/ThemeRepository.kt b/core/appearance/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/appearance/repository/ThemeRepository.kt index 87423f31d..c571d7bbc 100644 --- a/core/appearance/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/appearance/repository/ThemeRepository.kt +++ b/core/appearance/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/appearance/repository/ThemeRepository.kt @@ -25,6 +25,7 @@ interface ThemeRepository { val saveColor: StateFlow val postLayout: StateFlow val commentBarTheme: StateFlow + val commentBarThickness: StateFlow fun changeUiTheme(value: UiTheme?) @@ -44,9 +45,9 @@ interface ThemeRepository { fun changeCustomSeedColor(color: Color?) - fun changeUpvoteColor(color: Color?) + fun changeUpVoteColor(color: Color?) - fun changeDownvoteColor(color: Color?) + fun changeDownVoteColor(color: Color?) fun changeReplyColor(color: Color?) fun changeSaveColor(color: Color?) @@ -54,6 +55,7 @@ interface ThemeRepository { fun changePostLayout(value: PostLayout) fun changeCommentBarTheme(value: CommentBarTheme) + fun changeCommentBarThickness(value: Int) fun getCommentBarColors(commentBarTheme: CommentBarTheme): List } diff --git a/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CollapsedCommentCard.kt b/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CollapsedCommentCard.kt index df258f24b..d2c79ea29 100644 --- a/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CollapsedCommentCard.kt +++ b/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CollapsedCommentCard.kt @@ -34,6 +34,7 @@ fun CollapsedCommentCard( modifier: Modifier = Modifier, voteFormat: VoteFormat = VoteFormat.Aggregated, autoLoadImages: Boolean = true, + preferNicknames: Boolean = true, showScores: Boolean = true, actionButtonsActive: Boolean = true, isOp: Boolean = false, @@ -83,6 +84,7 @@ fun CollapsedCommentCard( distinguished = comment.distinguished, isOp = isOp, autoLoadImages = autoLoadImages, + preferNicknames = preferNicknames, onToggleExpanded = { onToggleExpanded?.invoke() }, diff --git a/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CommentCard.kt b/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CommentCard.kt index 57d08e0de..f84bf4922 100644 --- a/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CommentCard.kt +++ b/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CommentCard.kt @@ -50,6 +50,7 @@ fun CommentCard( hideCommunity: Boolean = true, hideIndent: Boolean = false, autoLoadImages: Boolean = true, + preferNicknames: Boolean = true, showScores: Boolean = true, actionButtonsActive: Boolean = true, isOp: Boolean = false, @@ -71,6 +72,7 @@ fun CommentCard( val themeRepository = remember { getThemeRepository() } var commentHeight by remember { mutableStateOf(0f) } val commentBarTheme by themeRepository.commentBarTheme.collectAsState() + val commentBarThickness by themeRepository.commentBarThickness.collectAsState() val barColor = themeRepository.getCommentBarColor( depth = comment.depth, commentBarTheme = commentBarTheme, @@ -103,6 +105,7 @@ fun CommentCard( modifier = Modifier.padding(top = Spacing.xxs), iconSize = IconSize.s, autoLoadImages = autoLoadImages, + preferNicknames = preferNicknames, creator = comment.creator.takeIf { !hideAuthor }, community = comment.community.takeIf { !hideCommunity }, indicatorExpanded = comment.expanded, @@ -170,7 +173,7 @@ fun CommentCard( Box( modifier = Modifier .padding(top = Spacing.xxs) - .width(barWidth) + .width(barWidth * commentBarThickness) .height(commentHeight.toLocalDp()) .background(color = barColor) ) diff --git a/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CommunityAndCreatorInfo.kt b/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CommunityAndCreatorInfo.kt index f95ebe033..548f453c6 100644 --- a/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CommunityAndCreatorInfo.kt +++ b/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CommunityAndCreatorInfo.kt @@ -51,6 +51,7 @@ fun CommunityAndCreatorInfo( iconSize: Dp = IconSize.l, indicatorExpanded: Boolean? = null, autoLoadImages: Boolean = true, + preferNicknames: Boolean = true, community: CommunityModel? = null, creator: UserModel? = null, distinguished: Boolean = false, @@ -65,9 +66,9 @@ fun CommunityAndCreatorInfo( onDoubleClick: (() -> Unit)? = null, onLongClick: (() -> Unit)? = null, ) { - val communityName = community?.readableName.orEmpty() + val communityName = community?.readableName(preferNicknames).orEmpty() val communityIcon = community?.icon.orEmpty() - val creatorName = creator?.readableName.orEmpty() + val creatorName = creator?.readableName(preferNicknames).orEmpty() val creatorAvatar = creator?.avatar.orEmpty() val fullColor = MaterialTheme.colorScheme.onBackground val ancillaryColor = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.75f) diff --git a/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CommunityHeader.kt b/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CommunityHeader.kt index c83b2be0c..a98169585 100644 --- a/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CommunityHeader.kt +++ b/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CommunityHeader.kt @@ -35,8 +35,8 @@ import com.github.diegoberaldin.raccoonforlemmy.core.utils.compose.onClick import com.github.diegoberaldin.raccoonforlemmy.core.utils.compose.rememberCallback import com.github.diegoberaldin.raccoonforlemmy.core.utils.getPrettyNumber import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.CommunityModel +import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.readableHandle import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.readableName -import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.readableSimpleName import com.github.diegoberaldin.raccoonforlemmy.resources.MR import dev.icerock.moko.resources.compose.stringResource @@ -45,6 +45,7 @@ fun CommunityHeader( community: CommunityModel, modifier: Modifier = Modifier, autoLoadImages: Boolean = true, + preferNicknames: Boolean = true, onOpenImage: ((String) -> Unit)? = null, ) { Box( @@ -104,7 +105,7 @@ fun CommunityHeader( } else { PlaceholderImage( size = IconSize.xxl, - title = community.readableName, + title = community.readableName(preferNicknames), ) } @@ -113,13 +114,13 @@ fun CommunityHeader( verticalArrangement = Arrangement.spacedBy(Spacing.s), ) { Text( - text = community.readableName, + text = community.readableName(preferNicknames), style = MaterialTheme.typography.titleLarge, color = MaterialTheme.colorScheme.onBackground, ) - if (community.readableSimpleName != community.readableName) { + if (community.readableHandle != community.readableName(preferNicknames)) { Text( - text = community.readableSimpleName, + text = community.readableHandle, maxLines = 1, overflow = TextOverflow.Ellipsis, style = MaterialTheme.typography.titleSmall, diff --git a/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CommunityItem.kt b/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CommunityItem.kt index d29d63aa1..8930073a4 100644 --- a/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CommunityItem.kt +++ b/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/CommunityItem.kt @@ -41,8 +41,8 @@ import com.github.diegoberaldin.raccoonforlemmy.core.utils.compose.rememberCallb import com.github.diegoberaldin.raccoonforlemmy.core.utils.toLocalDp import com.github.diegoberaldin.raccoonforlemmy.core.utils.toLocalPixel import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.CommunityModel +import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.readableHandle import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.readableName -import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.readableSimpleName @Composable fun CommunityItem( @@ -50,13 +50,14 @@ fun CommunityItem( modifier: Modifier = Modifier, small: Boolean = false, autoLoadImages: Boolean = true, + preferNicknames: Boolean = true, showSubscribers: Boolean = false, showFavorite: Boolean = false, options: List