removed react-helment

This commit is contained in:
Anton 2023-09-15 08:19:03 +02:00
parent 1ad42909c4
commit 2fec9b05d7
3 changed files with 4 additions and 46 deletions

28
package-lock.json generated
View File

@ -12,7 +12,6 @@
"@heroicons/react": "^2.0.17",
"leaflet": "^1.9.4",
"prop-types": "^15.8.1",
"react-helmet": "^6.1.0",
"react-leaflet": "^4.2.1",
"react-leaflet-cluster": "^2.1.0",
"react-router-dom": "^6.16.0",
@ -3787,25 +3786,6 @@
"react": "^18.2.0"
}
},
"node_modules/react-fast-compare": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.2.tgz",
"integrity": "sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ=="
},
"node_modules/react-helmet": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/react-helmet/-/react-helmet-6.1.0.tgz",
"integrity": "sha512-4uMzEY9nlDlgxr61NL3XbKRy1hEkXmKNXhjbAIOVw5vcFrsdYbH2FEwcNyWvWinl103nXgzYNlns9ca+8kFiWw==",
"dependencies": {
"object-assign": "^4.1.1",
"prop-types": "^15.7.2",
"react-fast-compare": "^3.1.1",
"react-side-effect": "^2.1.0"
},
"peerDependencies": {
"react": ">=16.3.0"
}
},
"node_modules/react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
@ -3868,14 +3848,6 @@
"react-dom": ">=16.8"
}
},
"node_modules/react-side-effect": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/react-side-effect/-/react-side-effect-2.1.2.tgz",
"integrity": "sha512-PVjOcvVOyIILrYoyGEpDN3vmYNLdy1CajSFNt4TDsVQC5KpTijDvWVoR+/7Rz2xT978D8/ZtFceXxzsPwZEDvw==",
"peerDependencies": {
"react": "^16.3.0 || ^17.0.0 || ^18.0.0"
}
},
"node_modules/react-string-replace": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/react-string-replace/-/react-string-replace-1.1.1.tgz",

View File

@ -46,7 +46,6 @@
"@heroicons/react": "^2.0.17",
"leaflet": "^1.9.4",
"prop-types": "^15.8.1",
"react-helmet": "^6.1.0",
"react-leaflet": "^4.2.1",
"react-leaflet-cluster": "^2.1.0",
"react-router-dom": "^6.16.0",

View File

@ -11,13 +11,10 @@ import { useGetItemTags } from './hooks/useTags'
import { useAddMarker, useAddPopup, useLeafletRefs } from './hooks/useLeafletRefs'
import { Popup } from 'leaflet'
import { useLocation } from 'react-router-dom';
import {Helmet} from "react-helmet";
export const Layer = (props: LayerProps) => {
const [itemFormPopup, setItemFormPopup] = useState<ItemFormPopupProps | null>(null);
const [ogTitle, setOgTitle] = useState<string>("");
const [ogDescription, setOgDescription] = useState<string>("");
const filterTags = useFilterTags();
@ -52,15 +49,8 @@ export const Layer = (props: LayerProps) => {
},
})
const openPopup = () => {
console.log(window.location);
if (window.location.pathname.split("/").length <= 2) {
console.log("close");
setOgTitle("");
setOgDescription("");
if (window.location.pathname.split("/").length <= 2 || window.location.pathname.split("/")[2]==="") {
map.closePopup();
}
else {
@ -74,8 +64,9 @@ export const Layer = (props: LayerProps) => {
marker.openPopup();
});
const item = leafletRefs[id]?.item;
setOgTitle(item.name);
setOgDescription(item.text);
document.title = document.title.split("-")[0] + " - " + item.name;
document.querySelector('meta[property="og:title"]')?.setAttribute("content", item.name);
document.querySelector('meta[property="og:description"]')?.setAttribute("content", item.text);
}
}
}
@ -153,10 +144,6 @@ export const Layer = (props: LayerProps) => {
<ItemFormPopup position={props.itemFormPopup!.position} layer={props.itemFormPopup!.layer} setItemFormPopup={setItemFormPopup} item={props.itemFormPopup!.item} />
</>)
}
<Helmet>
<meta property="og:title" content={ogTitle}/>
<meta property="og:description" content={ogDescription} />
</Helmet>
</>
)
}