diff --git a/briar-desktop/src/main/kotlin/org/briarproject/briar/desktop/forums/ThreadItemView.kt b/briar-desktop/src/main/kotlin/org/briarproject/briar/desktop/forums/ThreadItemView.kt index a6489bb60b9f9f403fe3c58f9d5b6d94170d7487..e71f8a2eb8ed7c31f44e1adb452f3a95fddc8f9d 100644 --- a/briar-desktop/src/main/kotlin/org/briarproject/briar/desktop/forums/ThreadItemView.kt +++ b/briar-desktop/src/main/kotlin/org/briarproject/briar/desktop/forums/ThreadItemView.kt @@ -34,11 +34,13 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items import androidx.compose.foundation.selection.selectable import androidx.compose.foundation.shape.CircleShape import androidx.compose.material.MaterialTheme import androidx.compose.material.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment.Companion.Center import androidx.compose.ui.Alignment.Companion.CenterVertically import androidx.compose.ui.Modifier @@ -67,19 +69,23 @@ import kotlin.random.Random @Suppress("HardCodedStringLiteral") fun main() = preview { + val list = remember { + (0..8).map { i -> + ForumPostItem( + h = getRandomForumPostHeader(), + text = getRandomString(Random.nextInt(1, 1337)), + ).apply { setLevel(i % 7) } + } + } + LazyColumn { - for (i in 1..5) { - item { - ThreadItemView( - item = ForumPostItem( - h = getRandomForumPostHeader(), - text = getRandomString(Random.nextInt(1, 1337)), - ).apply { setLevel(Random.nextInt(0, 6)) }, - maxNestingLevel = 3, - selectedPost = null, - onPostSelected = {}, - ) - } + items(list) { item -> + ThreadItemView( + item = item, + maxNestingLevel = 3, + selectedPost = null, + onPostSelected = {}, + ) } } }