From fbe39f979f5b12282894779c48df6de757fbf317 Mon Sep 17 00:00:00 2001 From: jeafreezy Date: Fri, 6 Dec 2024 13:38:35 +0100 Subject: [PATCH 1/4] chore: fixed bug in model details --- frontend/src/app/providers/models-provider.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/providers/models-provider.tsx b/frontend/src/app/providers/models-provider.tsx index af814ae6..7047744a 100644 --- a/frontend/src/app/providers/models-provider.tsx +++ b/frontend/src/app/providers/models-provider.tsx @@ -306,8 +306,8 @@ export const ModelsProvider: React.FC<{ } handleChange(MODEL_CREATION_FORM_NAME.BASE_MODELS, data.base_model); - handleChange(MODEL_CREATION_FORM_NAME.MODEL_DESCRIPTION, data.description); - handleChange(MODEL_CREATION_FORM_NAME.MODEL_NAME, data.name); + handleChange(MODEL_CREATION_FORM_NAME.MODEL_DESCRIPTION, data.description ?? ''); + handleChange(MODEL_CREATION_FORM_NAME.MODEL_NAME, data.name ?? ''); handleChange( MODEL_CREATION_FORM_NAME.SELECTED_TRAINING_DATASET_ID, data.dataset, @@ -318,10 +318,10 @@ export const ModelsProvider: React.FC<{ useEffect(() => { if (!isEditMode || trainingDatasetIsPending || trainingDatasetIsError) return; - handleChange(MODEL_CREATION_FORM_NAME.DATASET_NAME, trainingDataset.name); + handleChange(MODEL_CREATION_FORM_NAME.DATASET_NAME, trainingDataset.name ?? ''); handleChange( MODEL_CREATION_FORM_NAME.TMS_URL, - trainingDataset.source_imagery, + trainingDataset.source_imagery ?? '', ); }, [ isEditMode, From 541237cbe1085bb7035c914c429bb7948db14654 Mon Sep 17 00:00:00 2001 From: jeafreezy Date: Fri, 6 Dec 2024 13:40:17 +0100 Subject: [PATCH 2/4] chore: enabled enhancement for all authenticated users --- frontend/src/app/routes/models/model-details.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/routes/models/model-details.tsx b/frontend/src/app/routes/models/model-details.tsx index c98d3f5c..2a6183c0 100644 --- a/frontend/src/app/routes/models/model-details.tsx +++ b/frontend/src/app/routes/models/model-details.tsx @@ -33,7 +33,7 @@ export const ModelDetailsPage = () => { } = useDialog(); const navigate = useNavigate(); const { data, isPending, isError, error } = useModelDetails(id as string, id !== undefined, 10000); - const { user } = useAuth(); + const { isAuthenticated } = useAuth(); useEffect(() => { if (isError) { @@ -55,7 +55,7 @@ export const ModelDetailsPage = () => { if (isPending || isError) { return ; } - const isOwner = user?.osm_id === data?.user?.osm_id; + return ( <> @@ -108,6 +108,7 @@ export const ModelDetailsPage = () => { size="medium" prefixIcon={StarStackIcon} onClick={openModelEnhancementDialog} + disabled={!isAuthenticated} /> {/* mobile */} @@ -123,7 +124,7 @@ export const ModelDetailsPage = () => { size="medium" prefixIcon={StarStackIcon} onClick={openModelEnhancementDialog} - disabled={!isOwner} + disabled={!isAuthenticated} /> Date: Fri, 6 Dec 2024 13:56:21 +0100 Subject: [PATCH 3/4] feat: enabled navigation with progress bar during enhancement --- .../model-creation/components/progress-bar.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/features/model-creation/components/progress-bar.tsx b/frontend/src/features/model-creation/components/progress-bar.tsx index ee5a68f1..73f015a6 100644 --- a/frontend/src/features/model-creation/components/progress-bar.tsx +++ b/frontend/src/features/model-creation/components/progress-bar.tsx @@ -1,6 +1,8 @@ +import { useModelsContext } from "@/app/providers/models-provider"; import CheckIcon from "@/components/ui/icons/check-icon"; import { cn } from "@/utils"; import { memo } from "react"; +import { useNavigate } from "react-router-dom"; type ProgressBarProps = { currentPath: string; @@ -10,14 +12,21 @@ type ProgressBarProps = { const ProgressBar: React.FC = memo( ({ currentPath, currentPageIndex, pages }) => { + const navigate = useNavigate(); + const { + getFullPath, isEditMode, + } = useModelsContext(); return (
- {pages.map((step) => { + {pages.map((step, index) => { const activeStep = currentPath.includes(step.path); + const isLastPage = index === pages.length - 1 return (