Add issues panel

This commit is contained in:
1ilit 2023-09-19 15:49:13 +03:00
parent 9b8e6c2593
commit 973db157af
2 changed files with 35 additions and 71 deletions

View File

@ -10,6 +10,7 @@ import AreaOverview from "./area_overview";
import { Tab } from "../data/data"; import { Tab } from "../data/data";
import { TabContext } from "../pages/editor"; import { TabContext } from "../pages/editor";
import NotesOverview from "./notes_overview"; import NotesOverview from "./notes_overview";
import Issues from "./issues";
const myTheme = createTheme({ const myTheme = createTheme({
dark: "light", dark: "light",
@ -27,7 +28,7 @@ const myTheme = createTheme({
const EditorPanel = (props) => { const EditorPanel = (props) => {
// const map = useRef(new Map()); // const map = useRef(new Map());
const {tab, setTab} = useContext(TabContext); const { tab, setTab } = useContext(TabContext);
const tabList = [ const tabList = [
{ tab: "Tables", itemKey: Tab.tables }, { tab: "Tables", itemKey: Tab.tables },
@ -42,7 +43,7 @@ const EditorPanel = (props) => {
setSelectedTable={props.setSelectedTable} setSelectedTable={props.setSelectedTable}
/>, />,
<ReferenceOverview />, <ReferenceOverview />,
<AreaOverview/>, <AreaOverview />,
<CodeMirror <CodeMirror
value={props.code} value={props.code}
height="100%" height="100%"
@ -52,79 +53,30 @@ const EditorPanel = (props) => {
props.setCode(e); props.setCode(e);
}} }}
/>, />,
<NotesOverview/> <NotesOverview />,
]; ];
return ( return (
<div className="flex h-full"> <div className="flex h-full">
<div style={{ width: `${props.width}px` }} className="overflow-y-auto"> <div className="flex flex-col h-full relative">
<Tabs <div className="h-full flex-1 overflow-y-auto">
type="card" <div style={{ width: `${props.width}px` }}>
activeKey={tab} <Tabs
tabList={tabList} type="card"
onChange={(key) => { activeKey={tab}
setTab(key); tabList={tabList}
}} onChange={(key) => {
collapsible setTab(key);
> }}
<div className="p-2">{contentList[parseInt(tab) - 1]}</div> collapsible
</Tabs> >
<br /> <div className="p-2">{contentList[parseInt(tab) - 1]}</div>
<button </Tabs>
onClick={() => { </div>
const blob = new Blob([props.code], { </div>
type: "text/plain;charset=utf-8", <div className="mt-auto border-t-2 border-gray-300">
}); <Issues />
window.saveAs(blob, "src.txt"); </div>
}}
>
export src
</button>
<br />
<button
onClick={() => {
// try {
// const parser = new Parser();
// const ast = parser.astify(props.code);
// console.log(ast);
// ast.forEach((e) => {
// e.table.forEach((t) => {
// if (map.current.has(t.table)) {
// return;
// }
// map.current.set(t.table, t);
// const newTable = {
// id: props.tables.length,
// name: `table_${props.tables.length}`,
// x: 0,
// y: 0,
// fields: [
// {
// name: "id",
// type: "UUID",
// default: "",
// check: "",
// primary: true,
// unique: true,
// notNull: true,
// increment: true,
// comment: "",
// },
// ],
// comment: "",
// indices: [],
// color: defaultTableTheme,
// };
// props.setTables((prev) => [...prev, newTable]);
// });
// });
// } catch (e) {
// alert("parsing error");
// }
}}
>
parse
</button>
</div> </div>
<div <div
className={`flex justify-center items-center p-1 h-auto hover:bg-slate-300 cursor-col-resize ${ className={`flex justify-center items-center p-1 h-auto hover:bg-slate-300 cursor-col-resize ${

12
src/components/issues.jsx Normal file
View File

@ -0,0 +1,12 @@
import React from "react";
import { Collapse } from "@douyinfe/semi-ui";
export default function Issues() {
return <div>
<Collapse>
<Collapse.Panel header="Issues" itemKey="1">
hi
</Collapse.Panel>
</Collapse>
</div>;
}