-
-
- {tabs.map((tab) => {
- const { id } = tab;
- const isActive = id === activeTabId;
-
- return (
-
- );
- })}
-
-
-
-
-
- {tabs.map((tab) => {
- const { playgroundId, id } = tab;
- const active = tab.id === activeTabId;
- const playground = playgrounds.get(playgroundId);
-
- if (!active || !playground) return null;
-
- return
;
- })}
-
- );
-};
diff --git a/apps/executeJS/src/pages/playground/playground-page.tsx b/apps/executeJS/src/pages/playground/playground-page.tsx
index 9ea463d..e540d5a 100644
--- a/apps/executeJS/src/pages/playground/playground-page.tsx
+++ b/apps/executeJS/src/pages/playground/playground-page.tsx
@@ -1,128 +1,72 @@
-import React, { useState } from 'react';
-import { Panel, PanelGroup, PanelResizeHandle } from 'react-resizable-panels';
-import { CodeEditor } from '@/widgets/code-editor';
-import { OutputPanel } from '@/widgets/output-panel';
-import { useExecutionStore } from '@/features/execute-code';
-import { PlayIcon, StopIcon } from '@radix-ui/react-icons';
+import { useState } from 'react';
-const getInitialCode = (): string => {
- try {
- const executionStorage = localStorage.getItem(
- 'executejs-execution-storage'
- );
+import { PlusIcon } from '@radix-ui/react-icons';
- if (executionStorage) {
- const parsed = JSON.parse(executionStorage);
- const code = parsed?.state?.result?.code;
+import { TabButton } from '@/features/tab';
+import { Tab, usePlaygroundStore } from '@/features/playground';
+import { PlaygroundWidget } from '@/widgets/playground';
- if (code) {
- console.log('result from executionStorage:', code);
+export interface TabContextMenu {
+ id: Tab['id'];
+ x: number;
+ y: number;
+}
- return code;
- }
- }
- } catch (error) {
- console.error('error from executionStorage:', error);
- }
+export const PlaygroundPage: React.FC = () => {
+ const { tabs, activeTabId, addTab, closeTab, setActiveTab, playgrounds } =
+ usePlaygroundStore();
- return 'console.log("Hello, ExecuteJS!");';
-};
+ const [contextMenu, setContextMenu] = useState