Skip to content

Commit

Permalink
feat: disable datasource and hazard type or disease in edit mode
Browse files Browse the repository at this point in the history
  • Loading branch information
9sneha-n committed Aug 22, 2024
1 parent b2115c8 commit dc0f541
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/webapp/components/visualisation/Visualisation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ export const Visualisation: React.FC<VisualisationProps> = React.memo(props => {
const VisualisationContainer = styled.div`
width: 100%;
height: 25rem;
border: 0.1rem solid black;
background: ${props => props.theme.palette.primary.contrastText};
border: 0.1rem solid ${props => props.theme.palette.divider};
background: ${props => props.theme.palette.background.paper};
color: ${props => props.theme.palette.text.disabled};
display: flex;
justify-content: center;
align-items: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ export function useDiseaseOutbreakEventForm(diseaseOutbreakEventId?: Id): State
setFormLabels(diseaseOutbreakEventWithOptionsData.labels);
setFormState({
kind: "loaded",
data: mapEntityToInitialFormState(diseaseOutbreakEventWithOptionsData),
data: mapEntityToInitialFormState(
diseaseOutbreakEventWithOptionsData,
!!diseaseOutbreakEventId
),
});
},
error => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export function mapTeamMemberToUser(teamMember: TeamMember): User {

// TODO: Thinking for the future about generate this FormState by iterating over Object.Keys(diseaseOutbreakEvent)
export function mapEntityToInitialFormState(
diseaseOutbreakEventWithOptions: DiseaseOutbreakEventWithOptions
diseaseOutbreakEventWithOptions: DiseaseOutbreakEventWithOptions,
editMode: boolean
): FormState {
const { diseaseOutbreakEvent, options } = diseaseOutbreakEventWithOptions;
const {
Expand Down Expand Up @@ -120,6 +121,7 @@ export function mapEntityToInitialFormState(
width: "300px",
required: true,
showIsRequired: false,
disabled: editMode,
},
],
},
Expand All @@ -142,6 +144,7 @@ export function mapEntityToInitialFormState(
: "",
required: true,
showIsRequired: false,
disabled: editMode,
},
],
},
Expand Down Expand Up @@ -196,6 +199,7 @@ export function mapEntityToInitialFormState(
width: "300px",
required: true,
showIsRequired: false,
disabled: editMode,
},
],
},
Expand Down

0 comments on commit dc0f541

Please sign in to comment.