GHHG10/CodeServer / opencode /packages /app /src /components /directory-picker.tsx
GHHG10's picture
download
raw
956 Bytes
import { useDialog } from "@opencode-ai/ui/context/dialog"
import { ServerConnection } from "@/context/server"
import { usePlatform } from "@/context/platform"
import { DialogSelectDirectory } from "./dialog-select-directory"
import { directoryPickerKind } from "./directory-picker-policy"
type DirectoryPickerInput = {
server: ServerConnection.Any
title?: string
multiple?: boolean
onSelect: (result: string | string[] | null) => void
}
export function useDirectoryPicker() {
const platform = usePlatform()
const dialog = useDialog()
return (input: DirectoryPickerInput) => {
if (directoryPickerKind(platform.platform, input.server) === "native" && platform.platform === "desktop") {
void platform.openDirectoryPickerDialog({ title: input.title, multiple: input.multiple }).then(input.onSelect)
return
}
dialog.show(
() => <DialogSelectDirectory {...input} />,
() => input.onSelect(null),
)
}
}

Xet Storage Details

Size:
956 Bytes
·
Xet hash:
cdb6443df94e1e6d729f88f5205d9616cb825d0b5448dee7774042ad3d469196

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.