From 3ebcf9761b1e4dd0bb5465a8349132912cba8ab4 Mon Sep 17 00:00:00 2001 From: OpenClaw Date: Sat, 7 Mar 2026 15:23:05 +0800 Subject: [PATCH] Trim app chrome and simplify settings --- .../kotlin/cn/xiaobai/openclawapp/App.kt | 18 ----- .../feature/settings/SettingsScreen.kt | 78 ++++++++++++++----- .../feature/status/StatusScreen.kt | 8 +- docs/MVP_PROGRESS.md | 3 + 4 files changed, 66 insertions(+), 41 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/App.kt b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/App.kt index 5763414..fec9e9d 100644 --- a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/App.kt +++ b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/App.kt @@ -3,8 +3,6 @@ package cn.xiaobai.openclawapp import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding -import androidx.compose.material3.CenterAlignedTopAppBar -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.NavigationBar import androidx.compose.material3.NavigationBarItem import androidx.compose.material3.Scaffold @@ -79,7 +77,6 @@ fun App() { } } -@OptIn(ExperimentalMaterial3Api::class) @Composable private fun OpenClawRoot(appState: OpenClawAppState) { val activeSession = appState.activeSessionId?.let(appState.repository::findSession) @@ -132,21 +129,6 @@ private fun OpenClawRoot(appState: OpenClawAppState) { } Scaffold( - topBar = { - CenterAlignedTopAppBar( - title = { - Text( - text = when { - activeSession != null -> activeSession.title - appState.selectedTab == MainTab.Sessions -> "OpenClaw" - appState.selectedTab == MainTab.Status -> "运行状态" - appState.selectedTab == MainTab.Settings -> "设置" - else -> "" - } - ) - }, - ) - }, bottomBar = { if (activeSession == null) { NavigationBar { diff --git a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/settings/SettingsScreen.kt b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/settings/SettingsScreen.kt index 96341b2..681605b 100644 --- a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/settings/SettingsScreen.kt +++ b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/settings/SettingsScreen.kt @@ -14,9 +14,11 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import cn.xiaobai.openclawapp.app.AppThemeMode import cn.xiaobai.openclawapp.data.ServerConfig -import cn.xiaobai.openclawapp.ui.HeroCard import cn.xiaobai.openclawapp.ui.LabelValueCard +import cn.xiaobai.openclawapp.ui.SectionHeader import cn.xiaobai.openclawapp.ui.SelectableRowCard +import cn.xiaobai.openclawapp.ui.StatusPill +import cn.xiaobai.openclawapp.ui.StatusPillTone @Composable fun SettingsScreen( @@ -34,25 +36,55 @@ fun SettingsScreen( verticalArrangement = Arrangement.spacedBy(14.dp), ) { item { - HeroCard( - title = "连接配置", - subtitle = "现在 app 默认只走真实 BFF。这里主要管理地址、token 状态、默认 Agent 和主题。", - badge = "Settings", + SectionHeader( + title = "设置", + subtitle = "这里管理连接、默认 Agent、外观和基础诊断信息。", ) } item { - LabelValueCard(label = "服务器地址", value = serverConfig.baseUrl) + Text("连接与账号", style = MaterialTheme.typography.titleMedium) } item { - LabelValueCard(label = "当前模型", value = currentModel) + LabelValueCard( + label = "服务器地址", + value = serverConfig.baseUrl, + supporting = "当前 app 通过 BFF 连接 OpenClaw。", + ) } item { - LabelValueCard(label = "访问令牌", value = if (serverConfig.token.isBlank()) "未设置" else "已持久化") + LabelValueCard( + label = "访问令牌", + value = if (serverConfig.token.isBlank()) "未设置" else "已登录", + supporting = if (serverConfig.token.isBlank()) "可返回登录页重新配置。" else "如需切换账号或服务器,可退出登录后重新连接。", + ) } item { - Text("主题", style = MaterialTheme.typography.titleMedium) + Text("默认 Agent", style = MaterialTheme.typography.titleMedium) + } + + if (availableAgents.isEmpty()) { + item { + LabelValueCard( + label = "当前状态", + value = "暂未拉到可用 Agent", + supporting = "稍后刷新状态页,或检查当前连接是否正常。", + ) + } + } else { + items(availableAgents) { agent -> + SelectableRowCard( + title = agent, + trailing = if (serverConfig.defaultAgent == agent) "当前" else null, + selected = serverConfig.defaultAgent == agent, + modifier = Modifier.clickable { onSelectAgent(agent) }, + ) + } + } + + item { + Text("外观", style = MaterialTheme.typography.titleMedium) } items(AppThemeMode.entries) { theme -> @@ -65,21 +97,31 @@ fun SettingsScreen( } item { - Text("切换默认 Agent", style = MaterialTheme.typography.titleMedium) + Text("诊断信息", style = MaterialTheme.typography.titleMedium) } - - items(availableAgents) { agent -> - SelectableRowCard( - title = agent, - trailing = if (serverConfig.defaultAgent == agent) "当前" else null, - selected = serverConfig.defaultAgent == agent, - modifier = Modifier.clickable { onSelectAgent(agent) }, + item { + LabelValueCard( + label = "当前模型", + value = currentModel, + supporting = "这里先展示当前连接返回的模型信息。更细的状态查看可去状态页。", + ) + } + item { + LabelValueCard( + label = "当前默认 Agent", + value = serverConfig.defaultAgent, + ) + } + item { + StatusPill( + text = if (serverConfig.token.isBlank()) "未连接" else "已连接", + tone = if (serverConfig.token.isBlank()) StatusPillTone.Warning else StatusPillTone.Success, ) } item { Button(onClick = onDisconnect, modifier = Modifier.fillMaxWidth()) { - Text("退出登录") + Text("退出登录并重新连接") } } } diff --git a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/status/StatusScreen.kt b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/status/StatusScreen.kt index c2fee5f..cf9e2c1 100644 --- a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/status/StatusScreen.kt +++ b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/status/StatusScreen.kt @@ -10,7 +10,6 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import cn.xiaobai.openclawapp.data.ServerStatus -import cn.xiaobai.openclawapp.ui.HeroCard import cn.xiaobai.openclawapp.ui.LabelValueCard import cn.xiaobai.openclawapp.ui.MetricCard @@ -24,10 +23,9 @@ fun StatusScreen( verticalArrangement = Arrangement.spacedBy(14.dp), ) { item { - HeroCard( - title = if (status.online) "链路正常" else "连接异常", - subtitle = "状态页后面会扩展成 OpenClaw、BFF、消息流和推送链路的统一面板。现在先把最关键的几个信号放清楚。", - badge = if (status.online) "Online" else "Offline", + Text( + text = if (status.online) "链路正常" else "连接异常", + style = MaterialTheme.typography.headlineMedium, ) } diff --git a/docs/MVP_PROGRESS.md b/docs/MVP_PROGRESS.md index aee3c36..51608a7 100644 --- a/docs/MVP_PROGRESS.md +++ b/docs/MVP_PROGRESS.md @@ -435,3 +435,6 @@ Android/iOS App - 2026-03-07:聊天页消息前台状态文案先收敛到用户视角:把 queue-draining / retrying-auto / uploading / send-failed 等内部细状态,前台统一归并到“处理中 / 需重试 / 已完成”这一层,细分恢复机制不再在时间线里处处抢注意力。 - 2026-03-07:继续收聊天时间线的“聊天产品感”:聊天页内部去掉重复会话标题,顶部动作区进一步压轻;消息气泡开始按“用户主色 / 助手中性 / 工具与附件中性容器 + 标签”分层,减少此前不同类型整块上色过多导致的彩虹感。 - 2026-03-07:继续统一消息卡片层级:用户消息不再重复显示角色标签,普通已发用户消息会补轻量“已发送”提示;thinking / tool / tool result / attachment 开始统一走标签 + 内容区的结构,而不是每种类型都靠大面积底色来强调。 +- 2026-03-07:应用壳层继续减法:去掉全局顶部标题栏,避免在会话/状态/设置页上方长期占一条大高度却只重复页面标题;当前页面改为直接从内容区进入,聊天页只保留内部轻量返回/动作条。 +- 2026-03-07:设置页重做为分组式连接中心:移除 HeroCard 式说明块,改成“连接与账号 / 默认 Agent / 外观 / 诊断信息”四组,减少说明书感,重点回到用户真正能查看和切换的配置项。 +- 2026-03-07:顺手把状态页头部也收轻:去掉大 HeroCard,改为直接标题 + 指标卡 + 详情卡,避免多个页面同时维持两套厚重的页头语言。