Refactor SearchBarResultState.Initial and NoResultsFound to data objects

This commit is contained in:
ganfra
2026-07-23 16:15:02 +02:00
parent 075cca2d21
commit 9d427077f0
15 changed files with 38 additions and 54 deletions
@@ -66,8 +66,8 @@ class AddRoomToSpacePresenter(
derivedStateOf {
when {
filteredRooms.isNotEmpty() -> SearchBarResultState.Results(filteredRooms)
isSearchActive && searchQuery.text.isNotEmpty() -> SearchBarResultState.NoResultsFound<ImmutableList<SelectRoomInfo>>()
else -> SearchBarResultState.Initial<ImmutableList<SelectRoomInfo>>()
isSearchActive && searchQuery.text.isNotEmpty() -> SearchBarResultState.NoResultsFound
else -> SearchBarResultState.Initial
}
}
}
@@ -40,7 +40,7 @@ internal class AddRoomToSpaceStateProvider : PreviewParameterProvider<AddRoomToS
anAddRoomToSpaceState(
isSearchActive = true,
searchQuery = "unknown",
searchResults = SearchBarResultState.NoResultsFound(),
searchResults = SearchBarResultState.NoResultsFound,
),
// With selected rooms
anAddRoomToSpaceState(
@@ -62,7 +62,7 @@ internal class AddRoomToSpaceStateProvider : PreviewParameterProvider<AddRoomToS
internal fun anAddRoomToSpaceState(
searchQuery: String = "",
searchResults: SearchBarResultState<ImmutableList<SelectRoomInfo>> = SearchBarResultState.Initial(),
searchResults: SearchBarResultState<ImmutableList<SelectRoomInfo>> = SearchBarResultState.Initial,
selectedRooms: ImmutableList<SelectRoomInfo> = persistentListOf(),
isSearchActive: Boolean = false,
saveAction: AsyncAction<Unit> = AsyncAction.Uninitialized,