api descriptions

This commit is contained in:
mProjectsCode 2022-05-05 21:48:54 +02:00
parent 99980028d0
commit 30d07f79f3
6 changed files with 20 additions and 5 deletions

View file

@ -3,6 +3,7 @@ import {MediaTypeModel} from '../models/MediaTypeModel';
export abstract class APIModel { export abstract class APIModel {
apiName: string; apiName: string;
apiUrl: string; apiUrl: string;
apiDescription: string;
types: string[]; types: string[];
/** /**

View file

@ -11,6 +11,7 @@ export class OMDbAPI extends APIModel {
this.plugin = plugin; this.plugin = plugin;
this.apiName = 'OMDbAPI'; this.apiName = 'OMDbAPI';
this.apiDescription = 'A free API for Movies and Series.';
this.apiUrl = 'http://www.omdbapi.com/'; this.apiUrl = 'http://www.omdbapi.com/';
this.types = ['movie', 'series']; this.types = ['movie', 'series'];
} }

View file

@ -6,6 +6,7 @@ export class TestAPI extends APIModel {
constructor() { constructor() {
super(); super();
this.apiName = 'testAPI'; this.apiName = 'testAPI';
this.apiDescription = 'The test API used during development.';
this.apiUrl = 'www.test.api'; this.apiUrl = 'www.test.api';
this.types = ['test']; this.types = ['test'];
} }

View file

@ -76,7 +76,10 @@ export class MediaDbAdvancedSearchModal extends Modal {
for (const api of this.apiManager.apis) { for (const api of this.apiManager.apis) {
const apiToggleListElementWrapper = contentEl.createEl('div', {cls: 'media-db-plugin-list-wrapper'}); const apiToggleListElementWrapper = contentEl.createEl('div', {cls: 'media-db-plugin-list-wrapper'});
apiToggleListElementWrapper.createEl('span', {text: api.apiName, cls: 'media-db-plugin-list-text'}); const apiToggleTextWrapper = apiToggleListElementWrapper.createEl('div', {cls: 'media-db-plugin-list-text-wrapper'});
apiToggleTextWrapper.createEl('span', {text: api.apiName, cls: 'media-db-plugin-list-text'});
apiToggleTextWrapper.createEl('small', {text: api.apiDescription, cls: 'media-db-plugin-list-text'});
const apiToggleComponentWrapper = apiToggleListElementWrapper.createEl('div', {cls: 'media-db-plugin-list-toggle'}); const apiToggleComponentWrapper = apiToggleListElementWrapper.createEl('div', {cls: 'media-db-plugin-list-toggle'});
const apiToggleComponent = new ToggleComponent(apiToggleComponentWrapper); const apiToggleComponent = new ToggleComponent(apiToggleComponentWrapper);

View file

@ -31,7 +31,7 @@ export class MediaDbSettingTab extends PluginSettingTab {
new Setting(containerEl) new Setting(containerEl)
.setName('New file location') .setName('New file location')
.setDesc('New book notes will be placed here.') .setDesc('New media db entries will be placed here.')
.addSearch(cb => { .addSearch(cb => {
new FolderSuggest(this.app, cb.inputEl); new FolderSuggest(this.app, cb.inputEl);
cb.setPlaceholder('Example: folder1/folder2') cb.setPlaceholder('Example: folder1/folder2')
@ -44,7 +44,7 @@ export class MediaDbSettingTab extends PluginSettingTab {
new Setting(containerEl) new Setting(containerEl)
.setName('OMDb API key') .setName('OMDb API key')
.setDesc('API key for www.omdbapi.com.') .setDesc('API key for "www.omdbapi.com".')
.addText(cb => { .addText(cb => {
cb.setPlaceholder('API key') cb.setPlaceholder('API key')
.setValue(this.plugin.settings.OMDbKey) .setValue(this.plugin.settings.OMDbKey)

View file

@ -1,13 +1,22 @@
.media-db-plugin-list-wrapper { .media-db-plugin-list-wrapper {
display: flex; display: flex;
align-content: center; align-content: center;
/* margin: 5px; */ margin-bottom: 5px;
} }
.media-db-plugin-list-toggle { .media-db-plugin-list-toggle {
} }
.media-db-plugin-list-text { .media-db-plugin-list-text-wrapper {
flex: 1; flex: 1;
} }
.media-db-plugin-list-text {
display: block;
}
small.media-db-plugin-list-text{
color: var(--text-muted);
}