Skip to content

Commit

Permalink
fix: fixing some issues derived from the review
Browse files Browse the repository at this point in the history
  • Loading branch information
FritzHoing committed Jan 2, 2025
1 parent fa7e482 commit c861dc6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/components/StylingDrawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export const StylingDrawer: React.FC<StylingDrawerProps> = ({
} = useTranslation();

useEffect(() => {

if (!layerUid) {
setIsImageLayer(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export const LayerTreeContextMenu: React.FC<LayerTreeContextMenuProps> = ({
t
} = useTranslation();

const drawerVisibilty = useAppSelector(state => state.stylingDrawerVisibility);
const downloadConfig: DownloadConfig[] = layer.get('downloadConfig') ?? null;
const allowedEditMode = useAppSelector(
state => state.editFeature.userEditMode
Expand Down Expand Up @@ -257,8 +256,10 @@ export const LayerTreeContextMenu: React.FC<LayerTreeContextMenuProps> = ({
};

const configureStyles = () => {
dispatch(setStylingDrawerVisibility(true));
dispatch(setStylingDrawerLayerUid(getUid(layer)));
if (layer) {
dispatch(setStylingDrawerVisibility(true));
dispatch(setStylingDrawerLayerUid(getUid(layer)));
}
};

const dropdownMenuItems: ItemType[] = [];
Expand Down Expand Up @@ -324,7 +325,7 @@ export const LayerTreeContextMenu: React.FC<LayerTreeContextMenuProps> = ({
}
if (isGeoserverLayer) {
dropdownMenuItems.push({
label: 'Geostyler',
label: t('LayerTreeContextMenu.styleLayer'),
key: 'geostyler'
});
}
Expand Down
6 changes: 4 additions & 2 deletions src/i18n/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ export default {
hideLegend: 'Legende ausblenden',
downloadLayer: 'Layer exportieren ({{formatName}})',
editLayer: 'Layer bearbeiten',
layerDetails: 'Eigenschaften'
layerDetails: 'Eigenschaften',
styleLayer: 'Layer Stil'
},
LayerDetailsModal: {
title: 'Eigenschaften des Layers {{layerName}}',
Expand Down Expand Up @@ -386,7 +387,8 @@ export default {
hideLegend: 'Hide legend',
downloadLayer: 'Export layer as {{formatName}}',
editLayer: 'Edit layer',
layerDetails: 'Properties'
layerDetails: 'Properties',
styleLayer: 'Layer style'
},
LayerDetailsModal: {
title: 'Properties of layer {{layerName}}',
Expand Down
8 changes: 3 additions & 5 deletions src/utils/geoserverUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,13 @@ export const fetchGeoserverStyle = async (
}
};

export const getLayerUrl = (layerSource: Source | undefined): string | false => {
if (!layerSource) {
return false;
}
export const getLayerUrl = (layerSource: Source | undefined): string | undefined => {

let url: string | undefined;
if (layerSource instanceof TileWMS || layerSource instanceof ImageWMS) {
url = layerSource instanceof TileWMS ? layerSource.getUrls()?.[0] : layerSource.getUrl();
}
return url || false;
return url || undefined;
};

export const checkIfGeoserverLayer = (layerSource: Source | undefined): boolean => {
Expand Down

0 comments on commit c861dc6

Please sign in to comment.