Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import androidx.compose.material.icons.automirrored.filled.OpenInNew
import androidx.compose.material.icons.filled.Psychology
import androidx.compose.material.icons.filled.RadioButtonUnchecked
import androidx.compose.material.icons.filled.CheckCircle
import androidx.compose.material.icons.filled.ContentCopy
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.CircularProgressIndicator
Expand Down Expand Up @@ -71,6 +72,11 @@ import com.yage.opencode_client.ui.theme.markdownTypographyCompact
import com.yage.opencode_client.ui.util.DataUriImageTransformer
import com.yage.opencode_client.ui.util.HttpImageHolder
import com.yage.opencode_client.ui.util.MarkdownImageResolver
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.widget.Toast
import androidx.compose.ui.platform.LocalContext
import kotlinx.coroutines.flow.collect

@Composable
Expand Down Expand Up @@ -194,6 +200,7 @@ private fun MessageRow(
onForkFromMessage: (String) -> Unit
) {
val isUser = message.info.isUser
val context = LocalContext.current

Column(modifier = Modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 4.dp)) {
// No "OpenCode" speaker title — the user's blue left bar vs the
Expand Down Expand Up @@ -294,6 +301,26 @@ private fun MessageRow(
expanded = showMenu,
onDismissRequest = { showMenu = false }
) {
DropdownMenuItem(
text = { Text("Copy message") },
leadingIcon = {
Icon(
imageVector = Icons.Default.ContentCopy,
contentDescription = null
)
},
onClick = {
showMenu = false
val textToCopy = message.parts
.filter { it.isText }
.mapNotNull { it.text }
.joinToString("\n")
val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val clip = ClipData.newPlainText("message", textToCopy)
clipboard.setPrimaryClip(clip)
Toast.makeText(context, "Copied", Toast.LENGTH_SHORT).show()
}
)
DropdownMenuItem(
text = { Text("Fork from here") },
leadingIcon = {
Expand Down