import { createWorkspaceModel } from '@yaakapp-internal/models'; import { useState } from 'react'; import { useToggle } from '../hooks/useToggle'; import { ColorIndicator } from './ColorIndicator'; import { Button } from './core/Button'; import { Checkbox } from './core/Checkbox'; import { ColorPickerWithThemeColors } from './core/ColorPicker'; import { Label } from './core/Label'; import { PlainInput } from './core/PlainInput'; interface Props { onCreate: (id: string) => void; hide: () => void; workspaceId: string; } export function CreateEnvironmentDialog({ workspaceId, hide, onCreate }: Props) { const [name, setName] = useState(''); const [color, setColor] = useState(null); const [sharable, toggleSharable] = useToggle(false); return (
{ e.preventDefault(); const id = await createWorkspaceModel({ model: 'environment', name, color, variables: [], public: sharable, workspaceId, parentModel: 'environment', }); hide(); onCreate(id); }} >
); }