MCPcopy Index your code
hub / github.com/anomalyco/opencode / createOpenSessionFileTab

Function createOpenSessionFileTab

packages/app/src/pages/session/helpers.ts:130–149  ·  view source on GitHub ↗
(input: {
  normalizeTab: (tab: string) => string
  openTab: (tab: string) => void
  pathFromTab: (tab: string) => string | undefined
  loadFile: (path: string) => void
  openReviewPanel: () => void
  setActive: (tab: string) => void
})

Source from the content-addressed store, hash-verified

128}
129
130export const createOpenSessionFileTab = (input: {
131 normalizeTab: (tab: string) => string
132 openTab: (tab: string) => void
133 pathFromTab: (tab: string) => string | undefined
134 loadFile: (path: string) => void
135 openReviewPanel: () => void
136 setActive: (tab: string) => void
137}) => {
138 return (value: string) => {
139 const next = input.normalizeTab(value)
140 input.openTab(next)
141
142 const path = input.pathFromTab(next)
143 if (!path) return
144
145 input.loadFile(path)
146 input.openReviewPanel()
147 input.setActive(next)
148 }
149}
150
151export const getTabReorderIndex = (tabs: readonly string[], from: string, to: string) => {
152 const fromIndex = tabs.indexOf(from)

Callers 2

helpers.test.tsFile · 0.90
SessionSidePanelFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected