Skip to content

Commit

Permalink
Merge pull request #377 from selankon/feature/fix_locate_view
Browse files Browse the repository at this point in the history
Feature/fix locate view
  • Loading branch information
selankon authored May 3, 2023
2 parents 9dd8b6e + 09484df commit 5113561
Show file tree
Hide file tree
Showing 18 changed files with 329 additions and 473 deletions.
68 changes: 38 additions & 30 deletions package-lock.json

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

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"@trivago/prettier-plugin-sort-imports": "^3.3.0",
"@types/jest": "^29.2.4",
"@types/leaflet": "^1.9.0",
"@types/leaflet.gridlayer.googlemutant": "^0.4.6",
"@typescript-eslint/eslint-plugin": "^5.46.0",
"@typescript-eslint/parser": "^5.46.0",
"babel-jest": "^29.5.0",
Expand Down Expand Up @@ -87,11 +86,11 @@
"compressorjs": "^1.1.1",
"history": "^5.3.0",
"leaflet": "^1.9.3",
"leaflet.gridlayer.googlemutant": "^0.13.5",
"preact": "^10.11.0",
"preact-i18nline": "^2.0.0",
"preact-router": "^4.1.0",
"react-hook-form": "^7.36.1",
"react-leaflet": "^4.2.1",
"react-redux": "^8.0.4",
"react-router-redux": "^4.0.8",
"react-use": "^17.4.0",
Expand Down
11 changes: 0 additions & 11 deletions plugins/lime-plugin-locate/index.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
import * as constants from "./src/locateConstants";
import epics from "./src/locateEpics";
import { LocateMenu } from "./src/locateMenu";
import Locate from "./src/locatePage";
import { reducer } from "./src/locateReducer";
import * as selector from "./src/locateSelectors";

export default {
name: "Locate",
page: Locate,
menu: LocateMenu,
store: {
name: "locate",
epics,
reducer,
selector,
constants,
},
} as LimePlugin;
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { DivIconOptions, IconOptions } from "leaflet";

const leafletVersion = "1.9.3";

function loadLeafletScript() {
return new Promise((res, rej) => {
if (document.getElementById("leaflet-script")) {
// @ts-ignore
res();
} else {
const script = document.createElement("script");
script.onload = res;
script.onerror = rej;
script.src =
"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.0/leaflet.js";
script.src = `https://unpkg.com/leaflet@${leafletVersion}/dist/leaflet.js`;
script.id = "leaflet-script";
document.body.appendChild(script);
}
Expand All @@ -17,13 +21,14 @@ function loadLeafletScript() {
function loadLeafletStylesheet() {
return new Promise((res, rej) => {
if (document.getElementById("leaflet-style")) {
// @ts-ignore
res();
} else {
const style = document.createElement("link");
style.onload = res;
style.onerror = rej;
style.rel = "stylesheet";
style.href = "https://unpkg.com/leaflet@1.6.0/dist/leaflet.css";
style.href = `https://unpkg.com/leaflet@${leafletVersion}/dist/leaflet.css`;
style.id = "leaflet-style";
document.head.appendChild(style);
}
Expand All @@ -35,26 +40,10 @@ export function loadLeafLet() {
return loadLeafletStylesheet().then(loadLeafletScript);
}

export function loadGoogleMapsApi() {
return new Promise((res, rej) => {
if (document.getElementById("googlemaps-script")) {
res();
} else {
const key = "AIzaSyBS0M7H7Ltk1ipjwqi8r9_WQJOzWfav4Ok";
const script = document.createElement("script");
script.onload = res;
script.onerror = rej;
script.src = `https://maps.googleapis.com/maps/api/js?key=${key}`;
script.id = "googlemaps-script";
document.body.appendChild(script);
}
});
}

export const homeIcon = {
export const homeIcon: IconOptions = {
iconUrl:
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4wYSCCcFjei+agAABsdJREFUWMOdl11sHFcVx//n3pmdj921rdiJ60QJiJf0pS1KFSdtUR9AJUQIlKopKgKBUEMilQoQiiqCqKCCQGmpBGpBoWpUqoKC2qI6Qi2k6QOoKCiOmn5JITyQ4Hw4X7az9u7Ox517z+FhnbW3sZ117+g8zMw953fPPR93htDl2P76cD8RrVEiA0w0EaJ04cWtb13pRpeWevnAa5vWs6ZvkNBXRWSNUirVymPHVjFzRJouO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
};
30 changes: 0 additions & 30 deletions plugins/lime-plugin-locate/src/locateActions.js

This file was deleted.

11 changes: 7 additions & 4 deletions plugins/lime-plugin-locate/src/locateApi.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
export const getLocation = (api) => api.call("lime-location", "get", {});
import api from "utils/uhttpd.service";

export const getNodesandlinks = (api) =>
export const getLocation = () => api.call("lime-location", "get", {});

export const getNodesandlinks = async () =>
api.call("lime-location", "all_nodes_and_links", {});

export const changeLocation = (api, location) =>
api.call("lime-location", "set", {
export const changeLocation = async (location) => {
return await api.call("lime-location", "set", {
lat: location.lat.toFixed(5),
lon: location.lon.toFixed(5),
});
};
9 changes: 0 additions & 9 deletions plugins/lime-plugin-locate/src/locateConstants.js

This file was deleted.

41 changes: 0 additions & 41 deletions plugins/lime-plugin-locate/src/locateEpics.js

This file was deleted.

Loading

0 comments on commit 5113561

Please sign in to comment.