fix(#4): replace private EmptyState with shared component in ChatScreen

Remove ~30 lines of duplicated code by using the shared EmptyState
from ui/common/StateViews.kt instead of the private version.

Closes #4

Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
M57andM57 authored and GitHub committed 2026-06-18 17:51:52 +03:00
1 parent d90e36974c
commit a36be6e432
1 file changed
+5 -34
@@ -87,6 +87,7 @@ import androidx.lifecycle.viewmodel.compose.viewModel
import com.m57.hermescontrol.notification.NotificationHelper
import com.m57.hermescontrol.theme.StatusGreen
import com.m57.hermescontrol.theme.StatusRed
import com.m57.hermescontrol.ui.common.EmptyState
@OptIn(ExperimentalMaterial3Api::class)
@Composable
@@ -316,8 +317,10 @@ fun ChatScreen(
.fillMaxWidth(),
) {
if (state.messages.isEmpty() && !state.isLoading) {
// Empty state
EmptyState()
EmptyState(
title = "Ready to chat",
subtitle = "Send a message to start a conversation",
)
}
LazyColumn(
@@ -397,38 +400,6 @@ fun ChatScreen(
}
}
@Composable
private fun EmptyState() {
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center,
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
) {
Text(
text = "⚡",
fontSize = 48.sp,
)
Spacer(modifier = Modifier.height(8.dp))
Text(
text = "Ready to chat",
style =
MaterialTheme.typography.titleMedium.copy(
color = MaterialTheme.colorScheme.onSurfaceVariant,
),
)
Text(
text = "Send a message to start a conversation",
style =
MaterialTheme.typography.bodySmall.copy(
color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.7f),
),
)
}
}
}
@Composable
private fun ThinkingIndicator(thinkingText: String) {
val infiniteTransition = rememberInfiniteTransition(label = "thinking")