mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-30 13:39:52 +00:00
feat(desktop): show write tool output
This commit is contained in:
parent
ebefb26e8f
commit
ff690350b1
6 changed files with 311 additions and 277 deletions
10
packages/ui/src/context/code.tsx
Normal file
10
packages/ui/src/context/code.tsx
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import type { ValidComponent } from "solid-js"
|
||||
import { createSimpleContext } from "./helper"
|
||||
|
||||
const ctx = createSimpleContext<ValidComponent, { component: ValidComponent }>({
|
||||
name: "CodeComponent",
|
||||
init: (props) => props.component,
|
||||
})
|
||||
|
||||
export const CodeComponentProvider = ctx.provider
|
||||
export const useCodeComponent = ctx.use
|
||||
|
|
@ -1,13 +1,10 @@
|
|||
import { createContext, useContext, type ParentProps, type ValidComponent } from "solid-js"
|
||||
import type { ValidComponent } from "solid-js"
|
||||
import { createSimpleContext } from "./helper"
|
||||
|
||||
const DiffComponentContext = createContext<ValidComponent>()
|
||||
const ctx = createSimpleContext<ValidComponent, { component: ValidComponent }>({
|
||||
name: "DiffComponent",
|
||||
init: (props) => props.component,
|
||||
})
|
||||
|
||||
export function DiffComponentProvider(props: ParentProps<{ component: ValidComponent }>) {
|
||||
return <DiffComponentContext.Provider value={props.component}>{props.children}</DiffComponentContext.Provider>
|
||||
}
|
||||
|
||||
export function useDiffComponent() {
|
||||
const component = useContext(DiffComponentContext)
|
||||
if (!component) throw new Error("DiffComponentProvider must be used to provide a diff component")
|
||||
return component
|
||||
}
|
||||
export const DiffComponentProvider = ctx.provider
|
||||
export const useDiffComponent = ctx.use
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue