Victor Dibia 85cf942d37
Add v1 Drag and Drop Team Composition to AGS (#4609)
* v1 progress on drag_drop

* add v1 for node deletions

* major refactor, add sidebar to teams and session playground

* format updates

* formatting updates

* update formatting

* formatting and other checks

* add mangentic one deps

* general refactor, fix new team creation bug etc...

* minor bugfix

* update uv lock

---------

Co-authored-by: Ryan Sweet <rysweet@microsoft.com>
2024-12-11 14:31:25 -08:00

51 lines
1.2 KiB
TypeScript

import React, { useState } from "react";
import Editor from "@monaco-editor/react";
export const MonacoEditor = ({
value,
editorRef,
language,
onChange,
minimap = true,
className,
}: {
value: string;
onChange?: (value: string) => void;
editorRef: any;
language: string;
minimap?: boolean;
className?: string;
}) => {
const [isEditorReady, setIsEditorReady] = useState(false);
const onEditorDidMount = (editor: any, monaco: any) => {
editorRef.current = editor;
setIsEditorReady(true);
};
return (
<div id="monaco-editor" className={`h-full rounded ${className}`}>
<Editor
height="100%"
className="h-full rounded"
defaultLanguage={language}
defaultValue={value}
value={value}
onChange={(value: string | undefined) => {
if (onChange && value) {
onChange(value);
}
}}
onMount={onEditorDidMount}
theme="vs-dark"
options={{
wordWrap: "on",
wrappingIndent: "indent",
wrappingStrategy: "advanced",
minimap: {
enabled: minimap,
},
}}
/>
</div>
);
};