@sixb/app 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/agent/components/sandbox-recovery.d.ts +8 -2
  2. package/dist/agent/components/sandbox-recovery.d.ts.map +1 -1
  3. package/dist/agent/delegation/use-children.d.ts +5 -5
  4. package/dist/agent/delegation/use-children.d.ts.map +1 -1
  5. package/dist/agent/hooks/thread-queries.d.ts +8 -8
  6. package/dist/agent/hooks/thread-queries.d.ts.map +1 -1
  7. package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
  8. package/dist/agent/hooks/use-thread-lists.d.ts.map +1 -1
  9. package/dist/agent/i18n/en.d.ts +5 -0
  10. package/dist/agent/i18n/en.d.ts.map +1 -1
  11. package/dist/agent/i18n/fr.d.ts.map +1 -1
  12. package/dist/agent/i18n/index.d.ts +10 -0
  13. package/dist/agent/i18n/index.d.ts.map +1 -1
  14. package/dist/artifacts/queries.d.ts.map +1 -1
  15. package/dist/artifacts/renderers/live-frame.d.ts.map +1 -1
  16. package/dist/{chunk-ezntd3yy.js → chunk-1f4h75n3.js} +1 -1
  17. package/dist/{chunk-qjw5r2vk.js → chunk-7v9622qb.js} +25 -11
  18. package/dist/{chunk-qjw5r2vk.js.map → chunk-7v9622qb.js.map} +6 -6
  19. package/dist/{chunk-096d52h2.js → chunk-dntecmwb.js} +1 -1
  20. package/dist/{chunk-94d7enwc.js → chunk-qmka6aea.js} +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/pages/console/data/accounts.d.ts.map +1 -1
  23. package/dist/pages/console/data/connectors.d.ts.map +1 -1
  24. package/dist/pages/console/data/datasets.d.ts.map +1 -1
  25. package/dist/pages/console/data/pipelines.d.ts.map +1 -1
  26. package/dist/pages/console/data/projections.d.ts.map +1 -1
  27. package/dist/pages/console/data/syncs.d.ts.map +1 -1
  28. package/dist/pages/console/ontology/actions.d.ts.map +1 -1
  29. package/dist/pages/console/ontology/object-type.d.ts.map +1 -1
  30. package/dist/pages/console/ontology/object-types.d.ts.map +1 -1
  31. package/dist/pages/console/ontology/rules.d.ts.map +1 -1
  32. package/dist/pages/console/ontology/workflow.d.ts.map +1 -1
  33. package/dist/pages/console/ontology/workflows.d.ts.map +1 -1
  34. package/dist/pages/folders.d.ts +106 -0
  35. package/dist/pages/folders.d.ts.map +1 -0
  36. package/dist/pages.js +5234 -4904
  37. package/dist/pages.js.map +15 -14
  38. package/package.json +3 -3
  39. package/src/agent/components/sandbox-recovery.tsx +24 -6
  40. package/src/agent/hooks/use-agent-conversation.ts +7 -0
  41. package/src/agent/i18n/en.ts +6 -0
  42. package/src/agent/i18n/fr.ts +6 -0
  43. package/src/pages/console/data/connectors.tsx +60 -49
  44. package/src/pages/console/data/datasets.tsx +79 -68
  45. package/src/pages/console/data/pipelines.tsx +80 -69
  46. package/src/pages/console/data/projections.tsx +111 -82
  47. package/src/pages/console/data/syncs.tsx +62 -52
  48. package/src/pages/console/ontology/actions.tsx +51 -24
  49. package/src/pages/console/ontology/object-type.tsx +5 -1
  50. package/src/pages/console/ontology/object-types.tsx +41 -32
  51. package/src/pages/console/ontology/rules.tsx +48 -38
  52. package/src/pages/console/ontology/workflow.tsx +9 -3
  53. package/src/pages/console/ontology/workflows.tsx +55 -67
  54. package/src/pages/folders.tsx +335 -0
  55. /package/dist/{chunk-ezntd3yy.js.map → chunk-1f4h75n3.js.map} +0 -0
  56. /package/dist/{chunk-096d52h2.js.map → chunk-dntecmwb.js.map} +0 -0
  57. /package/dist/{chunk-94d7enwc.js.map → chunk-qmka6aea.js.map} +0 -0
@@ -8,8 +8,9 @@ import {
8
8
  } from "@sixb/client/hooks"
9
9
  import { useQuery } from "@tanstack/react-query"
10
10
  import { Activity, ArrowRight, Box, ChevronRight, Layers, Link2 } from "lucide-react"
11
- import { type ComponentType, type ReactNode, useState } from "react"
11
+ import { type ComponentType, type ReactNode, useMemo, useState } from "react"
12
12
  import { Link, useParams } from "react-router-dom"
13
+ import { FolderContents, folderBack, noItems, useFolderBrowser } from "../../folders"
13
14
  import { DetailFallback, SectionPage } from "../../section-page"
14
15
  import {
15
16
  apiErrorMessage,
@@ -82,102 +83,127 @@ export function projectionRunsPollInterval(
82
83
  /** Console › Projections: how datasets become objects, links and telemetry. */
83
84
  export function ConsoleProjectionsPage() {
84
85
  const messages = useDataMessages()
85
- const format = useFormat()
86
86
  const [tab, setTab] = useState<Tab>("all")
87
87
  const projectionsQuery = useQuery({ ...listProjectionsOptions(), retry: false })
88
88
  const data = projectionsQuery.data
89
- const all: readonly Projection[] = data
90
- ? [...data.objectProjections, ...data.linkProjections, ...data.telemetryProjections]
91
- : []
92
- const shown = tab === "all" ? all : all.filter((projection) => kindOf(projection) === tab)
93
- const count = (kind: ProjectionKind) => all.filter((p) => kindOf(p) === kind).length
94
- // A kind the project has none of gets no tab, so no tab is ever empty.
89
+ const all = useMemo<readonly Projection[]>(
90
+ () =>
91
+ data
92
+ ? [...data.objectProjections, ...data.linkProjections, ...data.telemetryProjections]
93
+ : noItems,
94
+ [data]
95
+ )
96
+ const browser = useFolderBrowser({
97
+ items: all,
98
+ title: messages.projections.title,
99
+ description: messages.projections.description,
100
+ })
101
+
102
+ return (
103
+ <SectionPage section="console" page="projections" {...browser.frame}>
104
+ {all.length > 0 ? (
105
+ <FolderContents browser={browser} rootLabel={messages.projections.title}>
106
+ {(projections) => (
107
+ <ProjectionsPanel projections={projections} tab={tab} onTabChange={setTab} />
108
+ )}
109
+ </FolderContents>
110
+ ) : (
111
+ <Panel
112
+ toolbar={projectionsQuery.isPending ? <SkeletonBlock className="h-7 w-56" /> : undefined}
113
+ >
114
+ {projectionsQuery.isPending ? (
115
+ <PanelSkeleton rows={3} interactive trailing={<TrailingSkeleton chevron />} />
116
+ ) : projectionsQuery.isError ? (
117
+ <PanelEmpty
118
+ tone="error"
119
+ icon={Layers}
120
+ title={messages.projections.title}
121
+ description={apiErrorMessage(projectionsQuery.error, messages.common.loadFailed)}
122
+ />
123
+ ) : (
124
+ <PanelEmpty
125
+ icon={Layers}
126
+ title={messages.projections.emptyTitle}
127
+ description={messages.projections.emptyDescription}
128
+ />
129
+ )}
130
+ </Panel>
131
+ )}
132
+ </SectionPage>
133
+ )
134
+ }
135
+
136
+ /** Projections with a tab for each kind among them, so no tab is ever empty. */
137
+ function ProjectionsPanel({
138
+ projections,
139
+ tab: chosen,
140
+ onTabChange,
141
+ }: {
142
+ readonly projections: readonly Projection[]
143
+ readonly tab: Tab
144
+ readonly onTabChange: (tab: Tab) => void
145
+ }) {
146
+ const messages = useDataMessages()
147
+ const format = useFormat()
148
+ const count = (kind: ProjectionKind) => projections.filter((p) => kindOf(p) === kind).length
95
149
  const tabs = (
96
150
  [
97
- { id: "all", label: messages.projections.tabs.all, count: all.length },
151
+ { id: "all", label: messages.projections.tabs.all, count: projections.length },
98
152
  { id: "object", label: messages.projections.tabs.object, count: count("object") },
99
153
  { id: "link", label: messages.projections.tabs.link, count: count("link") },
100
154
  { id: "telemetry", label: messages.projections.tabs.telemetry, count: count("telemetry") },
101
155
  ] satisfies { id: Tab; label: string; count: number }[]
102
156
  ).filter((entry) => entry.id === "all" || entry.count > 0)
157
+ // A folder without the chosen kind shows all of its own.
158
+ const tab = tabs.some((entry) => entry.id === chosen) ? chosen : "all"
159
+ const shown =
160
+ tab === "all" ? projections : projections.filter((projection) => kindOf(projection) === tab)
103
161
 
104
162
  return (
105
- <SectionPage
106
- section="console"
107
- page="projections"
108
- title={messages.projections.title}
109
- description={messages.projections.description}
110
- >
111
- <Panel
112
- toolbar={
113
- projectionsQuery.isPending ? (
114
- <SkeletonBlock className="h-7 w-56" />
115
- ) : all.length > 0 ? (
116
- <ToolbarTabs value={tab} onChange={setTab} tabs={tabs} />
117
- ) : undefined
118
- }
119
- >
120
- {projectionsQuery.isPending ? (
121
- <PanelSkeleton rows={3} interactive trailing={<TrailingSkeleton chevron />} />
122
- ) : projectionsQuery.isError ? (
123
- <PanelEmpty
124
- tone="error"
125
- icon={Layers}
126
- title={messages.projections.title}
127
- description={apiErrorMessage(projectionsQuery.error, messages.common.loadFailed)}
128
- />
129
- ) : shown.length === 0 ? (
130
- <PanelEmpty
131
- icon={Layers}
132
- title={messages.projections.emptyTitle}
133
- description={messages.projections.emptyDescription}
134
- />
135
- ) : (
136
- shown.map((projection) => {
137
- const kind = kindOf(projection)
138
- return (
139
- <PanelRow
140
- key={projection.id}
141
- href={`/console/projections/${encodeURIComponent(projection.id)}`}
142
- leading={<IconTile icon={kindIcons[kind]} />}
143
- title={<span className="truncate">{humanize(projection.id)}</span>}
144
- meta={
163
+ <Panel toolbar={<ToolbarTabs value={tab} onChange={onTabChange} tabs={tabs} />}>
164
+ {shown.map((projection) => {
165
+ const kind = kindOf(projection)
166
+ return (
167
+ <PanelRow
168
+ key={projection.id}
169
+ href={`/console/projections/${encodeURIComponent(projection.id)}`}
170
+ leading={<IconTile icon={kindIcons[kind]} />}
171
+ title={<span className="truncate">{humanize(projection.id)}</span>}
172
+ meta={
173
+ <>
174
+ <span>{messages.projections.kinds[kind]}</span>
175
+ <MetaDot />
176
+ <span className="inline-flex min-w-0 items-center gap-1">
177
+ <span className="truncate font-mono text-xs">{projection.datasetId}</span>
178
+ <ArrowRight className="size-3 shrink-0" />
179
+ <span className="truncate">{targetOf(projection)}</span>
180
+ </span>
181
+ {projection.latestRun ? (
145
182
  <>
146
- <span>{messages.projections.kinds[kind]}</span>
147
183
  <MetaDot />
148
- <span className="inline-flex min-w-0 items-center gap-1">
149
- <span className="truncate font-mono text-xs">{projection.datasetId}</span>
150
- <ArrowRight className="size-3 shrink-0" />
151
- <span className="truncate">{targetOf(projection)}</span>
184
+ <span>
185
+ {format.relative(
186
+ projection.latestRun.startedAt ?? projection.latestRun.queuedAt
187
+ )}
152
188
  </span>
153
- {projection.latestRun ? (
154
- <>
155
- <MetaDot />
156
- <span>
157
- {format.relative(
158
- projection.latestRun.startedAt ?? projection.latestRun.queuedAt
159
- )}
160
- </span>
161
- </>
162
- ) : null}
163
- </>
164
- }
165
- trailing={
166
- <>
167
- {projection.latestRun ? (
168
- <RunStatusPill status={projection.latestRun.status} />
169
- ) : (
170
- <Pill tone="muted">{messages.common.neverRun}</Pill>
171
- )}
172
- <ChevronRight className="size-4 text-muted-foreground/60" />
173
189
  </>
174
- }
175
- />
176
- )
177
- })
178
- )}
179
- </Panel>
180
- </SectionPage>
190
+ ) : null}
191
+ </>
192
+ }
193
+ trailing={
194
+ <>
195
+ {projection.latestRun ? (
196
+ <RunStatusPill status={projection.latestRun.status} />
197
+ ) : (
198
+ <Pill tone="muted">{messages.common.neverRun}</Pill>
199
+ )}
200
+ <ChevronRight className="size-4 text-muted-foreground/60" />
201
+ </>
202
+ }
203
+ />
204
+ )
205
+ })}
206
+ </Panel>
181
207
  )
182
208
  }
183
209
 
@@ -209,7 +235,10 @@ export function ConsoleProjectionPage() {
209
235
  })
210
236
 
211
237
  const projection = projectionQuery.data
212
- const back = { href: "/console/projections", label: messages.projections.title }
238
+ const back = folderBack(
239
+ { href: "/console/projections", label: messages.projections.title },
240
+ projection?.folder
241
+ )
213
242
 
214
243
  if (!projection) {
215
244
  return (
@@ -2,6 +2,7 @@ import { getSyncOptions, listSyncRunsOptions, listSyncsOptions } from "@sixb/cli
2
2
  import { useQuery } from "@tanstack/react-query"
3
3
  import { CalendarClock, ChevronRight, RefreshCw } from "lucide-react"
4
4
  import { Link, useParams } from "react-router-dom"
5
+ import { FolderContents, folderBack, noItems, useFolderBrowser } from "../../folders"
5
6
  import { DetailFallback, SectionPage } from "../../section-page"
6
7
  import {
7
8
  apiErrorMessage,
@@ -44,60 +45,69 @@ export function ConsoleSyncsPage() {
44
45
  const messages = useDataMessages()
45
46
  useSyncLiveUpdates()
46
47
  const syncsQuery = useQuery({ ...listSyncsOptions(), retry: false })
47
- const syncs = syncsQuery.data ?? []
48
+ const browser = useFolderBrowser({
49
+ items: syncsQuery.data ?? noItems,
50
+ title: messages.syncs.title,
51
+ description: messages.syncs.description,
52
+ })
48
53
 
49
54
  return (
50
- <SectionPage
51
- section="console"
52
- page="syncs"
53
- title={messages.syncs.title}
54
- description={messages.syncs.description}
55
- >
56
- <Panel>
57
- {syncsQuery.isPending ? (
58
- <PanelSkeleton rows={3} interactive trailing={<TrailingSkeleton chevron />} />
59
- ) : syncsQuery.isError ? (
60
- <PanelEmpty
61
- tone="error"
62
- icon={RefreshCw}
63
- title={messages.syncs.title}
64
- description={apiErrorMessage(syncsQuery.error, messages.common.loadFailed)}
65
- />
66
- ) : syncs.length === 0 ? (
67
- <PanelEmpty
68
- icon={RefreshCw}
69
- title={messages.syncs.emptyTitle}
70
- description={messages.syncs.emptyDescription}
71
- />
72
- ) : (
73
- syncs.map((sync) => (
74
- <PanelRow
75
- key={sync.id}
76
- href={`/console/syncs/${encodeURIComponent(sync.id)}`}
77
- leading={<ConnectorIcon type={sync.connector.type} />}
78
- title={<span className="truncate">{humanize(sync.id)}</span>}
79
- meta={
80
- <>
81
- <span>{messages.common.modes[sync.mode]}</span>
82
- <MetaDot />
83
- <span className="truncate">{messages.common.writes(sync.target.dataset.id)}</span>
84
- {sync.triggers.map((trigger) => (
85
- <ScheduleMeta key={trigger.scheduleId} id={trigger.scheduleId} />
86
- ))}
87
- <SyncTimeMeta sync={sync} />
88
- {sync.accounts ? <AccountsMeta summary={sync.accounts} /> : null}
89
- </>
90
- }
91
- trailing={
92
- <>
93
- <SyncStatusPill sync={sync} />
94
- <ChevronRight className="size-4 text-muted-foreground/60" />
95
- </>
96
- }
55
+ <SectionPage section="console" page="syncs" {...browser.frame}>
56
+ {syncsQuery.isSuccess && syncsQuery.data.length > 0 ? (
57
+ <FolderContents browser={browser} rootLabel={messages.syncs.title}>
58
+ {(syncs) => (
59
+ <Panel>
60
+ {syncs.map((sync) => (
61
+ <PanelRow
62
+ key={sync.id}
63
+ href={`/console/syncs/${encodeURIComponent(sync.id)}`}
64
+ leading={<ConnectorIcon type={sync.connector.type} />}
65
+ title={<span className="truncate">{humanize(sync.id)}</span>}
66
+ meta={
67
+ <>
68
+ <span>{messages.common.modes[sync.mode]}</span>
69
+ <MetaDot />
70
+ <span className="truncate">
71
+ {messages.common.writes(sync.target.dataset.id)}
72
+ </span>
73
+ {sync.triggers.map((trigger) => (
74
+ <ScheduleMeta key={trigger.scheduleId} id={trigger.scheduleId} />
75
+ ))}
76
+ <SyncTimeMeta sync={sync} />
77
+ {sync.accounts ? <AccountsMeta summary={sync.accounts} /> : null}
78
+ </>
79
+ }
80
+ trailing={
81
+ <>
82
+ <SyncStatusPill sync={sync} />
83
+ <ChevronRight className="size-4 text-muted-foreground/60" />
84
+ </>
85
+ }
86
+ />
87
+ ))}
88
+ </Panel>
89
+ )}
90
+ </FolderContents>
91
+ ) : (
92
+ <Panel>
93
+ {syncsQuery.isPending ? (
94
+ <PanelSkeleton rows={3} interactive trailing={<TrailingSkeleton chevron />} />
95
+ ) : syncsQuery.isError ? (
96
+ <PanelEmpty
97
+ tone="error"
98
+ icon={RefreshCw}
99
+ title={messages.syncs.title}
100
+ description={apiErrorMessage(syncsQuery.error, messages.common.loadFailed)}
101
+ />
102
+ ) : (
103
+ <PanelEmpty
104
+ icon={RefreshCw}
105
+ title={messages.syncs.emptyTitle}
106
+ description={messages.syncs.emptyDescription}
97
107
  />
98
- ))
99
- )}
100
- </Panel>
108
+ )}
109
+ </Panel>
110
+ )}
101
111
  </SectionPage>
102
112
  )
103
113
  }
@@ -130,7 +140,7 @@ export function ConsoleSyncPage() {
130
140
  connection.account.label,
131
141
  ]) ?? []
132
142
  )
133
- const back = { href: "/console/syncs", label: messages.syncs.title }
143
+ const back = folderBack({ href: "/console/syncs", label: messages.syncs.title }, sync?.folder)
134
144
 
135
145
  if (!sync) {
136
146
  return (
@@ -46,6 +46,7 @@ import {
46
46
  import { type ReactElement, type SyntheticEvent, useCallback, useMemo, useState } from "react"
47
47
  import { useNavigate, useSearchParams } from "react-router-dom"
48
48
  import { useSectionOpen } from "../../../sections/sections"
49
+ import { FolderContents, noItems, useFolderBrowser } from "../../folders"
49
50
  import { actionRunHref } from "../../routes"
50
51
  import { notify, SectionPage } from "../../section-page"
51
52
  import {
@@ -94,6 +95,17 @@ export function ConsoleActionsPage() {
94
95
  const count = countQuery.data?.length
95
96
  const [searchParams, setSearchParams] = useSearchParams()
96
97
  const view = searchParams.get("view") === "runs" ? "runs" : "actions"
98
+ // The list below arranges the same actions by the same URL; this is its header.
99
+ const browser = useFolderBrowser({
100
+ items: countQuery.data ?? noItems,
101
+ title: "Actions",
102
+ meta: countQuery.isPending ? (
103
+ <CountSkeleton />
104
+ ) : count === undefined ? undefined : (
105
+ <span>{`${count} action${count === 1 ? "" : "s"}`}</span>
106
+ ),
107
+ narrowed: view === "runs" || actionFiltersActive(searchParams),
108
+ })
97
109
  // Each view has its own filters, so switching starts them clear.
98
110
  const showView = (next: "actions" | "runs") =>
99
111
  setSearchParams(next === "runs" ? { view: "runs" } : {})
@@ -113,19 +125,7 @@ export function ConsoleActionsPage() {
113
125
  )
114
126
 
115
127
  return (
116
- <SectionPage
117
- section="console"
118
- page="actions"
119
- width="wide"
120
- title="Actions"
121
- meta={
122
- countQuery.isPending ? (
123
- <CountSkeleton />
124
- ) : count === undefined ? undefined : (
125
- <span>{`${count} action${count === 1 ? "" : "s"}`}</span>
126
- )
127
- }
128
- >
128
+ <SectionPage section="console" page="actions" width="wide" {...browser.frame}>
129
129
  <ToolbarTabs
130
130
  className="-mt-4"
131
131
  value={view}
@@ -188,12 +188,23 @@ function ActionDefinitionsTab() {
188
188
  if (scope === "object" && !action.objectTypeId) return false
189
189
  if (objectType !== "all" && action.objectTypeId !== objectType) return false
190
190
  if (!normalizedQuery) return true
191
- return [action.id, humanizeIdentifier(action.id), action.description, action.objectTypeId]
191
+ return [
192
+ action.id,
193
+ humanizeIdentifier(action.id),
194
+ action.description,
195
+ action.objectTypeId,
196
+ action.folder,
197
+ ]
192
198
  .filter((value): value is string => typeof value === "string")
193
199
  .some((value) => value.toLowerCase().includes(normalizedQuery))
194
200
  })
195
201
  }, [actions, objectType, query, scope])
196
- const filtersActive = query.trim().length > 0 || scope !== "all" || objectType !== "all"
202
+ const filtersActive = actionFiltersActive(searchParams)
203
+ const browser = useFolderBrowser({
204
+ items: filteredActions,
205
+ title: "Actions",
206
+ narrowed: filtersActive,
207
+ })
197
208
 
198
209
  const updateFilterParam = (key: "q" | "type", value: string) => {
199
210
  setSearchParams(
@@ -318,15 +329,19 @@ function ActionDefinitionsTab() {
318
329
  ))}
319
330
  </div>
320
331
  ) : filteredActions.length > 0 ? (
321
- <div className="grid gap-3 lg:grid-cols-2">
322
- {filteredActions.map((action) => (
323
- <ActionCard
324
- key={action.id}
325
- action={action}
326
- latestRun={latestRunByAction.get(action.id)}
327
- />
328
- ))}
329
- </div>
332
+ <FolderContents browser={browser} rootLabel="Actions">
333
+ {(shown) => (
334
+ <div className="grid gap-3 lg:grid-cols-2">
335
+ {shown.map((action) => (
336
+ <ActionCard
337
+ key={action.id}
338
+ action={action}
339
+ latestRun={latestRunByAction.get(action.id)}
340
+ />
341
+ ))}
342
+ </div>
343
+ )}
344
+ </FolderContents>
330
345
  ) : (
331
346
  <PanelEmpty
332
347
  icon={Search}
@@ -340,6 +355,18 @@ function ActionDefinitionsTab() {
340
355
  )
341
356
  }
342
357
 
358
+ /** Whether the URL narrows the actions, so they show by folder no longer but all matches at once. */
359
+ function actionFiltersActive(params: URLSearchParams): boolean {
360
+ const scope = params.get("scope")
361
+ const type = params.get("type")
362
+ return (
363
+ (params.get("q") ?? "").trim().length > 0 ||
364
+ scope === "global" ||
365
+ scope === "object" ||
366
+ (type !== null && type !== "all" && scope !== "global")
367
+ )
368
+ }
369
+
343
370
  function ActionsFailure({ error }: { readonly error: unknown }) {
344
371
  const failure = useLoadFailure(error)
345
372
  return (
@@ -23,6 +23,7 @@ import { useQuery } from "@tanstack/react-query"
23
23
  import { Box, ChevronRight, LayoutGrid, Network } from "lucide-react"
24
24
  import { Fragment, type ReactNode, useMemo } from "react"
25
25
  import { Link, useNavigate, useParams, useSearchParams } from "react-router-dom"
26
+ import { folderBack } from "../../folders"
26
27
  import { graphTypeHref, objectsOfTypeHref, objectTypeHref } from "../../routes"
27
28
  import { DetailFallback, SectionPage } from "../../section-page"
28
29
  import { SkeletonText } from "../../section-ui"
@@ -103,7 +104,10 @@ export function ConsoleObjectTypePage() {
103
104
  const resolvedTab: TabValue =
104
105
  activeTab === "projections" && projectionCount === 0 ? DEFAULT_TAB : activeTab
105
106
 
106
- const back = { href: "/console/object-types", label: "Object types" }
107
+ const back = folderBack(
108
+ { href: "/console/object-types", label: "Object types" },
109
+ objectType?.folder
110
+ )
107
111
  if (!objectType) {
108
112
  return (
109
113
  <DetailFallback
@@ -5,6 +5,7 @@ import { useQuery } from "@tanstack/react-query"
5
5
  import { CornerDownRight, LayoutGrid, Link2, Rows3, Zap } from "lucide-react"
6
6
  import { useMemo, useState } from "react"
7
7
  import { useNavigate } from "react-router-dom"
8
+ import { FolderContents, useFolderBrowser } from "../../folders"
8
9
  import { objectTypeHref } from "../../routes"
9
10
  import { SectionPage } from "../../section-page"
10
11
  import { apiErrorMessage, PanelEmpty, SkeletonText } from "../../section-ui"
@@ -28,31 +29,33 @@ export function ConsoleObjectTypesPage() {
28
29
  const typesQuery = useQuery({ ...listObjectTypesOptions(), retry: false })
29
30
  const objectTypes = typesQuery.data ?? noObjectTypes
30
31
  const byId = useMemo(() => new Map(objectTypes.map((type) => [type.id, type])), [objectTypes])
32
+ const query = search.trim().toLowerCase()
31
33
  const filtered = useMemo(() => {
32
34
  const sorted = [...objectTypes].sort((a, b) => displayName(a).localeCompare(displayName(b)))
33
- const query = search.trim().toLowerCase()
34
- return query ? sorted.filter((type) => matchesType(type, query)) : sorted
35
- }, [objectTypes, search])
35
+ return query
36
+ ? sorted.filter(
37
+ (type) => matchesType(type, query) || type.folder?.toLowerCase().includes(query)
38
+ )
39
+ : sorted
40
+ }, [objectTypes, query])
41
+ const browser = useFolderBrowser({
42
+ items: filtered,
43
+ title: "Object types",
44
+ meta: typesQuery.isPending ? (
45
+ <CountSkeleton />
46
+ ) : (
47
+ <span>{countLabel(objectTypes.length, "type")}</span>
48
+ ),
49
+ narrowed: query.length > 0,
50
+ })
36
51
 
37
52
  return (
38
- <SectionPage
39
- section="console"
40
- page="object-types"
41
- width="wide"
42
- title="Object types"
43
- meta={
44
- typesQuery.isPending ? (
45
- <CountSkeleton />
46
- ) : (
47
- <span>{countLabel(objectTypes.length, "type")}</span>
48
- )
49
- }
50
- >
53
+ <SectionPage section="console" page="object-types" width="wide" {...browser.frame}>
51
54
  <div className="-mt-4 flex flex-col">
52
55
  <CollectionToolbar
53
56
  search={{
54
57
  value: search,
55
- placeholder: "Search types, fields, or links...",
58
+ placeholder: "Search types, fields, folders, or links...",
56
59
  onChange: setSearch,
57
60
  }}
58
61
  />
@@ -72,19 +75,25 @@ export function ConsoleObjectTypesPage() {
72
75
  No types matching "{search}".
73
76
  </div>
74
77
  ) : (
75
- <div className={typeListClass}>
76
- <ul className="divide-y divide-border">
77
- {filtered.map((type) => (
78
- <li key={type.id}>
79
- <TypeRow
80
- type={type}
81
- parent={type.extends ? (byId.get(type.extends) ?? null) : null}
82
- onSelect={() => navigate(objectTypeHref(type.id))}
83
- onSelectType={(typeId) => navigate(objectTypeHref(typeId))}
84
- />
85
- </li>
86
- ))}
87
- </ul>
78
+ <div className="mt-2">
79
+ <FolderContents browser={browser} rootLabel="Object types">
80
+ {(types) => (
81
+ <div className={typeListClass}>
82
+ <ul className="divide-y divide-border">
83
+ {types.map((type) => (
84
+ <li key={type.id}>
85
+ <TypeRow
86
+ type={type}
87
+ parent={type.extends ? (byId.get(type.extends) ?? null) : null}
88
+ onSelect={() => navigate(objectTypeHref(type.id))}
89
+ onSelectType={(typeId) => navigate(objectTypeHref(typeId))}
90
+ />
91
+ </li>
92
+ ))}
93
+ </ul>
94
+ </div>
95
+ )}
96
+ </FolderContents>
88
97
  </div>
89
98
  )}
90
99
  </div>
@@ -93,13 +102,13 @@ export function ConsoleObjectTypesPage() {
93
102
  }
94
103
 
95
104
  const typeListClass =
96
- "mt-2 overflow-hidden rounded-xl border border-border bg-card shadow-[0_1px_2px_0_rgb(0_0_0/0.04)]"
105
+ "overflow-hidden rounded-xl border border-border bg-card shadow-[0_1px_2px_0_rgb(0_0_0/0.04)]"
97
106
  const typeRowClass = "flex items-start gap-4 px-4 py-3.5"
98
107
 
99
108
  /** The list while the types load, row for row the shape of `TypeRow`. */
100
109
  function TypeListSkeleton() {
101
110
  return (
102
- <div aria-hidden className={typeListClass}>
111
+ <div aria-hidden className={cn("mt-2", typeListClass)}>
103
112
  <ul className="divide-y divide-border">
104
113
  {["w-64", "w-52", "w-72", "w-48", "w-60"].map((width) => (
105
114
  <li key={width} className={typeRowClass}>