Trim app chrome and simplify settings

This commit is contained in:
OpenClaw committed 2026-03-07 15:23:05 +08:00
1 parent 3b8d779138
commit 3ebcf9761b
4 files changed
+66 -41

No files matched your search

@@ -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 {
@@ -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("退出登录并重新连接")
}
}
}
@@ -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,
)
}