fix(common-ui): no indentation for first-level comments (#17)

This commit is contained in:
Diego Beraldin 2023-09-15 08:02:04 +02:00 committed by GitHub
parent 8a6f2ac45f
commit 98da3be105
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -34,6 +34,9 @@ internal class DefaultThemeRepository : ThemeRepository {
startColor: Color,
endColor: Color,
): Color {
if (depth == 0) {
return Color.Transparent
}
val r1 = startColor.red
val g1 = startColor.green
val b1 = startColor.blue
@ -46,7 +49,7 @@ internal class DefaultThemeRepository : ThemeRepository {
val greenStep = (g2 - g1) / maxDepth
val blueStep = (b2 - b1) / maxDepth
val index = (depth % maxDepth)
val index = ((depth - 1).coerceAtLeast(0) % maxDepth)
return Color(
r1 + redStep * index,
g1 + greenStep * index,

View File

@ -14,5 +14,5 @@ data class CommentModel(
val path: String = "",
val children: List<CommentModel>? = null,
) : JavaSerializable {
val depth: Int get() = (path.split(".").size - 1).coerceAtLeast(0)
val depth: Int get() = (path.split(".").size - 2).coerceAtLeast(0)
}