Refactor QR set popups to new popup

0f45ebda0376fc26173dae6f36784aced52fe132

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +6 -6Showing whitespace changes
public/scripts/extensions/quick-reply/src/ui/SettingsUi.js+6 -6
@@ -1,4 +1,4 @@
1import { callPopup } from '../../../../../script.js';1import { Popup } from '../../../../popup.js';
2import { getSortableDelay } from '../../../../utils.js';2import { getSortableDelay } from '../../../../utils.js';
3import { log, warn } from '../../index.js';3import { log, warn } from '../../index.js';
4import { QuickReply } from '../QuickReply.js';4import { QuickReply } from '../QuickReply.js';
@@ -280,7 +280,7 @@ export class SettingsUi {
280 }280 }
281281
282 async deleteQrSet() {282 async deleteQrSet() {
283 const confirmed = await callPopup(`Are you sure you want to delete the Quick Reply Set "${this.currentQrSet.name}"?<br>This cannot be undone.`, 'confirm');283 const confirmed = await Popup.show.confirm('Delete Quick Reply Set', `Are you sure you want to delete the Quick Reply Set "${this.currentQrSet.name}"?<br>This cannot be undone.`);
284 if (confirmed) {284 if (confirmed) {
285 await this.doDeleteQrSet(this.currentQrSet);285 await this.doDeleteQrSet(this.currentQrSet);
286 this.rerender();286 this.rerender();
@@ -305,7 +305,7 @@ export class SettingsUi {
305 }305 }
306306
307 async renameQrSet() {307 async renameQrSet() {
308 const newName = await callPopup('Enter new name for the Quick Reply Set:', 'input');308 const newName = await Popup.show.input('Rename Quick Reply Set', 'Enter a new name:', this.currentQrSet.name);
309 if (newName && newName.length > 0) {309 if (newName && newName.length > 0) {
310 const existingSet = QuickReplySet.get(newName);310 const existingSet = QuickReplySet.get(newName);
311 if (existingSet) {311 if (existingSet) {
@@ -343,11 +343,11 @@ export class SettingsUi {
343 }343 }
344344
345 async addQrSet() {345 async addQrSet() {
346 const name = await callPopup('Quick Reply Set Name:', 'input');346 const name = await Popup.show.input('Create a new World Info', 'Enter a name for the new Quick Reply Set:');
347 if (name && name.length > 0) {347 if (name && name.length > 0) {
348 const oldQrs = QuickReplySet.get(name);348 const oldQrs = QuickReplySet.get(name);
349 if (oldQrs) {349 if (oldQrs) {
350 const replace = await callPopup(`A Quick Reply Set named "${name}" already exists.<br>Do you want to overwrite the existing Quick Reply Set?<br>The existing set will be deleted. This cannot be undone.`, 'confirm');350 const replace = Popup.show.confirm('Replace existing World Info', `A Quick Reply Set named "${name}" already exists.<br>Do you want to overwrite the existing Quick Reply Set?<br>The existing set will be deleted. This cannot be undone.`);
351 if (replace) {351 if (replace) {
352 const idx = QuickReplySet.list.indexOf(oldQrs);352 const idx = QuickReplySet.list.indexOf(oldQrs);
353 await this.doDeleteQrSet(oldQrs);353 await this.doDeleteQrSet(oldQrs);
@@ -408,7 +408,7 @@ export class SettingsUi {
408 qrs.init();408 qrs.init();
409 const oldQrs = QuickReplySet.get(props.name);409 const oldQrs = QuickReplySet.get(props.name);
410 if (oldQrs) {410 if (oldQrs) {
411 const replace = await callPopup(`A Quick Reply Set named "${qrs.name}" already exists.<br>Do you want to overwrite the existing Quick Reply Set?<br>The existing set will be deleted. This cannot be undone.`, 'confirm');411 const replace = Popup.show.confirm('Replace existing World Info', `A Quick Reply Set named "${name}" already exists.<br>Do you want to overwrite the existing Quick Reply Set?<br>The existing set will be deleted. This cannot be undone.`);
412 if (replace) {412 if (replace) {
413 const idx = QuickReplySet.list.indexOf(oldQrs);413 const idx = QuickReplySet.list.indexOf(oldQrs);
414 await this.doDeleteQrSet(oldQrs);414 await this.doDeleteQrSet(oldQrs);