diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b64270d3..b5b4c7acf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [CalVer](https://calver.org/). +## [Unreleased] + +### Added + +- A new config `extensionConfig.streetView.ignorelist`. This setting will not render the buttons for selected options. possible values. (To hide `cowi` - no not set `extensionConfig.streetView.cowi`): + - google + - mapillary + - skraafoto + - maps + + ## [2025.3.2] - 2025-28-3 ### Added diff --git a/extensions/streetView/browser/index.js b/extensions/streetView/browser/index.js index 1d53a9625..03296ea52 100644 --- a/extensions/streetView/browser/index.js +++ b/extensions/streetView/browser/index.js @@ -51,6 +51,15 @@ let mapObj; let config = require('../../../config/config.js'); let cowiUrl = config?.extensionConfig?.streetView?.cowi; +let ignorelist = config?.extensionConfig?.streetView?.ignorelist || []; + +// check if cowiUrl is set, if not, add it to the ignorelist +// This is a way to keep the old functionality of the extension, but also to allow for a new way of using the extension +if (!cowiUrl) { + ignorelist.push("cowi"); +} + +const availableServices = ["google", "mapillary", "skraafoto", "maps", "cowi"]; let mapillaryUrl = config?.extensionConfig?.streetView?.mapillary ||"https://www.mapillary.com/app/?z=17"; /** @@ -143,9 +152,19 @@ module.exports = { constructor(props) { super(props); + // Find the first available service that is not in the ignorelist, Use this as default + let defaultService = "google"; // Fallback default + for (let service of availableServices) { + if (!ignorelist.includes(service)) { + defaultService = service; + break; + } + } + + // Use config default if specified, otherwise use the computed default this.state = { active: false, - selectedOption: config?.extensionConfig?.streetView?.default || "google" + selectedOption: config?.extensionConfig?.streetView?.default || defaultService }; this.onChange = this.onChange.bind(this); @@ -242,42 +261,61 @@ module.exports = {
- - - - - - - - - - - {cowiUrl !== undefined ? + {!ignorelist.includes("google") ? + <> + + + + : null + } + {!ignorelist.includes("mapillary") ? + <> + + + + : null + } + {!ignorelist.includes("skraafoto") ? + <> + + + + : null + } + {!ignorelist.includes("maps") ? + <> + + + + : null + } + {!ignorelist.includes("cowi") ? + <> : null - } - {cowiUrl !== undefined ? + name="streetview-service" + value="cowi" checked={this.state.selectedOption === 'cowi'} + onChange={this.onChange}/> : null - } + htmlFor="streetview-service-cowi">COWI Gadefoto + + : null + }