Added series title in the season selection modal

This commit is contained in:
ltctceplrm 2025-10-25 17:41:38 +02:00
parent 18af97a4c6
commit 3686a0175d
2 changed files with 7 additions and 3 deletions

View file

@ -248,13 +248,15 @@ export default class MediaDbPlugin extends Plugin {
new Notice('No seasons found for this series.');
return;
}
// Pass the original series title from the search result
const seriesName = selectResults[0]?.englishTitle || selectResults[0]?.title || '';
const modal = new MediaDbSeasonSelectModal(this, allSeasons.map(s => ({
season_number: s.seasonNumber,
name: s.seasonTitle || s.title,
episode_count: s.episodes || 0,
air_date: s.year,
poster_path: s.image,
})), true);
})), true, seriesName);
const selectedSeasons: any[] = await new Promise(resolve => {
modal.setSubmitCallback(resolve);
modal.open();

View file

@ -12,11 +12,13 @@ export class MediaDbSeasonSelectModal extends SelectModal<SeasonSelectModalEleme
plugin: MediaDbPlugin;
submitCallback?: (selectedSeasons: SeasonSelectModalElement[]) => void;
closeCallback?: (err?: Error) => void;
seriesName?: string;
constructor(plugin: MediaDbPlugin, seasons: SeasonSelectModalElement[], multiSelect = true) {
constructor(plugin: MediaDbPlugin, seasons: SeasonSelectModalElement[], multiSelect = true, seriesName?: string) {
super(plugin.app, seasons, multiSelect);
this.plugin = plugin;
this.title = 'Select Season(s)';
this.seriesName = seriesName;
this.title = `Select Season(s) for${seriesName ? `: ${seriesName}` : ''}`;
this.description = 'Select one or more seasons to create notes for.';
}