package cc.unitmesh.devins.ui.compose.agent.artifact import androidx.compose.foundation.background import androidx.compose.foundation.horizontalScroll import androidx.compose.foundation.layout.* import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.* import androidx.compose.ui.Modifier import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import cc.unitmesh.agent.ArtifactAgent /** * iOS implementation of ArtifactPreviewPanel. * Shows source code view as WebView requires additional native integration. */ @Composable actual fun ArtifactPreviewPanel( artifact: ArtifactAgent.Artifact, onConsoleLog: (String, String) -> Unit, onFixRequest: ((ArtifactAgent.Artifact, String) -> Unit)?, modifier: Modifier ) { // For iOS, show source code view // TODO: Integrate with native WKWebView for full preview support Column(modifier = modifier) { // Header Box( modifier = Modifier .fillMaxWidth() .background(MaterialTheme.colorScheme.surfaceVariant) .padding(horizontal = 12.dp, vertical = 8.dp) ) { Text( text = "${artifact.title} (Source View)", style = MaterialTheme.typography.titleSmall ) } // Source code Box( modifier = Modifier .weight(1f) .fillMaxWidth() .background(MaterialTheme.colorScheme.surface) .horizontalScroll(rememberScrollState()) .verticalScroll(rememberScrollState()) .padding(12.dp) ) { Text( text = artifact.content, style = MaterialTheme.typography.bodySmall.copy( fontFamily = FontFamily.Monospace, fontSize = 12.sp, lineHeight = 18.sp ), color = MaterialTheme.colorScheme.onSurface ) } } // Log that artifact was loaded LaunchedEffect(artifact.identifier) { onConsoleLog("info", "Artifact loaded: ${artifact.title}") } } /** * Export artifact implementation for iOS * TODO: Implement using iOS share sheet */ actual fun exportArtifact( artifact: ArtifactAgent.Artifact, onNotification: (String, String) -> Unit ) { // TODO: Implement iOS export using share sheet onNotification("info", "Export not yet implemented for iOS") } /** * Export artifact bundle implementation for iOS * TODO: Implement using iOS share sheet */ actual fun exportArtifactBundle( bundle: cc.unitmesh.agent.artifact.ArtifactBundle, onNotification: (String, String) -> Unit ) { // TODO: Implement iOS bundle export using share sheet onNotification("info", "Bundle export not yet implemented for iOS") }