Update to shlink-web-component 0.1.1

This commit is contained in:
Alejandro Celaya 2023-08-14 13:06:11 +02:00
parent 0622288990
commit f7cddf8fc5
5 changed files with 8 additions and 50 deletions

16
package-lock.json generated
View file

@ -16,15 +16,13 @@
"@json2csv/plainjs": "^7.0.1",
"@reduxjs/toolkit": "^1.9.5",
"@shlinkio/shlink-frontend-kit": "^0.2.0",
"@shlinkio/shlink-web-component": "^0.1.0",
"@shlinkio/shlink-web-component": "^0.1.1",
"bootstrap": "5.2.3",
"bottlejs": "^2.0.1",
"chart.js": "^4.3.3",
"classnames": "^2.3.2",
"compare-versions": "^6.1.0",
"csvtojson": "^2.0.10",
"date-fns": "^2.30.0",
"leaflet": "^1.9.4",
"ramda": "^0.27.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
@ -3113,9 +3111,9 @@
}
},
"node_modules/@shlinkio/shlink-web-component": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/@shlinkio/shlink-web-component/-/shlink-web-component-0.1.0.tgz",
"integrity": "sha512-3YsvRKZrMKtSlBO0YRi+4MsHGR0Akn8Tl5Akd6yYa6v8NeLjpDDcy7sM+eI/YzXJ9bAHJUost3eJvWNc4cdezw==",
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/@shlinkio/shlink-web-component/-/shlink-web-component-0.1.1.tgz",
"integrity": "sha512-N59LT9KCLPkPvPDPdS5EVvpPg0/eQUf1QuHewVZNK3Ee3XxAqoNK5ssHTuPX/xFDvzPmROEQWxIdcuma5+6e4w==",
"dependencies": {
"@json2csv/plainjs": "^7.0.1",
"bottlejs": "^2.0.1",
@ -13270,9 +13268,9 @@
}
},
"@shlinkio/shlink-web-component": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/@shlinkio/shlink-web-component/-/shlink-web-component-0.1.0.tgz",
"integrity": "sha512-3YsvRKZrMKtSlBO0YRi+4MsHGR0Akn8Tl5Akd6yYa6v8NeLjpDDcy7sM+eI/YzXJ9bAHJUost3eJvWNc4cdezw==",
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/@shlinkio/shlink-web-component/-/shlink-web-component-0.1.1.tgz",
"integrity": "sha512-N59LT9KCLPkPvPDPdS5EVvpPg0/eQUf1QuHewVZNK3Ee3XxAqoNK5ssHTuPX/xFDvzPmROEQWxIdcuma5+6e4w==",
"requires": {
"@json2csv/plainjs": "^7.0.1",
"bottlejs": "^2.0.1",

View file

@ -32,15 +32,13 @@
"@json2csv/plainjs": "^7.0.1",
"@reduxjs/toolkit": "^1.9.5",
"@shlinkio/shlink-frontend-kit": "^0.2.0",
"@shlinkio/shlink-web-component": "^0.1.0",
"@shlinkio/shlink-web-component": "^0.1.1",
"bootstrap": "5.2.3",
"bottlejs": "^2.0.1",
"chart.js": "^4.3.3",
"classnames": "^2.3.2",
"compare-versions": "^6.1.0",
"csvtojson": "^2.0.10",
"date-fns": "^2.30.0",
"leaflet": "^1.9.4",
"ramda": "^0.27.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",

View file

@ -1,4 +1,3 @@
import 'chart.js/auto'; // TODO Import specific ones to reduce bundle size https://react-chartjs-2.js.org/docs/migration-to-v4/#tree-shaking
import { createRoot } from 'react-dom/client';
import { Provider } from 'react-redux';
import { BrowserRouter } from 'react-router-dom';
@ -6,14 +5,10 @@ import pack from '../package.json';
import { container } from './container';
import { setUpStore } from './container/store';
import { register as registerServiceWorker } from './serviceWorkerRegistration';
import { fixLeafletIcons } from './utils/helpers/leaflet';
import './index.scss';
import 'leaflet/dist/leaflet.css';
import 'react-datepicker/dist/react-datepicker.css';
// This overwrites icons used for leaflet maps, fixing some issues caused by webpack while processing the CSS
fixLeafletIcons();
const store = setUpStore(container);
const { App, ScrollToTop, ErrorHandler, appUpdateAvailable } = container;

View file

@ -1,14 +0,0 @@
import L from 'leaflet';
import marker from 'leaflet/dist/images/marker-icon.png';
import marker2x from 'leaflet/dist/images/marker-icon-2x.png';
import markerShadow from 'leaflet/dist/images/marker-shadow.png';
export const fixLeafletIcons = () => {
delete (L.Icon.Default.prototype as any)._getIconUrl; // eslint-disable-line no-underscore-dangle
L.Icon.Default.mergeOptions({
iconRetinaUrl: marker2x,
iconUrl: marker,
shadowUrl: markerShadow,
});
};

View file

@ -1,19 +0,0 @@
import L from 'leaflet';
import marker from 'leaflet/dist/images/marker-icon.png';
import marker2x from 'leaflet/dist/images/marker-icon-2x.png';
import markerShadow from 'leaflet/dist/images/marker-shadow.png';
import { fixLeafletIcons } from '../../../src/utils/helpers/leaflet';
describe('leaflet', () => {
describe('fixLeafletIcons', () => {
it('updates icons used by leaflet', () => {
fixLeafletIcons();
const { iconRetinaUrl, iconUrl, shadowUrl } = L.Icon.Default.prototype.options;
expect(iconRetinaUrl).toEqual(marker2x);
expect(iconUrl).toEqual(marker);
expect(shadowUrl).toEqual(markerShadow);
});
});
});