@@ -26,7 +26,6 @@ import androidx.compose.foundation.layout.Row
2626import androidx.compose.foundation.layout.Spacer
2727import androidx.compose.foundation.layout.fillMaxSize
2828import androidx.compose.foundation.layout.fillMaxWidth
29−import androidx.compose.foundation.layout.heightIn
3029import androidx.compose.foundation.layout.PaddingValues
3130import androidx.compose.foundation.layout.WindowInsets
3231import androidx.compose.foundation.layout.ime
@@ -43,10 +42,8 @@ import androidx.compose.foundation.text.KeyboardOptions
4342import androidx.compose.material.icons.Icons
4443import androidx.compose.material.icons.automirrored.filled.ArrowBack
4544import androidx.compose.material.icons.automirrored.filled.Send
46−import androidx.compose.material.icons.filled.ChatBubbleOutline
4745import androidx.compose.material.icons.filled.Close
4846import androidx.compose.material.icons.filled.KeyboardArrowDown
49−import androidx.compose.material.icons.filled.KeyboardArrowUp
5047import androidx.compose.material.icons.filled.Stop
5148import androidx.compose.material3.CircularProgressIndicator
5249import androidx.compose.material3.ExperimentalMaterial3Api
@@ -61,7 +58,6 @@ import androidx.compose.material3.OutlinedTextField
6158import androidx.compose.material3.Scaffold
6259import androidx.compose.material3.Surface
6360import androidx.compose.material3.Text
64−import androidx.compose.material3.TextButton
6561import androidx.compose.material3.TopAppBar
6662import androidx.compose.runtime.Composable
6763import androidx.compose.runtime.LaunchedEffect
@@ -75,7 +71,6 @@ import androidx.compose.ui.Alignment
7571import androidx.compose.ui.Modifier
7672import androidx.compose.ui.draw.clip
7773import androidx.compose.ui.hapticfeedback.HapticFeedbackType
78−import androidx.compose.ui.platform.LocalClipboardManager
7974import androidx.compose.ui.platform.LocalContext
8075import androidx.compose.ui.platform.LocalDensity
8176import androidx.compose.ui.platform.LocalHapticFeedback
@@ -113,12 +108,6 @@ fun ChatScreen(state: UiState, dispatch: (Event) -> Unit) {
113108 }
114109 }
115110
116− // Offer a jump-to-top shortcut once the conversation is long and the user has
117− // scrolled a few messages down — saves flick-scrolling back through history.
118− val showScrollTop by remember {
119− derivedStateOf { state.messages.size > 10 && listState.firstVisibleItemIndex > 3 }
120− }
121−
122111 // Track how many messages the user has "seen" (i.e. was at the bottom for). While
123112 // they're scrolled up, any messages beyond that count are unseen — flag the FAB.
124113 var lastSeenCount by remember { mutableStateOf(0) }
@@ -205,24 +194,12 @@ fun ChatScreen(state: UiState, dispatch: (Event) -> Unit) {
205194 }
206195 Box(Modifier.fillMaxWidth().weight(1f)) {
207196 if (state.messages.isEmpty() && !state.loading) {
208− Column(
197+ Text(
198+ text = "Send a message to start the conversation.",
199+ style = MaterialTheme.typography.bodyMedium,
200+ color = MaterialTheme.colorScheme.onSurfaceVariant,
209201 modifier = Modifier.align(Alignment.Center).padding(32.dp),
210− horizontalAlignment = Alignment.CenterHorizontally,
211− ) {
212− Icon(
213− Icons.Filled.ChatBubbleOutline,
214− contentDescription = null,
215− modifier = Modifier.size(48.dp),
216− tint = MaterialTheme.colorScheme.primary.copy(alpha = 0.5f),
217− )
218− Spacer(Modifier.size(16.dp))
219− Text(
220− text = "Send a message to start the conversation.",
221− style = MaterialTheme.typography.bodyMedium,
222− color = MaterialTheme.colorScheme.onSurfaceVariant,
223− textAlign = TextAlign.Center,
224− )
225− }
202+ )
226203 }
227204 LazyColumn(
228205 state = listState,
@@ -269,14 +246,6 @@ fun ChatScreen(state: UiState, dispatch: (Event) -> Unit) {
269246 }
270247 },
271248 )
272− ScrollToTopButton(
273− visible = showScrollTop,
274− onClick = {
275− coroutineScope.launch {
276− listState.animateScrollToItem(0)
277− }
278− },
279− )
280249 }
281250 }
282251 }
@@ -316,30 +285,6 @@ private fun BoxScope.ScrollToBottomButton(visible: Boolean, showBadge: Boolean,
316285 }
317286}
318287
319−// Mirror of ScrollToBottomButton, pinned to the top-start corner. Same BoxScope
320−// extension trick so the top-level AnimatedVisibility overload resolves cleanly.
321−@Composable
322−private fun BoxScope.ScrollToTopButton(visible: Boolean, onClick: () -> Unit) {
323− AnimatedVisibility(
324− visible = visible,
325− modifier = Modifier.align(Alignment.TopStart),
326− enter = scaleIn() + fadeIn(),
327− exit = scaleOut() + fadeOut(),
328− ) {
329− Box(Modifier.padding(16.dp)) {
330− FloatingActionButton(
331− onClick = onClick,
332− modifier = Modifier.size(44.dp),
333− ) {
334− Icon(
335− Icons.Filled.KeyboardArrowUp,
336− contentDescription = "Scroll to top",
337− )
338− }
339− }
340− }
341−}
342−
343288private fun copyToClipboard(context: Context, text: String) {
344289 val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
345290 clipboard.setPrimaryClip(ClipData.newPlainText("session", text))
@@ -497,41 +442,19 @@ private fun ChatInputBar(
497442 onStop: () -> Unit,
498443) {
499444 val haptic = LocalHapticFeedback.current
500− val clipboardManager = LocalClipboardManager.current
501445 Surface(tonalElevation = 3.dp) {
502− Column(
503− modifier = Modifier.fillMaxWidth().imePadding().padding(horizontal = 12.dp, vertical = 8.dp),
504− ) {
505446 Row(
506− modifier = Modifier.fillMaxWidth(),
447+ modifier = Modifier.fillMaxWidth().imePadding().padding(horizontal = 12.dp, vertical = 8.dp),
507448 verticalAlignment = Alignment.Bottom,
508449 horizontalArrangement = Arrangement.spacedBy(8.dp),
509450 ) {
510451 OutlinedTextField(
511452 value = draft,
512453 onValueChange = onDraftChange,
513− modifier = Modifier.weight(1f).heightIn(min = 48.dp),
454+ modifier = Modifier.weight(1f),
514455 enabled = !loading,
515456 placeholder = { Text("Message opencode…") },
516457 maxLines = 5,
517− // Offer a quick way to wipe the draft once there's something to clear
518− // and we're not mid-generation (where the field is a poor place to fuss).
519− trailingIcon = if (draft.isNotEmpty() && !generating) {
520− {
521− IconButton(
522− onClick = { onDraftChange("") },
523− modifier = Modifier.size(20.dp),
524− ) {
525− Icon(
526− Icons.Filled.Close,
527− contentDescription = "Clear draft",
528− modifier = Modifier.size(16.dp),
529− )
530− }
531− }
532− } else {
533− null
534− },
535458 // Surface a running count once the draft gets long, so the user has a
536459 // sense of scale before sending a wall of text.
537460 supportingText = if (draft.length > 500) {
@@ -574,17 +497,5 @@ private fun ChatInputBar(
574497 }
575498 }
576499 }
577− // With nothing typed yet, offer a one-tap way to drop in clipboard contents.
578− if (draft.isEmpty() && !generating && !loading) {
579− TextButton(
580− onClick = {
581− clipboardManager.getText()?.text?.let { onDraftChange(it) }
582− },
583− contentPadding = PaddingValues(0.dp),
584− ) {
585− Text("Paste")
586− }
587− }
588− }
589500 }
590501}