diff --git a/src/components/ControlPanel.jsx b/src/components/ControlPanel.jsx index 246da4e..11dcb91 100644 --- a/src/components/ControlPanel.jsx +++ b/src/components/ControlPanel.jsx @@ -2,7 +2,6 @@ import { useContext, useState } from "react"; import { IconCaretdown, IconChevronRight, - IconShareStroked, IconChevronUp, IconChevronDown, IconCheckboxTick, @@ -16,8 +15,6 @@ import { import { Link } from "react-router-dom"; import icon from "../assets/icon_dark_64.png"; import { - Avatar, - AvatarGroup, Button, Divider, Dropdown, @@ -30,8 +27,12 @@ import { Upload, Banner, Toast, - TagInput, + SideSheet, + List, } from "@douyinfe/semi-ui"; +import timeLine from "../assets/process.png"; +import timeLineDark from "../assets/process_dark.png"; +import todo from "../assets/calendar.png"; import { toPng, toJpeg, toSvg } from "html-to-image"; import { saveAs } from "file-saver"; import { @@ -64,6 +65,7 @@ import { Editor } from "@monaco-editor/react"; import { db } from "../data/db"; import { useLiveQuery } from "dexie-react-hooks"; import { socket } from "../data/socket"; +import Todo from "./Todo"; export default function ControlPanel({ diagramId, @@ -90,8 +92,14 @@ export default function ControlPanel({ ERROR: 2, OK: 3, }; + const SIDESHEET = { + NONE: 0, + TODO: 1, + TIMELINE: 2, + }; const diagrams = useLiveQuery(() => db.diagrams.toArray()); const [visible, setVisible] = useState(MODAL.NONE); + const [sidesheet, setSidesheet] = useState(SIDESHEET.NONE); const [prevTitle, setPrevTitle] = useState(title); const [saveAsTitle, setSaveAsTitle] = useState(title); const [selectedDiagramId, setSelectedDiagramId] = useState(0); @@ -1066,10 +1074,6 @@ export default function ControlPanel({ function: () => setLayout((prev) => ({ ...prev, issues: !prev.issues })), }, - Services: { - function: () => - setLayout((prev) => ({ ...prev, services: !prev.services })), - }, "Strict mode": { function: viewStrictMode, shortcut: "Ctrl+Shift+M", @@ -1584,9 +1588,85 @@ export default function ControlPanel({ > {getModalBody()} + { + setSidesheet(SIDESHEET.NONE); + }} + width={340} + title={getTitle(sidesheet)} + style={{ paddingBottom: "16px" }} + bodyStyle={{ padding: "0px" }} + > + {getContent(sidesheet)} + ); + function getTitle(type) { + switch (type) { + case SIDESHEET.TIMELINE: + return ( +
+ chat icon +
Timeline
+
+ ); + case SIDESHEET.TODO: + return ( +
+ todo icon +
To-do list
+
+ ); + default: + break; + } + } + + function getContent(type) { + switch (type) { + case SIDESHEET.TIMELINE: + return renderTimeline(); + case SIDESHEET.TODO: + return ; + default: + break; + } + } + + function renderTimeline() { + if (undoStack.length > 0) { + return ( + + {[...undoStack].reverse().map((e, i) => ( + +
+ +
{e.message}
+
+
+ ))} +
+ ); + } else { + return ( +
+ No activity was recorded. You have not added anything to your diagram + yet. +
+ ); + } + } + function toolbar() { return (
@@ -1719,9 +1799,14 @@ export default function ControlPanel({ - - + + +
@@ -1915,19 +2000,6 @@ export default function ControlPanel({ > Issues - - - ) : ( -
- ) - } - onClick={() => invertLayout("services")} - > - Services -
)} - {layout.services && ( - - - - - - )}