Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(settings): add section shell, searchable row, and field row

enes96dd8d1f45b3
diff --git a/src/renderer/components/settings/FieldRow.tsx b/src/renderer/components/settings/FieldRow.tsx
new file mode 100644
index 000000000..e0599be20
--- /dev/null
+++ b/src/renderer/components/settings/FieldRow.tsx
@@ -0,0 +1,26 @@
+import type React from 'react'
+
+/** label (+ optional description) on the left, a control on the right. */
+export function FieldRow({
+ label,
+ description,
+ control,
+ htmlFor
+}: {
+ label: string
+ description?: string
+ control: React.ReactNode
+ htmlFor?: string
+}): React.JSX.Element {
+ return (
+ <div className="flex items-center justify-between gap-4 py-2.5">
+ <div className="min-w-0">
+ <label htmlFor={htmlFor} className="block text-[13px] text-text">
+ {label}
+ </label>
+ {description ? <p className="mt-0.5 text-xs text-muted">{description}</p> : null}
+ </div>
+ <div className="shrink-0">{control}</div>
+ </div>
+ )
+}
diff --git a/src/renderer/components/settings/SearchableRow.tsx b/src/renderer/components/settings/SearchableRow.tsx
new file mode 100644
index 000000000..f626933d0
--- /dev/null
+++ b/src/renderer/components/settings/SearchableRow.tsx
@@ -0,0 +1,17 @@
+import type React from 'react'
+import { useSettingsSearch } from './context'
+import { matchesQuery, type SettingsSearchEntry } from './search'
+
+/** Renders its children only when the current query matches this row's metadata. */
+export function SearchableRow({
+ title,
+ description,
+ keywords,
+ children
+}: SettingsSearchEntry & { children: React.ReactNode }): React.JSX.Element | null {
+ const query = useSettingsSearch()
+ if (!matchesQuery(query, { title, description, keywords })) {
+ return null
+ }
+ return <>{children}</>
+}
diff --git a/src/renderer/components/settings/SettingsSection.tsx b/src/renderer/components/settings/SettingsSection.tsx
new file mode 100644
index 000000000..d70f22fab
--- /dev/null
+++ b/src/renderer/components/settings/SettingsSection.tsx
@@ -0,0 +1,41 @@
+import type React from 'react'
+import { useSettingsSearch } from './context'
+import { matchesQuery, type SettingsSearchEntry } from './search'
+
+/** Section shell: header + card body. Renders only when it is the active section
+ * (no query) or when at least one of its searchEntries matches (query present). */
+export function SettingsSection({
+ id,
+ title,
+ description,
+ isActive,
+ searchEntries,
+ children
+}: {
+ id: string
+ title: string
+ description?: string
+ isActive: boolean
+ searchEntries?: SettingsSearchEntry[]
+ children: React.ReactNode
+}): React.JSX.Element | null {
+ const query = useSettingsSearch()
+ const hasQuery = query.trim() !== ''
+ if (hasQuery) {
+ const anyMatch = !searchEntries || searchEntries.some((e) => matchesQuery(query, e))
+ if (!anyMatch) {
+ return null
+ }
+ } else if (!isActive) {
+ return null
+ }
+ return (
+ <section id={id} data-settings-section={id} className="space-y-4">
+ <div className="border-b border-border pb-4">
+ <h2 className="text-lg font-semibold text-text">{title}</h2>
+ {description ? <p className="mt-1 text-sm text-muted">{description}</p> : null}
+ </div>
+ <div className="rounded-lg border border-border bg-panel px-5 py-3">{children}</div>
+ </section>
+ )
+}
diff --git a/src/renderer/components/settings/context.ts b/src/renderer/components/settings/context.ts
new file mode 100644
index 000000000..7fcd0172a
--- /dev/null
+++ b/src/renderer/components/settings/context.ts
@@ -0,0 +1,8 @@
+import { createContext, useContext } from 'react'
+
+/** Current settings search query, provided by SettingsPage to all descendant rows. */
+export const SettingsSearchContext = createContext('')
+
+export function useSettingsSearch(): string {
+ return useContext(SettingsSearchContext)
+}