Skip to content

Commit

Permalink
Remove roleUtils file
Browse files Browse the repository at this point in the history
  • Loading branch information
testower committed Dec 13, 2024
1 parent 972c33a commit c030d5c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
3 changes: 1 addition & 2 deletions src/components/EditStopPage/ModalitiesMenuItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ limitations under the Licence. */
import React from "react";
import MenuItem from "@mui/material/MenuItem";
import ModalityIconSvg from "../MainPage/ModalityIconSvg";
import ArrowDropRight from "@mui/icons-material/ArrowRight";
import { getInverseSubmodesWhitelist } from "../../utils/roleUtils";
import { getInverseSubmodesWhitelist } from "../../models/submodes";
import { getStopPlacesForSubmodes } from "../../utils/roleUtils";
import MoreMenuItem from "../MainPage/MoreMenuItem";

Expand Down
2 changes: 1 addition & 1 deletion src/components/Map/NeighbourMarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import ReactDOM from "react-dom/server";
import CustomMarkerIcon from "./CustomMarkerIcon";
import { shallowCompareNeighbourMarker as shallowCompare } from "./shallowCompare/";
import PopupButton from "./PopupButton";
import { isLegalChildStopPlace } from "../../utils/roleUtils";
import { isLegalChildStopPlace } from "../../modelUtils/leafletUtils";
import { connect } from "react-redux";

class NeighbourMarker extends React.Component {
Expand Down
9 changes: 8 additions & 1 deletion src/modelUtils/leafletUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ See the Licence for the specific language governing permissions and
limitations under the Licence. */

import { LatLng } from "leaflet";
import { isLegalChildStopPlace } from "../utils/roleUtils";

export const getUniquePathLinks = (a, key) => {
var seen = {};
Expand Down Expand Up @@ -121,3 +120,11 @@ export const getGroupMemberSuggestions = (

return legalSuggestions.slice(0, nFirst);
};

export const isLegalChildStopPlace = (stopPlace) => {
if (!stopPlace) {
return false;
}

return stopPlace.permissions?.canEdit || false;
};
4 changes: 4 additions & 0 deletions src/models/submodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ export const submodes = [
"telecabin",
"funicular",
];

export const getInverseSubmodesWhitelist = (whitelist) => {
return submodes.filter((submode) => whitelist.indexOf(submode) === -1);
};
13 changes: 0 additions & 13 deletions src/utils/roleUtils.js

This file was deleted.

0 comments on commit c030d5c

Please sign in to comment.