mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-10-20 18:24:02 +00:00
bit clean up
This commit is contained in:
@@ -28,7 +28,7 @@ import {
|
||||
import { AreaContext, UndoRedoContext } from "../pages/editor";
|
||||
|
||||
export default function AreaOverview(props) {
|
||||
const { areas, setAreas, addArea, deleteArea } = useContext(AreaContext);
|
||||
const { areas, addArea, deleteArea, updateArea } = useContext(AreaContext);
|
||||
const { setUndoStack, setRedoStack } = useContext(UndoRedoContext);
|
||||
const [editField, setEditField] = useState({});
|
||||
const [value, setValue] = useState("");
|
||||
@@ -48,20 +48,6 @@ export default function AreaOverview(props) {
|
||||
);
|
||||
};
|
||||
|
||||
const updateArea = (aid, updatedValues) => {
|
||||
setAreas((prev) =>
|
||||
prev.map((a, i) => {
|
||||
if (aid === i) {
|
||||
return {
|
||||
...a,
|
||||
...updatedValues,
|
||||
};
|
||||
}
|
||||
return a;
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Row gutter={6}>
|
||||
@@ -134,7 +120,6 @@ export default function AreaOverview(props) {
|
||||
},
|
||||
]);
|
||||
setRedoStack([]);
|
||||
setEditField({});
|
||||
}}
|
||||
/>
|
||||
</Col>
|
||||
@@ -176,7 +161,6 @@ export default function AreaOverview(props) {
|
||||
},
|
||||
]);
|
||||
setRedoStack([]);
|
||||
setEditField({});
|
||||
updateArea(i, { color: c });
|
||||
}}
|
||||
>
|
||||
@@ -210,7 +194,6 @@ export default function AreaOverview(props) {
|
||||
},
|
||||
]);
|
||||
setRedoStack([]);
|
||||
setEditField({});
|
||||
updateArea(i, { color: c });
|
||||
}}
|
||||
>
|
||||
|
Reference in New Issue
Block a user