MCPcopy
hub / github.com/callumalpass/tasknotes / configureButtonSetting

Function configureButtonSetting

src/settings/components/settingHelpers.ts:328–345  ·  view source on GitHub ↗
(setting: Setting, options: ButtonSettingOptions)

Source from the content-addressed store, hash-verified

326 * Helper for configuring a button setting (works with SettingGroup.addSetting)
327 */
328export function configureButtonSetting(setting: Setting, options: ButtonSettingOptions): Setting {
329 return setting
330 .setName(options.name)
331 .setDesc(options.desc)
332 .addButton((button) => {
333 button.setButtonText(options.buttonText).onClick(() => {
334 runAsyncSettingCallback(options.onClick);
335 });
336
337 if (options.buttonClass) {
338 button.buttonEl.addClass(options.buttonClass);
339 } else {
340 button.buttonEl.addClasses(["tn-btn", "tn-btn--ghost"]);
341 }
342
343 return button;
344 });
345}
346
347/**
348 * Helper for creating standard button settings

Callers 3

renderIntegrationsTabFunction · 0.90
renderFeaturesTabFunction · 0.90
createButtonSettingFunction · 0.85

Calls 7

runAsyncSettingCallbackFunction · 0.85
addButtonMethod · 0.80
setDescMethod · 0.80
onClickMethod · 0.80
setButtonTextMethod · 0.80
addClassMethod · 0.65
setNameMethod · 0.45

Tested by

no test coverage detected