Skip to content

Commit

Permalink
Fix a bug with default map view not working and improve survey editin…
Browse files Browse the repository at this point in the history
…g layout
  • Loading branch information
mmoila committed May 6, 2024
1 parent a05e6e1 commit 55574ef
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
3 changes: 3 additions & 0 deletions client/src/components/SurveyMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ export default function SurveyMap(props: Props) {
initializeMap();
setMapInitialized(true);
}
return () => {
setMapInitialized(false);
};
}, [isMapReady]);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/admin/EditSurveyPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { EditSurveyPageConditions } from './EditSurveyPageConditions';
import FileUpload from './FileUpload';
import SurveySections from './SurveySections';


const useStyles = makeStyles({
button: {
width: 'fit-content',
Expand Down Expand Up @@ -170,6 +169,7 @@ export default function EditSurveyPage() {
{!availableMapLayersLoading &&
availableMapLayers.map((layer) => (
<FormControlLabel
sx={{ maxWidth: '500px' }}
key={layer.id}
label={layer.name}
control={
Expand Down
22 changes: 19 additions & 3 deletions client/src/components/admin/EditSurveyPageConditions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,12 @@ export function EditSurveyPageConditions() {

return (
<Box
sx={{ dipslay: 'flex', flexDirection: 'column', marginBottom: '10px' }}
sx={{
display: 'flex',
flexDirection: 'column',
marginBottom: '10px',
maxWidth: '45rem',
}}
>
<FormControl
fullWidth
Expand All @@ -206,7 +211,9 @@ export function EditSurveyPageConditions() {
sx={{
flex: 2,
backgroundColor: 'white',
'& .MuiSelect-select': { paddingY: '0.75rem' },
'& .MuiSelect-select': {
paddingY: '0.75rem',
},
}}
onChange={(event) => {
editPage({
Expand Down Expand Up @@ -252,7 +259,16 @@ export function EditSurveyPageConditions() {
sx={{
flex: 2,
backgroundColor: 'white',
'& .MuiSelect-select': { paddingY: '0.75rem' },
overflow: 'hidden',
'& .MuiSelect-select': {
paddingY: '0.75rem',
minWidth: 0,
'& .MuiTypography-root': {
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
},
},
}}
value={
conditionList.length > 0
Expand Down
6 changes: 1 addition & 5 deletions client/src/stores/SurveyMapContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ interface State {

defaultView: GeoJSON.FeatureCollection;
oskariVersion: number;

}

type Action =
Expand Down Expand Up @@ -83,14 +82,12 @@ type Action =
value: boolean;
}
| {

type: 'SET_DEFAULT_VIEW';
value: GeoJSON.FeatureCollection;
}
| {
type: 'SET_OSKARI_VERSION';
value: number;

};

type Context = [State, React.Dispatch<Action>];
Expand All @@ -117,7 +114,6 @@ const stateDefaults: State = {

defaultView: null,
oskariVersion: null,

};

/**
Expand Down Expand Up @@ -798,7 +794,7 @@ function reducer(state: State, action: Action): State {
return {
...state,
defaultView: action.value,
}
};
case 'SET_OSKARI_VERSION':
return {
...state,
Expand Down

0 comments on commit 55574ef

Please sign in to comment.