diff --git a/feature/sessions/src/commonMain/composeResources/values-ja/strings.xml b/feature/sessions/src/commonMain/composeResources/values-ja/strings.xml index fd6547b2f..0aa52dc9e 100644 --- a/feature/sessions/src/commonMain/composeResources/values-ja/strings.xml +++ b/feature/sessions/src/commonMain/composeResources/values-ja/strings.xml @@ -29,6 +29,7 @@ 対応言語 カテゴリ 「%1$s」と一致する検索結果がありません + 一致する検索結果がありません 開催日 カテゴリ セッション種別 diff --git a/feature/sessions/src/commonMain/composeResources/values/strings.xml b/feature/sessions/src/commonMain/composeResources/values/strings.xml index b1c0049b5..049bb9f85 100644 --- a/feature/sessions/src/commonMain/composeResources/values/strings.xml +++ b/feature/sessions/src/commonMain/composeResources/values/strings.xml @@ -29,6 +29,7 @@ Supported Languages Category Nothing matched your search criteria "%1$s" + Nothing matched your search criteria Day Category Session type diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/SearchScreenPresenter.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/SearchScreenPresenter.kt index 877b7609b..d196348c4 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/SearchScreenPresenter.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/SearchScreenPresenter.kt @@ -50,6 +50,7 @@ fun searchScreenPresenter( val sessions by rememberUpdatedState(sessionsRepository.timetable()) var searchWord by rememberRetained { mutableStateOf("") } + var hasSearched by rememberRetained { mutableStateOf(false) } val selectedDays = rememberRetained { mutableStateListOf() } val selectedSessionTypes = rememberRetained { mutableStateListOf() } val selectedCategories = rememberRetained { mutableStateListOf() } @@ -109,6 +110,7 @@ fun searchScreenPresenter( is UpdateSearchWord -> { searchWord = event.word + hasSearched = true } is ClearSearchWord -> { @@ -150,7 +152,7 @@ fun searchScreenPresenter( } when { - filters.isNotEmpty() && filteredSessions.isEmpty() -> { + (filters.isNotEmpty() || hasSearched) && filteredSessions.isEmpty() -> { SearchScreenUiState.Empty( searchWord = searchWord, searchFilterDayUiState = searchFilterDayUiState, diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/EmptySearchResultBody.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/EmptySearchResultBody.kt index a7e879bfc..fefa06ca0 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/EmptySearchResultBody.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/EmptySearchResultBody.kt @@ -14,6 +14,7 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import conference_app_2024.feature.sessions.generated.resources.Res import conference_app_2024.feature.sessions.generated.resources.empty_search_result +import conference_app_2024.feature.sessions.generated.resources.empty_search_result_no_input import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme import org.jetbrains.compose.resources.painterResource import org.jetbrains.compose.resources.stringResource @@ -24,6 +25,12 @@ fun EmptySearchResultBody( searchWord: String, modifier: Modifier = Modifier, ) { + val message = if (searchWord.isEmpty()) { + stringResource(Res.string.empty_search_result_no_input) + } else { + stringResource(Res.string.empty_search_result, searchWord) + } + Column( modifier = modifier .fillMaxSize() @@ -36,7 +43,7 @@ fun EmptySearchResultBody( contentDescription = null, ) Text( - text = stringResource(Res.string.empty_search_result, searchWord), + text = message, style = MaterialTheme.typography.titleMedium, textAlign = TextAlign.Center, )