chore: refactor help.button arguments

This commit is contained in:
Yohan Boniface 2024-07-05 18:27:53 +02:00
parent ec5f8d7b3c
commit 207860ecf5
2 changed files with 16 additions and 21 deletions

View file

@ -213,25 +213,20 @@ export default class Help {
this.map.dialog.open({ content: container, className: 'dark' }) this.map.dialog.open({ content: container, className: 'dark' })
} }
button(container, entries, classname) { button(container, entries) {
const button = DomUtil.createButton( const button = DomUtil.createButton(
classname || 'umap-help-button', 'umap-help-button',
container, container,
translate('Help') translate('Help')
) )
entries = typeof entries === 'string' ? [entries] : entries button.addEventListener('click', () => this.show(entries))
DomEvent.on(button, 'click', DomEvent.stop).on(button, 'click', () => {
this.show(entries)
})
return button return button
} }
getStartedLink(container) { getStartedLink(container) {
const button = DomUtil.createButton('umap-help-link', container, translate('Help')) const button = DomUtil.createButton('umap-help-link', container, translate('Help'))
button.textContent = translate('Help') button.textContent = translate('Help')
DomEvent.on(button, 'click', DomEvent.stop).on(button, 'click', () => { button.addEventListener('click', () => this.showGetStarted())
this.showGetStarted()
})
return button return button
} }

View file

@ -45,7 +45,7 @@ export const SCHEMA = {
impacts: ['data'], impacts: ['data'],
handler: 'ColorPicker', handler: 'ColorPicker',
label: translate('color'), label: translate('color'),
helpEntries: 'colorValue', helpEntries: ['colorValue'],
inheritable: true, inheritable: true,
default: 'DarkBlue', default: 'DarkBlue',
}, },
@ -65,7 +65,7 @@ export const SCHEMA = {
type: String, type: String,
impacts: ['data'], impacts: ['data'],
label: translate('dash array'), label: translate('dash array'),
helpEntries: 'dashArray', helpEntries: ['dashArray'],
inheritable: true, inheritable: true,
}, },
datalayersControl: { datalayersControl: {
@ -92,7 +92,7 @@ export const SCHEMA = {
type: 'Text', type: 'Text',
impacts: ['ui'], impacts: ['ui'],
label: translate('description'), label: translate('description'),
helpEntries: 'textFormatting', helpEntries: ['textFormatting'],
}, },
displayOnLoad: { displayOnLoad: {
type: Boolean, type: Boolean,
@ -131,7 +131,7 @@ export const SCHEMA = {
type: Boolean, type: Boolean,
impacts: ['data'], impacts: ['data'],
label: translate('fill'), label: translate('fill'),
helpEntries: 'fill', helpEntries: ['fill'],
inheritable: true, inheritable: true,
default: true, default: true,
}, },
@ -140,7 +140,7 @@ export const SCHEMA = {
impacts: ['data'], impacts: ['data'],
handler: 'ColorPicker', handler: 'ColorPicker',
label: translate('fill color'), label: translate('fill color'),
helpEntries: 'fillColor', helpEntries: ['fillColor'],
inheritable: true, inheritable: true,
}, },
fillOpacity: { fillOpacity: {
@ -216,7 +216,7 @@ export const SCHEMA = {
type: Boolean, type: Boolean,
impacts: ['data'], impacts: ['data'],
label: translate('Allow interactions'), label: translate('Allow interactions'),
helpEntries: 'interactive', helpEntries: ['interactive'],
inheritable: true, inheritable: true,
default: true, default: true,
}, },
@ -243,7 +243,7 @@ export const SCHEMA = {
labelKey: { labelKey: {
type: String, type: String,
impacts: ['data'], impacts: ['data'],
helpEntries: 'labelKey', helpEntries: ['labelKey'],
placeholder: translate('Default: name'), placeholder: translate('Default: name'),
label: translate('Label key'), label: translate('Label key'),
inheritable: true, inheritable: true,
@ -319,7 +319,7 @@ export const SCHEMA = {
type: String, type: String,
impacts: [], impacts: [],
label: translate('Link to…'), label: translate('Link to…'),
helpEntries: 'outlink', helpEntries: ['outlink'],
placeholder: 'http://...', placeholder: 'http://...',
inheritable: true, inheritable: true,
}, },
@ -441,7 +441,7 @@ export const SCHEMA = {
max: 10, max: 10,
step: 0.5, step: 0.5,
label: translate('Simplify'), label: translate('Simplify'),
helpEntries: 'smoothFactor', helpEntries: ['smoothFactor'],
inheritable: true, inheritable: true,
default: 1.0, default: 1.0,
}, },
@ -459,7 +459,7 @@ export const SCHEMA = {
type: Boolean, type: Boolean,
impacts: ['data'], impacts: ['data'],
label: translate('stroke'), label: translate('stroke'),
helpEntries: 'stroke', helpEntries: ['stroke'],
inheritable: true, inheritable: true,
default: true, default: true,
}, },
@ -467,7 +467,7 @@ export const SCHEMA = {
type: Boolean, type: Boolean,
impacts: ['sync', 'ui'], impacts: ['sync', 'ui'],
label: translate('Enable real-time collaboration'), label: translate('Enable real-time collaboration'),
helpEntries: 'sync', helpEntries: ['sync'],
default: false, default: false,
}, },
tilelayer: { tilelayer: {
@ -526,7 +526,7 @@ export const SCHEMA = {
type: Number, type: Number,
impacts: [], // not need to update the view impacts: [], // not need to update the view
placeholder: translate('Inherit'), placeholder: translate('Inherit'),
helpEntries: 'zoomTo', helpEntries: ['zoomTo'],
label: translate('Default zoom level'), label: translate('Default zoom level'),
inheritable: true, inheritable: true,
}, },