Added more clarity
When searching for seasons the modal specifies that you must select only one series to proceed to the season selection screen
This commit is contained in:
parent
59919f9461
commit
d748d9840e
4 changed files with 26 additions and 11 deletions
24
src/main.ts
24
src/main.ts
|
|
@ -221,14 +221,26 @@ export default class MediaDbPlugin extends Plugin {
|
|||
while (!proceed) {
|
||||
if (types.length === 1 && types[0] === 'season') {
|
||||
selectResults =
|
||||
(await this.modalHelper.openSelectModal({ elements: apiSearchResults }, async selectModalData => {
|
||||
return selectModalData.selected;
|
||||
})) ?? [];
|
||||
(await this.modalHelper.openSelectModal(
|
||||
{
|
||||
elements: apiSearchResults,
|
||||
description: 'Select one search result to proceed.',
|
||||
submitButtonText: 'Ok',
|
||||
},
|
||||
async selectModalData => {
|
||||
return selectModalData.selected;
|
||||
},
|
||||
)) ?? [];
|
||||
} else {
|
||||
selectResults =
|
||||
(await this.modalHelper.openSelectModal({ elements: apiSearchResults }, async selectModalData => {
|
||||
return await this.queryDetails(selectModalData.selected);
|
||||
})) ?? [];
|
||||
(await this.modalHelper.openSelectModal(
|
||||
{
|
||||
elements: apiSearchResults,
|
||||
},
|
||||
async selectModalData => {
|
||||
return await this.queryDetails(selectModalData.selected);
|
||||
},
|
||||
)) ?? [];
|
||||
}
|
||||
if (!selectResults || selectResults.length < 1) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ export class MediaDbSearchResultModal extends SelectModal<MediaTypeModel> {
|
|||
super(plugin.app, selectModalOptions.elements ?? [], selectModalOptions.multiSelect);
|
||||
this.plugin = plugin;
|
||||
this.title = selectModalOptions.modalTitle ?? '';
|
||||
this.description = 'Select one or multiple search results.';
|
||||
this.description = selectModalOptions.description ?? 'Select one or multiple search results.';
|
||||
this.addSkipButton = selectModalOptions.skipButton ?? false;
|
||||
this.submitButtonText = 'Ok';
|
||||
this.submitButtonText = selectModalOptions.submitButtonText ?? 'Ok';
|
||||
this.busy = false;
|
||||
this.sendCallback = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ export abstract class SelectModal<T> extends Modal {
|
|||
this.skipButton = btn;
|
||||
});
|
||||
}
|
||||
bottomSettingRow.addButton((btn) => {
|
||||
bottomSettingRow.addButton(btn => {
|
||||
btn.setButtonText(this.submitButtonText);
|
||||
btn.setCta();
|
||||
btn.onClick(() => this.submit());
|
||||
|
|
|
|||
|
|
@ -159,12 +159,13 @@ export interface IdSearchModalOptions {
|
|||
* - skipButton: whether to add a skip button to the modal
|
||||
*/
|
||||
export interface SelectModalOptions {
|
||||
modalTitle?: string;
|
||||
elements?: MediaTypeModel[];
|
||||
multiSelect?: boolean;
|
||||
modalTitle?: string;
|
||||
skipButton?: boolean;
|
||||
description?: string; // Add this
|
||||
submitButtonText?: string; // Add this too
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for the preview modal.
|
||||
* - modalTitle: the title of the modal
|
||||
|
|
@ -210,6 +211,8 @@ export const SELECTMODALOPTIONSDEFAULT: SelectModalOptions = {
|
|||
multiSelect: true,
|
||||
modalTitle: '',
|
||||
skipButton: false,
|
||||
description: 'Select one or multiple search results.',
|
||||
submitButtonText: 'Ok',
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue