diff --git a/src/modules/builder/configuration/AddLabelsStep/AddLabelForm.tsx b/src/modules/builder/configuration/AddLabelsStep/AddLabelForm.tsx
index 8362f62..329d340 100644
--- a/src/modules/builder/configuration/AddLabelsStep/AddLabelForm.tsx
+++ b/src/modules/builder/configuration/AddLabelsStep/AddLabelForm.tsx
@@ -1,4 +1,5 @@
import React, { useContext } from 'react';
+import { useControls } from 'react-zoom-pan-pinch';
import { CloseRounded } from '@mui/icons-material';
import CheckIcon from '@mui/icons-material/Check';
@@ -28,6 +29,9 @@ const AddLabelForm = ({
const theme = useTheme();
const { deleteLabel } = useContext(LabelsContext);
+ const { instance } = useControls();
+
+ const { scale } = instance.transformState;
return (
-
-
-
-
-
-
+
+
-
+
- {labelToDelete && (
+
+
{
- deleteLabel(labelToDelete.id);
- onClose();
+ onClick={onSubmit}
+ sx={{
+ background: theme.palette.primary.main,
+ borderRadius: 0,
}}
- sx={{ borderRadius: 0 }}
>
-
+
- )}
+ {labelToDelete && (
+ {
+ deleteLabel(labelToDelete.id);
+ onClose();
+ }}
+ sx={{ borderRadius: 0 }}
+ >
+
+
+ )}
+
diff --git a/src/modules/builder/configuration/AddLabelsStep/AddLabelWithinFrame.tsx b/src/modules/builder/configuration/AddLabelsStep/AddLabelWithinFrame.tsx
index c81d592..ab44fcd 100644
--- a/src/modules/builder/configuration/AddLabelsStep/AddLabelWithinFrame.tsx
+++ b/src/modules/builder/configuration/AddLabelsStep/AddLabelWithinFrame.tsx
@@ -1,9 +1,5 @@
import { useContext, useState } from 'react';
-import {
- TransformComponent,
- TransformWrapper,
- useControls,
-} from 'react-zoom-pan-pinch';
+import { TransformComponent, TransformWrapper } from 'react-zoom-pan-pinch';
import { Alert, Box, styled } from '@mui/material';
@@ -12,7 +8,7 @@ import { PermissionLevel } from '@graasp/sdk';
import { v4 } from 'uuid';
-import { Label, Position } from '@/@types';
+import { Label } from '@/@types';
import {
ADD_LABEL_FRAME_HEIGHT,
ADD_LABEL_FRAME_WIDTH,
@@ -40,21 +36,48 @@ const Container = styled('div')(() => ({
left: '0px',
}));
-type Props = {
- setFormPosition: (p: Position) => void;
- setContent: (s: string) => void;
- setLabelToEdit: (l: Label | null) => void;
-};
-const AddLabelWithinFrame = ({
- setFormPosition,
- setContent,
- setLabelToEdit,
-}: Props): JSX.Element => {
- const { labels, isDragging, setOpenForm } = useContext(LabelsContext);
+const AddLabelWithinFrame = (): JSX.Element => {
+ const { labels, isDragging, setOpenForm, saveLabelsChanges, openForm } =
+ useContext(LabelsContext);
+
+ const { permission } = useLocalContext();
+ const [content, setContent] = useState('');
+ const [labelToEdit, setLabelToEdit] = useState