fix: no dead title bar on the server list

While disconnected the screen is the bare list with its own heading;
the navigation stack (and its new-session and refresh actions) exists
only once connected. That removes the duplicate title and the buttons
that could do nothing without a session.

Bump version to 0.1.6 (build 7).
This commit is contained in:
blumia committed 2026-11-16 13:58:01 +08:00
1 parent e240a33e31
commit 56cf889ee9
4 files changed
+36 -24

No files matched your search

+1
View File
@@ -42,6 +42,7 @@ M0 完成,并继续做到了 M3。所有验证都连的是本机正在运行
| 多实例 | 保存多个服务器,按最近使用排序;首屏选择连接,连接后可切换;添加/编辑/删除;从旧的单连接记录自动迁移 | | 多实例 | 保存多个服务器,按最近使用排序;首屏选择连接,连接后可切换;添加/编辑/删除;从旧的单连接记录自动迁移 |
| 连接界面(对齐官方) | 首连引导 →「手动输入地址」;有保存时列表:最近使用的置顶卡片(连接/已连接)、其他服务器、添加按钮;每行「…」菜单(连接/编辑/删除,删除二次确认);密码按需弹层、失败保留并可从表单重试;连接失败时回到表单并保留输入 | | 连接界面(对齐官方) | 首连引导 →「手动输入地址」;有保存时列表:最近使用的置顶卡片(连接/已连接)、其他服务器、添加按钮;每行「…」菜单(连接/编辑/删除,删除二次确认);密码按需弹层、失败保留并可从表单重试;连接失败时回到表单并保留输入 |
| 顶栏服务器入口 | 会话页只保留一个「服务器」图标按钮,打开实例列表;点选实例即断开当前连接并连到所选实例;「断开当前连接」移入实例列表 | | 顶栏服务器入口 | 会话页只保留一个「服务器」图标按钮,打开实例列表;点选实例即断开当前连接并连到所选实例;「断开当前连接」移入实例列表 |
| 首屏无导航栏 | 未连接时直接显示服务器列表(自带标题),不再套用带「新建/刷新」的应用栏;连接后才建立导航栈与动作栏 |
| Agent 选择 | 只列 `mode=primary` 的 Agent,子智能体(General/Explore)不再出现 | | Agent 选择 | 只列 `mode=primary` 的 Agent,子智能体(General/Explore)不再出现 |
| 模型/Agent | 聊天页顶栏打开选择 Sheet(可搜索),切换后同步会话列表 | | 模型/Agent | 聊天页顶栏打开选择 Sheet(可搜索),切换后同步会话列表 |
| 新建会话 | 会话页「新建」:标题 + 工作目录(服务端默认目录与已加载会话的目录),创建后直接进入聊天 | | 新建会话 | 会话页「新建」:标题 + 工作目录(服务端默认目录与已加载会话的目录),创建后直接进入聊天 |
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"name": "OpenChamber", "name": "OpenChamber",
"id": "com.openchamber.native", "id": "com.openchamber.native",
"version": "0.1.5", "version": "0.1.6",
"build": 6, "build": 7,
"orientations": ["portrait", "landscape"] "orientations": ["portrait", "landscape"]
} }
+31 -20
View File
@@ -28,24 +28,7 @@ func rootWithStore(st storage.Store) ui.Node {
func newApp(st storage.Store) (*controller, ui.Node) { func newApp(st storage.Store) (*controller, ui.Node) {
c := newController(st) c := newController(st)
signal.OnCleanup(c.shutdown) signal.OnCleanup(c.shutdown)
node := ui.Stack(c.screen, ui.ScreenOptions{ return c, c.screen()
Title: ui.Val("OpenChamber"),
Actions: []ui.Action{
{
Title: ui.Val("新建"),
Icon: ui.IconPlus,
Disabled: signal.Func(func() bool { return !c.connected.Get() }),
OnPress: c.openNewSession,
},
{
Title: ui.Val("刷新"),
Icon: ui.IconRefresh,
Disabled: signal.Func(func() bool { return !c.connected.Get() || c.busy.Get() }),
OnPress: c.refresh,
},
},
})
return c, node
} }
type controller struct { type controller struct {
@@ -132,9 +115,21 @@ func newController(st storage.Store) *controller {
return c return c
} }
// screen is the app's tree: a navigation stack while connected (its bar
// holds the session actions), and the bare server list while not, so the
// list is not framed by a bar whose buttons would do nothing.
func (c *controller) screen() ui.Node { func (c *controller) screen() ui.Node {
return ui.SafeArea(ui.Style{Grow: 1}, return ui.Column(ui.Style{Grow: 1},
ui.Show(c.connected, c.sessionsScreen, c.connectionsScreen), ui.Show(c.connected,
func() ui.Node {
return ui.Stack(c.sessionsScreen, ui.ScreenOptions{
Title: ui.Val("OpenChamber"),
Actions: c.barActions(),
}, ui.Style{Grow: 1})
},
func() ui.Node {
return ui.SafeArea(ui.Style{Grow: 1}, c.connectionsScreen())
}),
c.formSheet(), c.formSheet(),
c.passwordSheet(), c.passwordSheet(),
c.instancesSheet(), c.instancesSheet(),
@@ -142,6 +137,22 @@ func (c *controller) screen() ui.Node {
) )
} }
func (c *controller) barActions() []ui.Action {
return []ui.Action{
{
Title: ui.Val("新建"),
Icon: ui.IconPlus,
OnPress: c.openNewSession,
},
{
Title: ui.Val("刷新"),
Icon: ui.IconRefresh,
Disabled: signal.Func(func() bool { return c.busy.Get() }),
OnPress: c.refresh,
},
}
}
func (c *controller) shutdown() { func (c *controller) shutdown() {
if c.cancelSSE != nil { if c.cancelSSE != nil {
c.cancelSSE() c.cancelSSE()
+2 -2
View File
@@ -13,7 +13,7 @@ import (
func (c *controller) sessionsScreen() ui.Node { func (c *controller) sessionsScreen() ui.Node {
nav := ui.UseNavigator() nav := ui.UseNavigator()
c.nav = nav c.nav = nav
return ui.Column(ui.Style{Grow: 1}, return ui.SafeArea(ui.Style{Grow: 1}, ui.Column(ui.Style{Grow: 1},
ui.Row(ui.Style{Padding: ui.Symmetric(8, 16), Gap: 4, Align: ui.AlignCenter}, ui.Row(ui.Style{Padding: ui.Symmetric(8, 16), Gap: 4, Align: ui.AlignCenter},
ui.Column(ui.Style{Grow: 1, Gap: 2}, ui.Column(ui.Style{Grow: 1, Gap: 2},
ui.Text(c.server, ui.Style{Font: fonts.Footnote, Color: colors.SecondaryLabel, Lines: 1}), ui.Text(c.server, ui.Style{Font: fonts.Footnote, Color: colors.SecondaryLabel, Lines: 1}),
@@ -56,7 +56,7 @@ func (c *controller) sessionsScreen() ui.Node {
OnLongPress: func() { c.sessionMenu(s.Get()) }, OnLongPress: func() { c.sessionMenu(s.Get()) },
}, c.sessionRow(s, idx)) }, c.sessionRow(s, idx))
}), }),
) ))
} }
func (c *controller) sessionRow(s signal.Accessor[ocapi.Session], _ signal.Accessor[int]) ui.Node { func (c *controller) sessionRow(s signal.Accessor[ocapi.Session], _ signal.Accessor[int]) ui.Node {