refactor(tui): group tab settings
This commit is contained in:
parent
06290907a9
commit
139c9febe4
4 changed files with 12 additions and 8 deletions
|
|
@ -94,9 +94,9 @@ export const settings: Setting[] = [
|
||||||
keywords: ["transcript", "messages"],
|
keywords: ["transcript", "messages"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Tabs",
|
title: "Enabled",
|
||||||
category: "Session",
|
category: "Tabs",
|
||||||
path: ["session", "tabs"],
|
path: ["tabs", "enabled"],
|
||||||
default: false,
|
default: false,
|
||||||
values: [false, true],
|
values: [false, true],
|
||||||
labels: ["off", "on"],
|
labels: ["off", "on"],
|
||||||
|
|
|
||||||
|
|
@ -120,11 +120,15 @@ export const Info = Schema.Struct({
|
||||||
markdown: Schema.optional(Schema.Literals(["source", "rendered"])).annotate({
|
markdown: Schema.optional(Schema.Literals(["source", "rendered"])).annotate({
|
||||||
description: "Show Markdown syntax markers or conceal them in rendered transcript content",
|
description: "Show Markdown syntax markers or conceal them in rendered transcript content",
|
||||||
}),
|
}),
|
||||||
tabs: Schema.optional(Schema.Boolean).annotate({
|
}),
|
||||||
|
).annotate({ description: "Session transcript presentation settings" }),
|
||||||
|
tabs: Schema.optional(
|
||||||
|
Schema.Struct({
|
||||||
|
enabled: Schema.optional(Schema.Boolean).annotate({
|
||||||
description: "Use a persistent session tab strip instead of pinned quick-switch sessions",
|
description: "Use a persistent session tab strip instead of pinned quick-switch sessions",
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
).annotate({ description: "Session transcript presentation settings" }),
|
).annotate({ description: "Session tab settings" }),
|
||||||
mini: Schema.optional(
|
mini: Schema.optional(
|
||||||
Schema.Struct({
|
Schema.Struct({
|
||||||
thinking: Schema.optional(Schema.Literals(["show", "hide"])).annotate({
|
thinking: Schema.optional(Schema.Literals(["show", "hide"])).annotate({
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ export const { use: useSessionTabs, provider: SessionTabsProvider } = createSimp
|
||||||
const event = useEvent()
|
const event = useEvent()
|
||||||
const config = useConfig().data
|
const config = useConfig().data
|
||||||
const filePath = path.join(useTuiPaths().state, "session-tabs.json")
|
const filePath = path.join(useTuiPaths().state, "session-tabs.json")
|
||||||
const enabled = () => config.session?.tabs ?? false
|
const enabled = () => config.tabs?.enabled ?? false
|
||||||
const state: {
|
const state: {
|
||||||
pending: boolean
|
pending: boolean
|
||||||
saving: boolean
|
saving: boolean
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ test("validates mini replay settings", () => {
|
||||||
test("validates the session tabs setting", () => {
|
test("validates the session tabs setting", () => {
|
||||||
const decode = Schema.decodeUnknownSync(Info)
|
const decode = Schema.decodeUnknownSync(Info)
|
||||||
|
|
||||||
expect(decode({ session: { tabs: true } })).toEqual({ session: { tabs: true } })
|
expect(decode({ tabs: { enabled: true } })).toEqual({ tabs: { enabled: true } })
|
||||||
expect(() => decode({ session: { tabs: "on" } })).toThrow()
|
expect(() => decode({ tabs: { enabled: "on" } })).toThrow()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("resolves nested config and keybind defaults", () => {
|
test("resolves nested config and keybind defaults", () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue