finish refactor pre merge
This commit is contained in:
@@ -3,12 +3,11 @@
|
||||
import { useState } from "react";
|
||||
import CommitTreePopup from "@/components/CommitTreePopup";
|
||||
import { UndoAction } from "@/lib/useEditorState";
|
||||
|
||||
type Mode = "draw" | "select" | "idle" | "add-point" | "add-line" | "add-path" | "add-circle";
|
||||
import type { EditorMode } from "@/lib/editor/session/sessionTypes";
|
||||
|
||||
type Props = {
|
||||
mode: Mode;
|
||||
setMode: (mode: Mode) => void;
|
||||
mode: EditorMode;
|
||||
setMode: (mode: EditorMode) => void;
|
||||
entityStatus?: string | null;
|
||||
onUndo: () => void;
|
||||
onCommit: () => void;
|
||||
@@ -103,12 +102,13 @@ export default function Editor({
|
||||
createdEntities,
|
||||
createdGeometries,
|
||||
}: Props) {
|
||||
// Bật/tắt popup cây commit.
|
||||
const [isCommitTreeOpen, setIsCommitTreeOpen] = useState(false);
|
||||
|
||||
const formatCommitTitle = (commit: Props["commits"][number]) =>
|
||||
commit.title?.trim() || `Commit #${commit.commit_no}`;
|
||||
|
||||
const toggleMode = (newMode: Mode) => {
|
||||
const toggleMode = (newMode: EditorMode) => {
|
||||
if (mode === newMode) {
|
||||
setMode("idle"); // bấm lại → tắt
|
||||
} else {
|
||||
@@ -129,7 +129,7 @@ export default function Editor({
|
||||
return labels.reverse();
|
||||
})();
|
||||
|
||||
const getButtonStyle = (btnMode: Mode) => ({
|
||||
const getButtonStyle = (btnMode: EditorMode) => ({
|
||||
width: "100%",
|
||||
padding: "8px",
|
||||
marginBottom: "6px",
|
||||
|
||||
Reference in New Issue
Block a user