From 8a4515ebf71604951bea59c6164348f761c530d8 Mon Sep 17 00:00:00 2001
From: jeafreezy
Date: Sat, 16 Nov 2024 03:42:28 +0000
Subject: [PATCH] chore: fixed training area leayout
---
.../components/layouts/model-forms-layout.tsx | 74 +++++++++----------
.../training-area/training-area-map.tsx | 4 +-
.../training-area/training-area.tsx | 42 +++++------
frontend/src/utils/content.ts | 1 +
4 files changed, 60 insertions(+), 61 deletions(-)
diff --git a/frontend/src/components/layouts/model-forms-layout.tsx b/frontend/src/components/layouts/model-forms-layout.tsx
index ae1daa35..e7df4e1a 100644
--- a/frontend/src/components/layouts/model-forms-layout.tsx
+++ b/frontend/src/components/layouts/model-forms-layout.tsx
@@ -26,43 +26,43 @@ const pages: {
icon: React.ElementType;
path: string;
}[] = [
- {
- id: 1,
- title: MODEL_CREATION_CONTENT.progressStepper.modelDetails,
- icon: TagsIcon,
- path: APPLICATION_ROUTES.CREATE_NEW_MODEL,
- },
- {
- id: 2,
- title: MODEL_CREATION_CONTENT.progressStepper.trainingDataset,
- icon: DatabaseIcon,
- path: APPLICATION_ROUTES.CREATE_NEW_MODEL_TRAINING_DATASET,
- },
- {
- id: 3,
- title: MODEL_CREATION_CONTENT.progressStepper.trainingArea,
- icon: SquareShadowIcon,
- path: APPLICATION_ROUTES.CREATE_NEW_MODEL_TRAINING_AREA,
- },
- {
- id: 4,
- title: MODEL_CREATION_CONTENT.progressStepper.trainingSettings,
- icon: SettingsIcon,
- path: APPLICATION_ROUTES.CREATE_NEW_MODEL_TRAINING_SETTINGS,
- },
- {
- id: 5,
- title: MODEL_CREATION_CONTENT.progressStepper.submitModel,
- icon: CloudIcon,
- path: APPLICATION_ROUTES.CREATE_NEW_MODEL_SUMMARY,
- },
- {
- id: 6,
- title: MODEL_CREATION_CONTENT.progressStepper.confirmation,
- icon: StarIcon,
- path: APPLICATION_ROUTES.CREATE_NEW_MODEL_CONFIRMATION,
- },
-];
+ {
+ id: 1,
+ title: MODEL_CREATION_CONTENT.progressStepper.modelDetails,
+ icon: TagsIcon,
+ path: APPLICATION_ROUTES.CREATE_NEW_MODEL,
+ },
+ {
+ id: 2,
+ title: MODEL_CREATION_CONTENT.progressStepper.trainingDataset,
+ icon: DatabaseIcon,
+ path: APPLICATION_ROUTES.CREATE_NEW_MODEL_TRAINING_DATASET,
+ },
+ {
+ id: 3,
+ title: MODEL_CREATION_CONTENT.progressStepper.trainingArea,
+ icon: SquareShadowIcon,
+ path: APPLICATION_ROUTES.CREATE_NEW_MODEL_TRAINING_AREA,
+ },
+ {
+ id: 4,
+ title: MODEL_CREATION_CONTENT.progressStepper.trainingSettings,
+ icon: SettingsIcon,
+ path: APPLICATION_ROUTES.CREATE_NEW_MODEL_TRAINING_SETTINGS,
+ },
+ {
+ id: 5,
+ title: MODEL_CREATION_CONTENT.progressStepper.submitModel,
+ icon: CloudIcon,
+ path: APPLICATION_ROUTES.CREATE_NEW_MODEL_SUMMARY,
+ },
+ {
+ id: 6,
+ title: MODEL_CREATION_CONTENT.progressStepper.confirmation,
+ icon: StarIcon,
+ path: APPLICATION_ROUTES.CREATE_NEW_MODEL_CONFIRMATION,
+ },
+ ];
const ModelCreationLayout = () => {
const { pathname } = useLocation();
diff --git a/frontend/src/features/model-creation/components/training-area/training-area-map.tsx b/frontend/src/features/model-creation/components/training-area/training-area-map.tsx
index eb31f443..1b62f9cb 100644
--- a/frontend/src/features/model-creation/components/training-area/training-area-map.tsx
+++ b/frontend/src/features/model-creation/components/training-area/training-area-map.tsx
@@ -62,7 +62,7 @@ const TrainingAreaMap = ({
const [featureArea, setFeatureArea] = useState(0);
- const { setTooltipVisible, tooltipPosition } = useToolTipVisibility([
+ const { setTooltipVisible, tooltipPosition, tooltipVisible } = useToolTipVisibility([
drawingMode,
currentZoom,
]);
@@ -376,7 +376,7 @@ const TrainingAreaMap = ({
const showTooltip = Boolean(
drawingMode === DrawingModes.RECTANGLE || showLabelsToolTip,
- );
+ ) && tooltipVisible;
const getTooltipColor = () => {
if (featureArea !== 0) {
diff --git a/frontend/src/features/model-creation/components/training-area/training-area.tsx b/frontend/src/features/model-creation/components/training-area/training-area.tsx
index 9f0ef5d0..ab8dff81 100644
--- a/frontend/src/features/model-creation/components/training-area/training-area.tsx
+++ b/frontend/src/features/model-creation/components/training-area/training-area.tsx
@@ -13,13 +13,12 @@ import TrainingAreaList from "@/features/model-creation/components/training-area
import { useGetTrainingAreas } from "@/features/model-creation/hooks/use-training-areas";
import OpenAerialMap from "@/features/model-creation/components/training-area/open-area-map";
import { useMap } from "@/app/providers/map-provider";
-import { useToastNotification } from "@/hooks/use-toast-notification";
-import { MODEL_CREATION_CONTENT } from "@/utils";
+import { MODEL_CREATION_CONTENT, showSuccessToast, TOAST_NOTIFICATIONS } from "@/utils";
import { DrawingModes } from "@/enums";
const TrainingAreaForm = () => {
const { formData } = useModelsContext();
- const toast = useToastNotification();
+
const tileJSONURL = formData.tmsURL.split("/{z}/{x}/{y}")[0];
const { closeDialog, isOpened, toggle } = useDialog();
@@ -69,8 +68,8 @@ const TrainingAreaForm = () => {
-
-
+
+
{
offset={offset}
/>
-
+
{
datasetId={Number(formData.selectedTrainingDatasetId)}
/>
-
+
+
+