Spaces:
Build error
Build error
Create src/components/grabber/AddSiteDialog.tsx
#9
by launch-calcium - opened
src/components/grabber/AddSiteDialog.tsx
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
| 2 |
+
import { Input } from '@/components/ui/input';
|
| 3 |
+
import { Button } from '@/components/ui/button';
|
| 4 |
+
|
| 5 |
+
export function AddSiteDialog({ open, setOpen, onAdd }: any) {
|
| 6 |
+
const [form, setForm] = useState<any>({});
|
| 7 |
+
|
| 8 |
+
return (
|
| 9 |
+
<Dialog open={open} onOpenChange={(o) => setOpen(!o)}>
|
| 10 |
+
<DialogContent className="max-w-lg">
|
| 11 |
+
<DialogHeader><DialogTitle>Add Custom Site</DialogTitle></DialogHeader>
|
| 12 |
+
<div className="space-y-3 py-4">
|
| 13 |
+
<Input placeholder="Name" onChange={e => setForm({...form, name: e.target.value})} />
|
| 14 |
+
<Input placeholder="Base URL" onChange={e => setForm({...form, baseUrl: e.target.value})} />
|
| 15 |
+
<Input placeholder="Search Path (e.g. /posts.json)" onChange={e => setForm({...form, searchPath: e.target.value})} />
|
| 16 |
+
<Input placeholder="Posts JSON Path" onChange={e => setForm({...form, postsPath: e.target.value})} />
|
| 17 |
+
<div className="grid grid-cols-2 gap-2">
|
| 18 |
+
<Input placeholder="id field" onChange={e => setForm({...form, fields.id: e.target.value})} />
|
| 19 |
+
<Input placeholder="previewUrl field" onChange={e => setForm({...form, fields.previewUrl: e.target.value})} />
|
| 20 |
+
</div>
|
| 21 |
+
</div>
|
| 22 |
+
<Button onClick={() => { onAdd(form); setOpen(false); }} className="w-full">Save Site</Button>
|
| 23 |
+
</DialogContent>
|
| 24 |
+
</Dialog>
|
| 25 |
+
);
|
| 26 |
+
}
|