Skip to content

The open alternative to Salesforce, designed for AI.

Migrate to twenty-ui - input/code-editor (#8072)

gitstart-app[bot]9b6359984d22
diff --git a/packages/twenty-front/src/modules/settings/serverless-functions/components/SettingsServerlessFunctionCodeEditor.tsx b/packages/twenty-front/src/modules/settings/serverless-functions/components/SettingsServerlessFunctionCodeEditor.tsx
index 44425baa4cf..543c4772e97 100644
--- a/packages/twenty-front/src/modules/settings/serverless-functions/components/SettingsServerlessFunctionCodeEditor.tsx
+++ b/packages/twenty-front/src/modules/settings/serverless-functions/components/SettingsServerlessFunctionCodeEditor.tsx
@@ -1,10 +1,10 @@
import { SettingsServerlessFunctionCodeEditorContainer } from '@/settings/serverless-functions/components/SettingsServerlessFunctionCodeEditorContainer';
import { useGetAvailablePackages } from '@/settings/serverless-functions/hooks/useGetAvailablePackages';
-import { CodeEditor } from '@/ui/input/code-editor/components/CodeEditor';
import { EditorProps, Monaco } from '@monaco-editor/react';
import dotenv from 'dotenv';
import { editor, MarkerSeverity } from 'monaco-editor';
import { AutoTypings } from 'monaco-editor-auto-typings';
+import { CodeEditor } from 'twenty-ui';
import { isDefined } from '~/utils/isDefined';
export type File = {
diff --git a/packages/twenty-front/src/modules/settings/serverless-functions/components/tabs/SettingsServerlessFunctionCodeEditorTab.tsx b/packages/twenty-front/src/modules/settings/serverless-functions/components/tabs/SettingsServerlessFunctionCodeEditorTab.tsx
index 8eb0fdfdc03..d9fffdb0600 100644
--- a/packages/twenty-front/src/modules/settings/serverless-functions/components/tabs/SettingsServerlessFunctionCodeEditorTab.tsx
+++ b/packages/twenty-front/src/modules/settings/serverless-functions/components/tabs/SettingsServerlessFunctionCodeEditorTab.tsx
@@ -6,7 +6,6 @@ import { SETTINGS_SERVERLESS_FUNCTION_TAB_LIST_COMPONENT_ID } from '@/settings/s
import { SettingsServerlessFunctionHotkeyScope } from '@/settings/serverless-functions/types/SettingsServerlessFunctionHotKeyScope';
import { getSettingsPagePath } from '@/settings/utils/getSettingsPagePath';
import { SettingsPath } from '@/types/SettingsPath';
-import { CoreEditorHeader } from '@/ui/input/code-editor/components/CodeEditorHeader';
import { TabList } from '@/ui/layout/tab/components/TabList';
import { useTabList } from '@/ui/layout/tab/hooks/useTabList';
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
@@ -16,6 +15,7 @@ import { useRecoilValue } from 'recoil';
import { Key } from 'ts-key-enum';
import {
Button,
+ CoreEditorHeader,
H2Title,
IconGitCommit,
IconPlayerPlay,
diff --git a/packages/twenty-front/src/modules/settings/serverless-functions/components/tabs/SettingsServerlessFunctionTestTab.tsx b/packages/twenty-front/src/modules/settings/serverless-functions/components/tabs/SettingsServerlessFunctionTestTab.tsx
index badf2e78543..863483c3fde 100644
--- a/packages/twenty-front/src/modules/settings/serverless-functions/components/tabs/SettingsServerlessFunctionTestTab.tsx
+++ b/packages/twenty-front/src/modules/settings/serverless-functions/components/tabs/SettingsServerlessFunctionTestTab.tsx
@@ -1,4 +1,11 @@
-import { Button, H2Title, IconPlayerPlay, Section } from 'twenty-ui';
+import {
+ Button,
+ CodeEditor,
+ CoreEditorHeader,
+ H2Title,
+ IconPlayerPlay,
+ Section,
+} from 'twenty-ui';
import { LightCopyIconButton } from '@/object-record/record-field/components/LightCopyIconButton';
import { SettingsServerlessFunctionCodeEditorContainer } from '@/settings/serverless-functions/components/SettingsServerlessFunctionCodeEditorContainer';
@@ -9,8 +16,6 @@ import { settingsServerlessFunctionOutputState } from '@/settings/serverless-fun
import { SettingsServerlessFunctionHotkeyScope } from '@/settings/serverless-functions/types/SettingsServerlessFunctionHotKeyScope';
import { getSettingsPagePath } from '@/settings/utils/getSettingsPagePath';
import { SettingsPath } from '@/types/SettingsPath';
-import { CodeEditor } from '@/ui/input/code-editor/components/CodeEditor';
-import { CoreEditorHeader } from '@/ui/input/code-editor/components/CodeEditorHeader';
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import styled from '@emotion/styled';
import { useNavigate } from 'react-router-dom';
diff --git a/packages/twenty-front/src/modules/workflow/components/WorkflowRunOutputVisualizer.tsx b/packages/twenty-front/src/modules/workflow/components/WorkflowRunOutputVisualizer.tsx
index 1a49c030ac6..11b73f7a898 100644
--- a/packages/twenty-front/src/modules/workflow/components/WorkflowRunOutputVisualizer.tsx
+++ b/packages/twenty-front/src/modules/workflow/components/WorkflowRunOutputVisualizer.tsx
@@ -1,7 +1,6 @@
-import { CodeEditor } from '@/ui/input/code-editor/components/CodeEditor';
import { useWorkflowRun } from '@/workflow/hooks/useWorkflowRun';
import styled from '@emotion/styled';
-import { isDefined } from 'twenty-ui';
+import { CodeEditor, isDefined } from 'twenty-ui';
const StyledSourceCodeContainer = styled.div`
border: 1px solid ${({ theme }) => theme.border.color.medium};
diff --git a/packages/twenty-front/src/modules/ui/input/code-editor/components/CodeEditor.tsx b/packages/twenty-ui/src/input/code-editor/components/CodeEditor.tsx
similarity index 86%
rename from packages/twenty-front/src/modules/ui/input/code-editor/components/CodeEditor.tsx
rename to packages/twenty-ui/src/input/code-editor/components/CodeEditor.tsx
index dc846b9c083..3d113106466 100644
--- a/packages/twenty-front/src/modules/ui/input/code-editor/components/CodeEditor.tsx
+++ b/packages/twenty-ui/src/input/code-editor/components/CodeEditor.tsx
@@ -1,7 +1,11 @@
-import { codeEditorTheme } from '@/ui/input/code-editor/utils/codeEditorTheme';
import { useTheme } from '@emotion/react';
import Editor, { EditorProps } from '@monaco-editor/react';
-import { isDefined } from 'twenty-ui';
+import { codeEditorTheme } from '@ui/input';
+import { isDefined } from '@ui/utilities';
+
+export type CodeEditorPackage = {
+ [packageName: string]: string;
+};
type CodeEditorProps = Omit<EditorProps, 'onChange'> & {
onChange?: (value: string) => void;
diff --git a/packages/twenty-front/src/modules/ui/input/code-editor/components/CodeEditorHeader.tsx b/packages/twenty-ui/src/input/code-editor/components/CodeEditorHeader.tsx
similarity index 100%
rename from packages/twenty-front/src/modules/ui/input/code-editor/components/CodeEditorHeader.tsx
rename to packages/twenty-ui/src/input/code-editor/components/CodeEditorHeader.tsx
diff --git a/packages/twenty-ui/src/input/code-editor/index.ts b/packages/twenty-ui/src/input/code-editor/index.ts
new file mode 100644
index 00000000000..d5f85820f47
--- /dev/null
+++ b/packages/twenty-ui/src/input/code-editor/index.ts
@@ -0,0 +1,3 @@
+export * from './components/CodeEditor';
+export * from './components/CodeEditorHeader';
+export * from './theme/utils/codeEditorTheme';
diff --git a/packages/twenty-front/src/modules/ui/input/code-editor/utils/codeEditorTheme.ts b/packages/twenty-ui/src/input/code-editor/theme/utils/codeEditorTheme.ts
similarity index 95%
rename from packages/twenty-front/src/modules/ui/input/code-editor/utils/codeEditorTheme.ts
rename to packages/twenty-ui/src/input/code-editor/theme/utils/codeEditorTheme.ts
index bb4bd909209..f26da9b5fc5 100644
--- a/packages/twenty-front/src/modules/ui/input/code-editor/utils/codeEditorTheme.ts
+++ b/packages/twenty-ui/src/input/code-editor/theme/utils/codeEditorTheme.ts
@@ -1,5 +1,5 @@
+import { ThemeType } from '@ui/theme';
import { editor } from 'monaco-editor';
-import { ThemeType } from 'twenty-ui';
export const codeEditorTheme = (theme: ThemeType) => {
return {
diff --git a/packages/twenty-ui/src/input/index.ts b/packages/twenty-ui/src/input/index.ts
index 8fa2e160190..feac4f3f0dd 100644
--- a/packages/twenty-ui/src/input/index.ts
+++ b/packages/twenty-ui/src/input/index.ts
@@ -12,6 +12,9 @@ export * from './button/components/LightIconButton';
export * from './button/components/LightIconButtonGroup';
export * from './button/components/MainButton';
export * from './button/components/RoundedIconButton';
+export * from './code-editor/components/CodeEditor';
+export * from './code-editor/components/CodeEditorHeader';
+export * from './code-editor/theme/utils/codeEditorTheme';
export * from './color-scheme/components/ColorSchemeCard';
export * from './color-scheme/components/ColorSchemePicker';
export * from './components/Toggle';