frontend/src/components/sources/README.md
The AddSourceDialog component provides a comprehensive interface for adding new sources to notebooks with async processing support.
import { AddSourceDialog } from '@/components/sources'
function MyComponent() {
const [dialogOpen, setDialogOpen] = useState(false)
return (
<>
<button onClick={() => setDialogOpen(true)}>
Add Source
</button>
<AddSourceDialog
open={dialogOpen}
onOpenChange={setDialogOpen}
/>
</>
)
}
<AddSourceDialog
open={dialogOpen}
onOpenChange={setDialogOpen}
defaultNotebookId="notebook:123"
/>
import { AddSourceButton } from '@/components/sources'
function MyComponent() {
return (
<AddSourceButton
defaultNotebookId="notebook:123"
variant="outline"
size="sm"
/>
)
}
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | - | Controls dialog visibility |
onOpenChange | (open: boolean) => void | - | Called when dialog should open/close |
defaultNotebookId | string | - | Pre-select a notebook |
| Prop | Type | Default | Description |
|---|---|---|---|
defaultNotebookId | string | - | Pre-select a notebook in dialog |
variant | 'default' | 'outline' | 'ghost' | 'default' | Button styling variant |
size | 'sm' | 'default' | 'lg' | 'default' | Button size |
className | string | - | Additional CSS classes |
The component integrates with several custom hooks:
useNotebooks() - Fetches available notebooksuseTransformations() - Fetches available transformationsuseCreateSource() - Handles source creationuseSourceStatus() - Monitors processing statusThe component includes comprehensive error handling: