Skip to content

Commit

Permalink
fix: merge conflict fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aryalsaurav committed Dec 11, 2024
2 parents 8122ecd + 24e4984 commit 28d3daa
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 29 deletions.
48 changes: 21 additions & 27 deletions src/backend/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const CreateprojectLayout = () => {
const regulatorEmails = useTypedSelector(
state => state.createproject.regulatorEmails,
);
const demType = useTypedSelector(state => state.createproject.demType);

const initialState: FieldValues = {
name: '',
Expand Down Expand Up @@ -305,7 +306,7 @@ const CreateprojectLayout = () => {
formData.append('project_info', JSON.stringify({ ...refactoredData }));
formData.append('image', projectImage.projectMapImage);

if (isTerrainFollow) {
if (isTerrainFollow && demType === 'manual') {
formData.append('dem', data?.dem?.[0]?.file);
}
createProject(formData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { useTypedDispatch, useTypedSelector } from '@Store/hooks';
import { FormControl, Label, Input } from '@Components/common/FormUI';
import ErrorMessage from '@Components/common/FormUI/ErrorMessage';
import { UseFormPropsType } from '@Components/common/FormUI/types';
import { setCreateProjectState } from '@Store/actions/createproject';
import {
setCreateProjectState,
setDemType,
} from '@Store/actions/createproject';
import hasErrorBoundary from '@Utils/hasErrorBoundary';
import { useQuery } from '@tanstack/react-query';
import { getDroneAltitude } from '@Services/createproject';
Expand All @@ -12,6 +15,7 @@ import { FlexRow } from '@Components/common/Layouts';
import Switch from '@Components/RadixComponents/Switch';
import FileUpload from '@Components/common/UploadArea';
import {
demFileOptions,
FinalOutputOptions,
imageMergeTypeOptions,
measurementTypeOptions,
Expand All @@ -27,6 +31,7 @@ import {
} from '@Utils/index';
import SwitchTab from '@Components/common/SwitchTab';
import { Controller } from 'react-hook-form';
import RadioButton from '@Components/common/RadioButton';

import OutputOptions from './OutputOptions';

Expand Down Expand Up @@ -55,6 +60,7 @@ const KeyParameters = ({ formProps }: { formProps: UseFormPropsType }) => {
state => state.createproject.imageMergeType,
);
const projectCountry = useTypedSelector(state => state.common.projectCountry);
const demType = useTypedSelector(state => state.createproject.demType);

const { data: droneAltitude } = useQuery({
queryKey: ['drone-altitude', projectCountry],
Expand Down Expand Up @@ -363,6 +369,23 @@ const KeyParameters = ({ formProps }: { formProps: UseFormPropsType }) => {
</FlexRow>
</FormControl>
{isTerrainFollow && (
<FormControl className="naxatw-mt-2">
<RadioButton
required
topic="Approval for task lock"
options={demFileOptions}
direction="column"
onChangeData={value => {
dispatch(setDemType(value));
}}
value={demType}
// name="requireApprovalFromManagerForLocking"
/>
<ErrorMessage message={errors?.dem?.message as string} />
</FormControl>
)}

{demType === 'manual' && (
<FormControl className="naxatw-mt-2">
<Controller
control={control}
Expand Down
5 changes: 5 additions & 0 deletions src/frontend/src/constants/createProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -312,3 +312,8 @@ export const taskGenerationGuidelines = {
sized based on the drone equipment and parameters being used. This will
also reduce the chances of RC lagging while flying the drone.`,
};

export const demFileOptions = [
{ name: 'Auto DEM File', label: 'Auto DEM File', value: 'auto' },
{ name: 'Upload DEM File', label: 'Upload DEM File', value: 'manual' },
];
1 change: 1 addition & 0 deletions src/frontend/src/store/actions/createproject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export const {
setCreateProjectState,
resetUploadedAndDrawnAreas,
saveProjectImageFile,
setDemType,
} = createProjectSlice.actions;
10 changes: 10 additions & 0 deletions src/frontend/src/store/slices/createproject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface CreateProjectState {
ProjectsFilterByOwner: 'yes' | 'no';
requiresApprovalFromRegulator: 'required' | 'not_required';
regulatorEmails: string[] | [];
demType: string;
}

const initialState: CreateProjectState = {
Expand All @@ -51,6 +52,7 @@ const initialState: CreateProjectState = {
ProjectsFilterByOwner: 'no',
requiresApprovalFromRegulator: 'not_required',
regulatorEmails: [],
demType: 'auto',
};

const setCreateProjectState: CaseReducer<
Expand All @@ -69,6 +71,13 @@ const saveProjectImageFile: CaseReducer<
projectMapImage: action.payload,
});

const setDemType: CaseReducer<CreateProjectState, PayloadAction<string>> = (
state,
action,
) => ({
...state,
demType: action.payload,
});
const resetUploadedAndDrawnAreas: CaseReducer<CreateProjectState> = state => ({
...state,
isNoflyzonePresent: initialState.isNoflyzonePresent,
Expand All @@ -88,6 +97,7 @@ const createProjectSlice = createSlice({
setCreateProjectState,
saveProjectImageFile,
resetUploadedAndDrawnAreas,
setDemType,
},
});

Expand Down

0 comments on commit 28d3daa

Please sign in to comment.