From 328b726fbb73150f3380146efae6e6c28189c2b4 Mon Sep 17 00:00:00 2001 From: Sebastian Neubauer <33195281+snappdevelopment@users.noreply.github.com> Date: Mon, 16 Feb 2026 20:36:23 +0100 Subject: [PATCH 1/3] Add auto-scroll for search results on the Json Screen (#494) Co-authored-by: Sebastian Neubauer --- .../features/network/body/NetworkJsonScreen.kt | 14 ++++++++++++-- FloconDesktop/gradle/libs.versions.toml | 2 +- .../designsystem/components/FloconJsonTree.kt | 6 +++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/features/network/body/NetworkJsonScreen.kt b/FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/features/network/body/NetworkJsonScreen.kt index 0110ca73..cab24494 100644 --- a/FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/features/network/body/NetworkJsonScreen.kt +++ b/FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/features/network/body/NetworkJsonScreen.kt @@ -14,6 +14,7 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.widthIn +import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.ArrowDownward @@ -68,11 +69,19 @@ private fun NetworkBodyContent( val scope = rememberCoroutineScope() val searchState = rememberSearchState() + val listState = rememberLazyListState() LaunchedEffect(query) { searchState.query = query } + val resultIndex = searchState.selectedResultListIndex + LaunchedEffect(resultIndex) { + if(resultIndex != null && !listState.isScrollInProgress) { + listState.animateScrollToItem(resultIndex) + } + } + FloconSurface( modifier = modifier, ) { @@ -101,6 +110,7 @@ private fun NetworkBodyContent( FloconJsonTree( json = body.text, searchState = searchState, + lazyListState = listState, onError = { jsonError = true }, modifier = Modifier .fillMaxWidth() @@ -160,7 +170,7 @@ private fun SearchBar( imageVector = Icons.Outlined.ArrowUpward, onClick = previousClicked, contentPadding = PaddingValues(all = 4.dp), - enabled = selectedResultIndex != null && selectedResultIndex > 0, + enabled = selectedResultIndex != null, modifier = Modifier.fillMaxHeight().aspectRatio(1f), ) VerticalDivider(modifier = Modifier.fillMaxHeight()) @@ -168,7 +178,7 @@ private fun SearchBar( imageVector = Icons.Outlined.ArrowDownward, onClick = nextClicked, contentPadding = PaddingValues(all = 4.dp), - enabled = selectedResultIndex != null && selectedResultIndex < totalResults - 1, + enabled = selectedResultIndex != null, modifier = Modifier.fillMaxHeight().aspectRatio(1f), ) } diff --git a/FloconDesktop/gradle/libs.versions.toml b/FloconDesktop/gradle/libs.versions.toml index abf3af0d..bbf033a5 100644 --- a/FloconDesktop/gradle/libs.versions.toml +++ b/FloconDesktop/gradle/libs.versions.toml @@ -31,7 +31,7 @@ aboutLibraries = "12.2.4" kotlinStdlib = "2.2.0" runner = "1.7.0" core = "1.7.0" -other-jsontree = "2.5.0" +other-jsontree = "2.6.0" uiToolingPreviewDesktop = "1.8.2" buildconfig = "5.6.8" paging = "3.3.2" diff --git a/FloconDesktop/library/designsystem/src/commonMain/kotlin/io/github/openflocon/library/designsystem/components/FloconJsonTree.kt b/FloconDesktop/library/designsystem/src/commonMain/kotlin/io/github/openflocon/library/designsystem/components/FloconJsonTree.kt index 4d92b5c6..d0c2618c 100644 --- a/FloconDesktop/library/designsystem/src/commonMain/kotlin/io/github/openflocon/library/designsystem/components/FloconJsonTree.kt +++ b/FloconDesktop/library/designsystem/src/commonMain/kotlin/io/github/openflocon/library/designsystem/components/FloconJsonTree.kt @@ -1,6 +1,8 @@ package io.github.openflocon.library.designsystem.components import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.lazy.LazyListState +import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.text.selection.SelectionContainer import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.ChevronLeft @@ -18,7 +20,8 @@ fun FloconJsonTree( modifier: Modifier = Modifier, initialState: TreeState = TreeState.FIRST_ITEM_EXPANDED, onError: (Throwable) -> Unit = {}, - searchState: SearchState = rememberSearchState() + searchState: SearchState = rememberSearchState(), + lazyListState: LazyListState = rememberLazyListState() ) { SelectionContainer(modifier = modifier) { JsonTree( @@ -29,6 +32,7 @@ fun FloconJsonTree( initialState = initialState, icon = Icons.Outlined.ChevronLeft, searchState = searchState, + lazyListState = lazyListState, colors = defaultDarkColors, onError = onError, modifier = Modifier.fillMaxSize() From 018f18e0b5642c403512634b8c2d3709f2a397b3 Mon Sep 17 00:00:00 2001 From: Sebastian Neubauer <33195281+snappdevelopment@users.noreply.github.com> Date: Mon, 16 Feb 2026 20:36:54 +0100 Subject: [PATCH 2/3] Improve network detail json text size and expand icon (#498) Co-authored-by: Sebastian Neubauer --- .../library/designsystem/components/FloconJsonTree.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/FloconDesktop/library/designsystem/src/commonMain/kotlin/io/github/openflocon/library/designsystem/components/FloconJsonTree.kt b/FloconDesktop/library/designsystem/src/commonMain/kotlin/io/github/openflocon/library/designsystem/components/FloconJsonTree.kt index d0c2618c..2731f5c3 100644 --- a/FloconDesktop/library/designsystem/src/commonMain/kotlin/io/github/openflocon/library/designsystem/components/FloconJsonTree.kt +++ b/FloconDesktop/library/designsystem/src/commonMain/kotlin/io/github/openflocon/library/designsystem/components/FloconJsonTree.kt @@ -5,20 +5,23 @@ import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.text.selection.SelectionContainer import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.outlined.ChevronLeft +import androidx.compose.material.icons.outlined.ChevronRight import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.text.TextStyle import com.sebastianneubauer.jsontree.JsonTree import com.sebastianneubauer.jsontree.TreeState import com.sebastianneubauer.jsontree.defaultDarkColors import com.sebastianneubauer.jsontree.search.SearchState import com.sebastianneubauer.jsontree.search.rememberSearchState +import io.github.openflocon.library.designsystem.FloconTheme @Composable fun FloconJsonTree( json: String, modifier: Modifier = Modifier, initialState: TreeState = TreeState.FIRST_ITEM_EXPANDED, + textStyle: TextStyle = FloconTheme.typography.bodyMedium, onError: (Throwable) -> Unit = {}, searchState: SearchState = rememberSearchState(), lazyListState: LazyListState = rememberLazyListState() @@ -30,10 +33,11 @@ fun FloconJsonTree( FloconCircularProgressIndicator() // TODO Better? }, initialState = initialState, - icon = Icons.Outlined.ChevronLeft, + icon = Icons.Outlined.ChevronRight, searchState = searchState, lazyListState = lazyListState, colors = defaultDarkColors, + textStyle = textStyle, onError = onError, modifier = Modifier.fillMaxSize() ) From b28e0dc3fb848996e20a45c89dd949c4b700700b Mon Sep 17 00:00:00 2001 From: Raphael TEYSSANDIER Date: Wed, 25 Feb 2026 10:25:33 +0100 Subject: [PATCH 3/3] fix: Datastore doc --- docs/sharedpref.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/sharedpref.md b/docs/sharedpref.md index 1b31879d..03c4bae7 100644 --- a/docs/sharedpref.md +++ b/docs/sharedpref.md @@ -25,7 +25,8 @@ To support Jetpack DataStore, ensure you have the `flocon-datastore` dependency: ```kotlin // build.gradle.kts -implementation("io.github.openflocon:flocon-datastore:version") +debugImplementation("io.github.openflocon:flocon-datastores:version") +releaseImplementation("io.github.openflocon:flocon-datastores-no-op:version") ``` Then register your DataStore: