Adding a button to open a POIsearch in a browser

This commit is contained in:
Eric van der Vlist 2023-01-16 17:27:49 +01:00
parent 2fae581449
commit ee000862f8
3 changed files with 21 additions and 1 deletions

9
package-lock.json generated
View File

@ -15,6 +15,7 @@
"@awesome-cordova-plugins/web-intent": "^6.3.0", "@awesome-cordova-plugins/web-intent": "^6.3.0",
"@capacitor-community/background-geolocation": "^1.2.7", "@capacitor-community/background-geolocation": "^1.2.7",
"@capacitor/android": "^4.6.1", "@capacitor/android": "^4.6.1",
"@capacitor/browser": "^4.1.0",
"@capacitor/core": "^4.6.1", "@capacitor/core": "^4.6.1",
"@capacitor/ios": "^4.6.1", "@capacitor/ios": "^4.6.1",
"@esbuild-plugins/node-globals-polyfill": "^0.1.1", "@esbuild-plugins/node-globals-polyfill": "^0.1.1",
@ -627,6 +628,14 @@
"@capacitor/core": "^4.6.0" "@capacitor/core": "^4.6.0"
} }
}, },
"node_modules/@capacitor/browser": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@capacitor/browser/-/browser-4.1.0.tgz",
"integrity": "sha512-WKAZDc9ECYQesEXlVhJu5/qbqkL5rj15wg9yBqSC0RXYsOU7aDiTMjXIu+Vu68jA8IQqIuNIp8slDvDQa+U/Kw==",
"peerDependencies": {
"@capacitor/core": "^4.0.0"
}
},
"node_modules/@capacitor/cli": { "node_modules/@capacitor/cli": {
"version": "4.6.1", "version": "4.6.1",
"resolved": "https://registry.npmjs.org/@capacitor/cli/-/cli-4.6.1.tgz", "resolved": "https://registry.npmjs.org/@capacitor/cli/-/cli-4.6.1.tgz",

View File

@ -31,6 +31,7 @@
"@awesome-cordova-plugins/web-intent": "^6.3.0", "@awesome-cordova-plugins/web-intent": "^6.3.0",
"@capacitor-community/background-geolocation": "^1.2.7", "@capacitor-community/background-geolocation": "^1.2.7",
"@capacitor/android": "^4.6.1", "@capacitor/android": "^4.6.1",
"@capacitor/browser": "^4.1.0",
"@capacitor/core": "^4.6.1", "@capacitor/core": "^4.6.1",
"@capacitor/ios": "^4.6.1", "@capacitor/ios": "^4.6.1",
"@esbuild-plugins/node-globals-polyfill": "^0.1.1", "@esbuild-plugins/node-globals-polyfill": "^0.1.1",

View File

@ -11,6 +11,7 @@ import styled from '@suid/material/styles/styled';
import Dialog from '../dialog'; import Dialog from '../dialog';
import Tree from '../tree'; import Tree from '../tree';
import { GpxViewer } from '../gpx'; import { GpxViewer } from '../gpx';
import { Browser } from '@capacitor/browser';
const Item = styled(Paper)(({ theme }) => ({ const Item = styled(Paper)(({ theme }) => ({
...theme.typography.body2, ...theme.typography.body2,
@ -170,7 +171,16 @@ const Infos: Component<{}> = (props) => {
${feature.get('name') || ''}`} ${feature.get('name') || ''}`}
</div> </div>
<div> <div>
<IconButton> <IconButton
onClick={async () => {
await Browser.open({
url: `https://www.qwant.com/?q=${encodeURIComponent(`${feature.get(
'class'
)}
${feature.get('name') || ''}`)}&t=web`,
});
}}
>
<TravelExploreIcon /> <TravelExploreIcon />
</IconButton> </IconButton>
</div> </div>