From 27b3d67ea46faeef5f9ef5507250296ee8714b9a Mon Sep 17 00:00:00 2001 From: jeafreezy Date: Thu, 28 Nov 2024 16:56:57 +0100 Subject: [PATCH] chore: wip --- .../src/app/routes/models/confirmation.tsx | 6 +- frontend/src/app/routes/start-mapping.tsx | 3 +- .../components/ui/full-screen/full-screen.tsx | 12 --- .../src/components/ui/full-screen/index.ts | 1 - frontend/src/contents/start-mapping.ts | 3 +- .../components/dialogs/file-upload-dialog.tsx | 12 ++- .../training-area/open-area-map.tsx | 2 +- .../training-area/training-area-item.tsx | 13 +-- .../training-area/training-area-list.tsx | 50 +++++---- .../training-area/training-area-map.tsx | 102 +++++++----------- .../training-area/training-area.tsx | 95 ++++++++-------- .../features/start-mapping/components/map.tsx | 70 ++++++------ .../start-mapping/components/model-action.tsx | 1 - .../start-mapping/components/model-header.tsx | 13 ++- frontend/src/styles/index.css | 6 ++ 15 files changed, 189 insertions(+), 200 deletions(-) delete mode 100644 frontend/src/components/ui/full-screen/full-screen.tsx delete mode 100644 frontend/src/components/ui/full-screen/index.ts diff --git a/frontend/src/app/routes/models/confirmation.tsx b/frontend/src/app/routes/models/confirmation.tsx index 6dc24f63..9d1f627f 100644 --- a/frontend/src/app/routes/models/confirmation.tsx +++ b/frontend/src/app/routes/models/confirmation.tsx @@ -14,7 +14,11 @@ export const ModelConfirmationPage = () => { const { isEditMode } = useModelsContext(); return ( -
+
{ />
-
+
{ - return ( -
- {/* Override the root layout padding */} - {children} -
- ); -}; - -export default FullSreenWidthComponent; diff --git a/frontend/src/components/ui/full-screen/index.ts b/frontend/src/components/ui/full-screen/index.ts deleted file mode 100644 index fd6b308f..00000000 --- a/frontend/src/components/ui/full-screen/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default as FullSreenWidthComponent } from "./full-screen"; diff --git a/frontend/src/contents/start-mapping.ts b/frontend/src/contents/start-mapping.ts index 9bf4f9b9..2e85479c 100644 --- a/frontend/src/contents/start-mapping.ts +++ b/frontend/src/contents/start-mapping.ts @@ -40,7 +40,8 @@ export const START_MAPPING_CONTENT = { options: { allFeatures: "All Features as GeoJSON", acceptedFeatures: "Accepted Features Only", - openInJOSM: "Open in JOSM", + openAllFeaturesInJOSM: "Open All Features in JOSM", + openAcceptedFeaturesInJOSM: "Open All Features in JOSM", }, }, predictionInProgress: "running", diff --git a/frontend/src/features/model-creation/components/dialogs/file-upload-dialog.tsx b/frontend/src/features/model-creation/components/dialogs/file-upload-dialog.tsx index 7f9c0a19..c7d62fbe 100644 --- a/frontend/src/features/model-creation/components/dialogs/file-upload-dialog.tsx +++ b/frontend/src/features/model-creation/components/dialogs/file-upload-dialog.tsx @@ -174,9 +174,13 @@ const FileUploadDialog: React.FC = ({ className="border-2 border-gray-border rounded-lg px-3.5 py-1 flex items-center text-gray justify-between w-full" >
- + + +
-

{truncateString(file.file.name)}

+

+ {truncateString(file.file.name)} +

@@ -204,7 +208,9 @@ const FileUploadDialog: React.FC = ({ {isDragActive ? ( -

Drop the files here ...

+

+ Drop the files here ... +

) : ( <>

diff --git a/frontend/src/features/model-creation/components/training-area/open-area-map.tsx b/frontend/src/features/model-creation/components/training-area/open-area-map.tsx index a262c1ec..f78dd6a8 100644 --- a/frontend/src/features/model-creation/components/training-area/open-area-map.tsx +++ b/frontend/src/features/model-creation/components/training-area/open-area-map.tsx @@ -31,7 +31,7 @@ const OpenAerialMap = ({ tileJSONURL }: { tileJSONURL: string }) => { }, [map, fitToTMSBounds]); return ( -

+

{MODEL_CREATION_CONTENT.trainingArea.form.openAerialMap}

diff --git a/frontend/src/features/model-creation/components/training-area/training-area-item.tsx b/frontend/src/features/model-creation/components/training-area/training-area-item.tsx index fe804b2c..85b0b000 100644 --- a/frontend/src/features/model-creation/components/training-area/training-area-item.tsx +++ b/frontend/src/features/model-creation/components/training-area/training-area-item.tsx @@ -194,8 +194,6 @@ const TrainingAreaItem: React.FC< : "0 m²"; }, [trainingArea]); - - const createTrainingLabelsForAOI = useCreateTrainingLabelsForAOI({}); const fileUploadHandler = async (geometry: Geometry) => { @@ -230,15 +228,18 @@ const TrainingAreaItem: React.FC< ? "Fetching labels..." : trainingArea.properties.label_fetched !== null ? truncateString( - `Fetched ${timeSinceLabelFetch === "0 sec" ? "just now" : `${timeSinceLabelFetch} ago`}`, - 20, - ) + `Fetched ${timeSinceLabelFetch === "0 sec" ? "just now" : `${timeSinceLabelFetch} ago`}`, + 20, + ) : "No labels yet"}

+ content={ + MODEL_CREATION_CONTENT.trainingArea.toolTips.fetchOSMLabels + } + >
- +
+ +
); }; diff --git a/frontend/src/features/start-mapping/components/map.tsx b/frontend/src/features/start-mapping/components/map.tsx index 72ee9c6b..60cd5831 100644 --- a/frontend/src/features/start-mapping/components/map.tsx +++ b/frontend/src/features/start-mapping/components/map.tsx @@ -73,8 +73,9 @@ const StartMappingMapComponent = ({ map?.fitBounds(oamTileJSON?.bounds); }, [map, oamTileJSON?.bounds]); - const { tooltipPosition, tooltipVisible } = - useToolTipVisibility([currentZoom]); + const { tooltipPosition, tooltipVisible } = useToolTipVisibility([ + currentZoom, + ]); useEffect(() => { if (!oamTileJSONIsError) return; @@ -269,7 +270,8 @@ const StartMappingMapComponent = ({ ), [selectedEvent, trainingDataset], ); - const showTooltip = currentZoom < MIN_ZOOM_LEVEL_FOR_PREDICTION && tooltipVisible; + const showTooltip = + currentZoom < MIN_ZOOM_LEVEL_FOR_PREDICTION && tooltipVisible; return ( 0 ? [ - { - value: - APPLICATION_CONTENTS.START_MAPPING.map.controls.legendControl - .acceptedPredictions, - subLayers: [ - ACCEPTED_MODEL_PREDICTIONS_FILL_LAYER_ID, - ACCEPTED_MODEL_PREDICTIONS_OUTLINE_LAYER_ID, - ], - }, - ] + { + value: + APPLICATION_CONTENTS.START_MAPPING.map.controls.legendControl + .acceptedPredictions, + subLayers: [ + ACCEPTED_MODEL_PREDICTIONS_FILL_LAYER_ID, + ACCEPTED_MODEL_PREDICTIONS_OUTLINE_LAYER_ID, + ], + }, + ] : []), ...(modelPredictions.rejected.length > 0 ? [ - { - value: - APPLICATION_CONTENTS.START_MAPPING.map.controls.legendControl - .rejectedPredictions, - subLayers: [ - REJECTED_MODEL_PREDICTIONS_FILL_LAYER_ID, - REJECTED_MODEL_PREDICTIONS_OUTLINE_LAYER_ID, - ], - }, - ] + { + value: + APPLICATION_CONTENTS.START_MAPPING.map.controls.legendControl + .rejectedPredictions, + subLayers: [ + REJECTED_MODEL_PREDICTIONS_FILL_LAYER_ID, + REJECTED_MODEL_PREDICTIONS_OUTLINE_LAYER_ID, + ], + }, + ] : []), ...(modelPredictions.all.length > 0 ? [ - { - value: - APPLICATION_CONTENTS.START_MAPPING.map.controls.legendControl - .predictionResults, - subLayers: [ - ALL_MODEL_PREDICTIONS_FILL_LAYER_ID, - ALL_MODEL_PREDICTIONS_OUTLINE_LAYER_ID, - ], - }, - ] + { + value: + APPLICATION_CONTENTS.START_MAPPING.map.controls.legendControl + .predictionResults, + subLayers: [ + ALL_MODEL_PREDICTIONS_FILL_LAYER_ID, + ALL_MODEL_PREDICTIONS_OUTLINE_LAYER_ID, + ], + }, + ] : []), ]} > @@ -340,7 +342,7 @@ const StartMappingMapComponent = ({ )} {MINIMUM_ZOOM_LEVEL_INSTRUCTION_FOR_PREDICTION} diff --git a/frontend/src/features/start-mapping/components/model-action.tsx b/frontend/src/features/start-mapping/components/model-action.tsx index 094fd0b2..5d5b6321 100644 --- a/frontend/src/features/start-mapping/components/model-action.tsx +++ b/frontend/src/features/start-mapping/components/model-action.tsx @@ -1,7 +1,6 @@ import { TModelPredictions } from "@/types"; import { MIN_ZOOM_LEVEL_FOR_PREDICTION, - showErrorToast, showSuccessToast, uuid4, diff --git a/frontend/src/features/start-mapping/components/model-header.tsx b/frontend/src/features/start-mapping/components/model-header.tsx index fce9a968..42c57366 100644 --- a/frontend/src/features/start-mapping/components/model-header.tsx +++ b/frontend/src/features/start-mapping/components/model-header.tsx @@ -93,9 +93,18 @@ const ModelHeader = ({ }, { name: APPLICATION_CONTENTS.START_MAPPING.buttons.download.options - .openInJOSM, + .openAllFeaturesInJOSM, value: - APPLICATION_CONTENTS.START_MAPPING.buttons.download.options.openInJOSM, + APPLICATION_CONTENTS.START_MAPPING.buttons.download.options + .openAllFeaturesInJOSM, + onClick: handleOpenInJOSM, + }, + { + name: APPLICATION_CONTENTS.START_MAPPING.buttons.download.options + .openAcceptedFeaturesInJOSM, + value: + APPLICATION_CONTENTS.START_MAPPING.buttons.download.options + .openAcceptedFeaturesInJOSM, onClick: handleOpenInJOSM, }, ]; diff --git a/frontend/src/styles/index.css b/frontend/src/styles/index.css index 267deb75..a02aee9c 100644 --- a/frontend/src/styles/index.css +++ b/frontend/src/styles/index.css @@ -150,6 +150,12 @@ sl-alert.success::part(base) { .map-icon { @apply inline-block h-4 w-4 p-2; } + .fullscreen { + @apply -mx-[1.25rem] lg:-mx-[5rem]; + } + .no-fullscreen { + @apply -mx-0 lg:-mx-0; + } } /* Tailwind styles ends */