diff --git a/Composer/packages/client/src/App.js b/Composer/packages/client/src/App.js index 1651077895..e1a694d7fe 100644 --- a/Composer/packages/client/src/App.js +++ b/Composer/packages/client/src/App.js @@ -14,10 +14,28 @@ import httpClient from "./utils/http"; import ExtensionContainerWrapper from "./ExtensionContainerWrapper"; import { initializeIcons } from "office-ui-fabric-react/lib/Icons"; +import { ProjectExplorer } from "./components/ProjectExplorer"; initializeIcons(/* optional base url */); function App() { + // central state for all editors\extensions + // this would serve as the fundation of layout\data exchange\message routing + const [editors, setEditors] = useState([ + /* + { + col: 1, + row: 1, + data: { + name: "main.dialog", + content: "blabla" + }, + name: "window1", + parent: "window0(shell)" + } + */ + ]); + const [files, setFiles] = useState([]); const [openFileIndex, setOpenFileIndex] = useState(-1); const [botStatus, setBotStatus] = useState("stopped"); @@ -59,9 +77,27 @@ function App() { } function handleFileClick(file, index) { + + // keep a ref because we want to read that from outside setOpenFileIndex(index); + + var data = files[index]; + // open or set editor + setEditors([ + { + col: 1, + row: 1, + data: data, + name: "window1", + parent: "window0(shell)" + } + ]) + + } + console.log(editors); + return (
@@ -108,43 +144,21 @@ function App() { >
- + + +
- + + { editors.length > 0 && editors.map(item => { + return ( ) + })} +
- - {/* */} - {/*
- {openFileIndex > -1 && ( - - )} -
*/} ); diff --git a/Composer/packages/client/src/components/Conversation/index.js b/Composer/packages/client/src/components/Conversation/index.js index 49a47c42a3..6849e9f716 100644 --- a/Composer/packages/client/src/components/Conversation/index.js +++ b/Composer/packages/client/src/components/Conversation/index.js @@ -2,8 +2,9 @@ import { jsx } from "@emotion/core"; import { container, top } from "./styles"; -export const Conversation = () => ( +export const Conversation = (props) => (
+ {props.children}
); diff --git a/Composer/packages/client/src/components/ProjectExplorer/index.js b/Composer/packages/client/src/components/ProjectExplorer/index.js new file mode 100644 index 0000000000..419730e1e1 --- /dev/null +++ b/Composer/packages/client/src/components/ProjectExplorer/index.js @@ -0,0 +1,25 @@ +import React, { Fragment } from "react" +/** @jsx jsx */ +import { jsx } from "@emotion/core"; +import { ul } from "./styles"; + +export const ProjectExplorer = props => ( + +
Project Explorer
+
    + {props.files.length > 0 && + props.files.map((item, index) => { + return ( +
  • { + props.onClick(item, index); + }} + > + {item.name} +
  • + ); + })} +
+
+); diff --git a/Composer/packages/client/src/components/ProjectExplorer/styles.js b/Composer/packages/client/src/components/ProjectExplorer/styles.js new file mode 100644 index 0000000000..26f2e74c6c --- /dev/null +++ b/Composer/packages/client/src/components/ProjectExplorer/styles.js @@ -0,0 +1,5 @@ +import { css } from "@emotion/core"; + +export const ul = css` + list-style: none; +`; \ No newline at end of file diff --git a/Composer/packages/client/src/components/Tree/index.js b/Composer/packages/client/src/components/Tree/index.js index 77adb77601..d5343a71de 100644 --- a/Composer/packages/client/src/components/Tree/index.js +++ b/Composer/packages/client/src/components/Tree/index.js @@ -5,5 +5,6 @@ import { container, top } from "./styles"; export const Tree = props => (
+ {props.children}
);