Restore detail navigation behavior

This commit is contained in:
OpenClaw committed 2026-03-07 15:30:49 +08:00
1 parent 3ebcf9761b
commit 6543f83b3a
8 files changed
+62 -8

No files matched your search

@@ -0,0 +1,9 @@
package cn.xiaobai.openclawapp.platform
import androidx.activity.compose.BackHandler
import androidx.compose.runtime.Composable
@Composable
actual fun PlatformBackHandler(enabled: Boolean, onBack: () -> Unit) {
BackHandler(enabled = enabled, onBack = onBack)
}
@@ -170,6 +170,7 @@ private fun OpenClawRoot(appState: OpenClawAppState) {
when {
activeSession != null -> ChatScreen(
modifier = Modifier.fillMaxSize(),
sessionTitle = activeSession.title,
messages = appState.repository.messagesFor(activeSession.id),
isSending = appState.sendingSessionId == activeSession.id,
isLoading = appState.isSyncing,
@@ -38,6 +38,7 @@ import cn.xiaobai.openclawapp.data.LocalMessagePhase
import cn.xiaobai.openclawapp.data.MessageKind
import cn.xiaobai.openclawapp.data.MessageRole
import cn.xiaobai.openclawapp.data.localMessagePhase
import cn.xiaobai.openclawapp.platform.PlatformBackHandler
import cn.xiaobai.openclawapp.ui.EmptyStateCard
import cn.xiaobai.openclawapp.ui.StatusPill
import cn.xiaobai.openclawapp.ui.StatusPillTone
@@ -46,6 +47,7 @@ import kotlinx.coroutines.delay
@Composable
fun ChatScreen(
modifier: Modifier = Modifier,
sessionTitle: String,
messages: List<ChatMessage>,
isSending: Boolean,
isLoading: Boolean,
@@ -63,6 +65,8 @@ fun ChatScreen(
onOpenAttachment: (String) -> Unit,
onDownloadAttachment: (String) -> Unit,
) {
PlatformBackHandler(onBack = onBack)
var input by remember { mutableStateOf("") }
val listState = rememberLazyListState()
@@ -88,6 +92,7 @@ fun ChatScreen(
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
ChatHeader(
sessionTitle = sessionTitle,
topStatus = topStatus,
onBack = onBack,
onRetry = onRetry,
@@ -265,27 +270,43 @@ private fun buildChatTopStatus(
@Composable
private fun ChatHeader(
sessionTitle: String,
topStatus: ChatTopStatus,
onBack: () -> Unit,
onRetry: () -> Unit,
onSendAttachmentStub: () -> Unit,
) {
Column(
Card(
modifier = Modifier.fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(8.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceContainerLow,
),
) {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(12.dp),
verticalArrangement = Arrangement.spacedBy(10.dp),
) {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(8.dp),
horizontalArrangement = Arrangement.spacedBy(12.dp),
verticalAlignment = Alignment.CenterVertically,
) {
TextButton(onClick = onBack) { Text("返回") }
TextButton(onClick = onRetry) {
Text(topStatus.actionLabel)
}
Text(
text = sessionTitle,
modifier = Modifier.weight(1f),
style = MaterialTheme.typography.titleMedium,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
TextButton(onClick = onSendAttachmentStub) {
Text("附件")
}
TextButton(onClick = onRetry) {
Text(topStatus.actionLabel)
}
}
Card(
@@ -329,8 +350,6 @@ private fun ChatHeader(
},
modifier = Modifier.weight(1f),
)
TextButton(onClick = onRetry) {
Text(topStatus.actionLabel)
}
}
}
@@ -0,0 +1,6 @@
package cn.xiaobai.openclawapp.platform
import androidx.compose.runtime.Composable
@Composable
expect fun PlatformBackHandler(enabled: Boolean = true, onBack: () -> Unit)
@@ -0,0 +1,6 @@
package cn.xiaobai.openclawapp.platform
import androidx.compose.runtime.Composable
@Composable
actual fun PlatformBackHandler(enabled: Boolean, onBack: () -> Unit) = Unit
@@ -0,0 +1,6 @@
package cn.xiaobai.openclawapp.platform
import androidx.compose.runtime.Composable
@Composable
actual fun PlatformBackHandler(enabled: Boolean, onBack: () -> Unit) = Unit
@@ -0,0 +1,6 @@
package cn.xiaobai.openclawapp.platform
import androidx.compose.runtime.Composable
@Composable
actual fun PlatformBackHandler(enabled: Boolean, onBack: () -> Unit) = Unit
+1
View File
@@ -438,3 +438,4 @@ Android/iOS App
- 2026-03-07:应用壳层继续减法:去掉全局顶部标题栏,避免在会话/状态/设置页上方长期占一条大高度却只重复页面标题;当前页面改为直接从内容区进入,聊天页只保留内部轻量返回/动作条。
- 2026-03-07:设置页重做为分组式连接中心:移除 HeroCard 式说明块,改成“连接与账号 / 默认 Agent / 外观 / 诊断信息”四组,减少说明书感,重点回到用户真正能查看和切换的配置项。
- 2026-03-07:顺手把状态页头部也收轻:去掉大 HeroCard,改为直接标题 + 指标卡 + 详情卡,避免多个页面同时维持两套厚重的页头语言。
- 2026-03-07:补了一轮真正的详情页导航语义:聊天详情页重新加回明确的顶部导航头(返回 / 标题 / 附件 / 刷新),不再只是内容区里塞一个“返回”按钮;同时抽了一个轻量 `PlatformBackHandler`,先在 Android 接上系统返回,让详情页能正常退回首页/列表。