diff --git a/packages/editor/src/editor/Canvas.tsx b/packages/editor/src/editor/Canvas.tsx
index 0ad77d1..fa1ba1f 100644
--- a/packages/editor/src/editor/Canvas.tsx
+++ b/packages/editor/src/editor/Canvas.tsx
@@ -38,7 +38,7 @@ export interface CanvasProps {
}
function isPrimaryButton(e: React.PointerEvent | PointerEvent): boolean {
- // align with goView: ignore middle click in box select
+ // Ignore middle click in box select.
return (e as PointerEvent).buttons === 1 || (e as PointerEvent).button === 0;
}
diff --git a/packages/editor/src/editor/EditorApp.tsx b/packages/editor/src/editor/EditorApp.tsx
index 27168cd..93fca77 100644
--- a/packages/editor/src/editor/EditorApp.tsx
+++ b/packages/editor/src/editor/EditorApp.tsx
@@ -1,22 +1,56 @@
-import { Button, Divider, Input, Layout, Space, Typography } from 'antd';
+import {
+ Button,
+ Divider,
+ Input,
+ InputNumber,
+ Layout,
+ Segmented,
+ Space,
+ Tabs,
+ Typography,
+} from 'antd';
import { useEffect, useMemo, useReducer, useState } from 'react';
-import { createInitialState, editorReducer, exportScreenJSON } from './store';
import { bindEditorHotkeys } from './hotkeys';
import { Canvas } from './Canvas';
import { Inspector } from './Inspector';
+import { createInitialState, editorReducer, exportScreenJSON } from './store';
const { Header, Sider, Content } = Layout;
+type RightPanelTabKey = 'custom' | 'animation' | 'data' | 'event';
+
+type LeftCategoryKey =
+ | 'components'
+ | 'charts'
+ | 'info'
+ | 'list'
+ | 'widgets'
+ | 'image'
+ | 'icon';
+
+function PanelTitle(props: { title: string; extra?: React.ReactNode }) {
+ return (
+
+ {props.title}
+ {props.extra}
+
+ );
+}
+
export function EditorApp() {
const [state, dispatch] = useReducer(editorReducer, undefined, createInitialState);
const [importText, setImportText] = useState('');
+ const [leftCategory, setLeftCategory] = useState('charts');
+ const [rightTab, setRightTab] = useState('custom');
+
+ const selected = state.doc.screen.nodes.find((n) => n.id === state.selection.ids[0]);
+ const hasSelection = state.selection.ids.length > 0;
const bounds = useMemo(
() => ({ w: state.doc.screen.width, h: state.doc.screen.height }),
[state.doc.screen.width, state.doc.screen.height],
);
- // keyboard tracking (ctrl/space) — goView uses window.$KeyboardActive
useEffect(() => {
const onKeyDown = (e: KeyboardEvent) => {
dispatch({ type: 'keyboard', ctrl: e.ctrlKey || e.metaKey, space: e.code === 'Space' || state.keyboard.space });
@@ -33,9 +67,6 @@ export function EditorApp() {
};
}, [state.keyboard.space]);
- // Canvas handles its own context menu.
-
- // Hotkeys (goView-like)
useEffect(() => {
return bindEditorHotkeys(() => false, dispatch);
}, []);
@@ -45,75 +76,205 @@ export function EditorApp() {
};
return (
-
-
-
- AstralView Editor
-
-
-