Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/executeJS/src/app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import { Providers } from './providers';
import { EditorPage } from '../pages/editor';
import { PlaygroundGroups } from '../pages/playground';

export const App: React.FC = () => {
return (
<Providers>
<EditorPage />
<PlaygroundGroups />
</Providers>
);
};
1 change: 0 additions & 1 deletion apps/executeJS/src/pages/editor/index.ts

This file was deleted.

2 changes: 2 additions & 0 deletions apps/executeJS/src/pages/playground/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './playground-page';
export * from './playground-groups';
90 changes: 90 additions & 0 deletions apps/executeJS/src/pages/playground/playground-groups.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { useState } from 'react';
import { PlaygroundPage } from './playground-page';
import { Cross2Icon, PlusIcon } from '@radix-ui/react-icons';

interface Tab {
id: string;
title: string;
}

const INITIAL_TAB_TITLE = 'โœจNew Playground';

const initialTabs: Tab[] = [{ id: 'playground-1', title: INITIAL_TAB_TITLE }];

export const PlaygroundGroups: React.FC = () => {
const [tabs, setTabs] = useState<Tab[]>(initialTabs);

const handleCloseTab = (tabId: string) => {
setTabs((prevTabs) => {
if (prevTabs.length === 1) {
return prevTabs; // ์ตœ์†Œ ํ•˜๋‚˜์˜ ํƒญ์€ ์œ ์ง€
}

return prevTabs.filter((tab) => tab.id !== tabId);
});
};

const handleAddTab = () => {
setTabs((prevTabs) => {
const date = new Date().valueOf();
const newTabId = `playground-${date}`;
const newTab: Tab = {
id: newTabId,
title: INITIAL_TAB_TITLE,
};

return [...prevTabs, newTab];
});
};

return (
<div className="overflow-hidden w-screen h-screen">
<div className="overflow-x-auto flex items-center border-b border-slate-800">
<div className="flex shrink-0">
{tabs.map(({ id, title }) => {
return (
<div
key={id}
className="shrink-0 flex items-center p-2 border-r border-slate-800"
>
{/* TODO: ํƒญ ์ตœ๋Œ€ ๋„ˆ๋น„์— ๋”ฐ๋ฅธ ์ œ๋ชฉ ellipsis ์ฒ˜๋ฆฌ @bori */}
<button
type="button"
onClick={() => {
// TODO: ํƒญ ์ „ํ™˜ ๋กœ์ง @bori
}}
onContextMenu={(event) => {
event.preventDefault();
// TODO: ํƒญ ์šฐํด๋ฆญ ๋ฉ”๋‰ด ๋กœ์ง @bori
console.log('์šฐํด๋ฆญ ๋ฉ”๋‰ด -', id);
}}
className="pr-2"
>
{title}
</button>
<button
type="button"
onClick={() => handleCloseTab(id)}
className="p-1 rounded-sm hover:bg-[rgba(255,255,255,0.2)] transition-colors cursor-pointer"
>
<Cross2Icon />
</button>
</div>
);
})}
</div>

<button
type="button"
onClick={handleAddTab}
className="shrink-0 p-2 ml-1 rounded-sm hover:bg-[rgba(255,255,255,0.2)] transition-colors cursor-pointer"
>
<PlusIcon />
</button>
</div>

{/* TODO: ํ™œ์„ฑํ™”๋œ ํƒญ์— ๋”ฐ๋ฅธ ํ”Œ๋ ˆ์ด๊ทธ๋ผ์šด๋“œ ๋ Œ๋”๋ง @bori */}
<PlaygroundPage />
</div>
);
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { render, screen } from '@testing-library/react';
import { describe, it, expect, vi } from 'vitest';
import '@testing-library/jest-dom';
import { EditorPage } from './editor-page';
import { PlaygroundPage } from './playground-page';

// Tauri API ๋ชจํ‚น
vi.mock('@tauri-apps/api/core', () => ({
Expand All @@ -13,9 +13,9 @@ vi.mock('@legendapp/state/react', () => ({
useObservable: vi.fn(() => []),
}));

describe('EditorPage', () => {
describe('PlaygroundPage', () => {
it('renders without crashing', () => {
render(<EditorPage />);
render(<PlaygroundPage />);
expect(screen.getByText(/์‹คํ–‰ \(Cmd\+Enter\)/)).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { OutputPanel } from '@/widgets/output-panel';
import { useExecutionStore } from '@/features/execute-code';
import { PlayIcon, StopIcon } from '@radix-ui/react-icons';

export const EditorPage: React.FC = () => {
export const PlaygroundPage: React.FC = () => {
const [code, setCode] = useState('console.log("Hello, ExecuteJS!");');
const {
result: executionResult,
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/guide/development.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ src/
โ”‚ โ”œโ”€โ”€ index.tsx # ์•ฑ ๋ฃจํŠธ ์ปดํฌ๋„ŒํŠธ
โ”‚ โ””โ”€โ”€ providers.tsx # ์ „์—ญ ํ”„๋กœ๋ฐ”์ด๋” (Legend State, Radix UI)
โ”œโ”€โ”€ pages/ # ํŽ˜์ด์ง€ ๋ ˆ๋ฒจ ์ปดํฌ๋„ŒํŠธ
โ”‚ โ””โ”€โ”€ editor/
โ”‚ โ””โ”€โ”€ EditorPage.tsx # ๋ฉ”์ธ ์—๋””ํ„ฐ ํŽ˜์ด์ง€
โ”‚ โ””โ”€โ”€ playground/
โ”‚ โ””โ”€โ”€ PlaygroundPage.tsx # ํ”Œ๋ ˆ์ด๊ทธ๋ผ์šด๋“œ ํŽ˜์ด์ง€
โ”œโ”€โ”€ widgets/ # ๋ณตํ•ฉ UI ๋ธ”๋ก
โ”‚ โ”œโ”€โ”€ code-editor/
โ”‚ โ”‚ โ””โ”€โ”€ CodeEditor.tsx # Monaco Editor ๋ž˜ํผ
Expand Down