Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Improve clarity of the main Settings window #460

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/gui/choiceList/AddChoiceBox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@
font-size: 16px;
padding: 3px;
border-radius: 3px;
appearance: auto;
}
</style>
5 changes: 3 additions & 2 deletions src/gui/choiceList/ChoiceListItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@
$: {
if (nameElement) {
nameElement.innerHTML = "";
const nameHTML = htmlToMarkdown(choice.name);
const typeHTML = htmlToMarkdown(choice.type);
const nameHTMLWithChoiceType = `**${typeHTML}:** ${choice.name}`;
MarkdownRenderer.renderMarkdown(
nameHTML,
nameHTMLWithChoiceType,
nameElement,
"/",
null as unknown as Component
Expand Down
83 changes: 43 additions & 40 deletions src/quickAddSettingsTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,50 +55,13 @@ export class QuickAddSettingsTab extends PluginSettingTab {
containerEl.empty();
containerEl.createEl("h2", { text: "QuickAdd Settings" });

this.addChoicesSetting();
containerEl.createEl("h3", { text: "General Settings" });
this.addUseMultiLineInputPromptSetting();
this.addTemplateFolderPathSetting();
this.addAnnounceUpdatesSetting();
}

addAnnounceUpdatesSetting() {
const setting = new Setting(this.containerEl);
setting.setName("Announce Updates");
setting.setDesc(
"Display release notes when a new version is installed. This includes new features, demo videos, and bug fixes."
);
setting.addToggle((toggle) => {
toggle.setValue(settingsStore.getState().announceUpdates);
toggle.onChange((value) => {
settingsStore.setState({ announceUpdates: value });
});
});
}

hide(): void {
if (this.choiceView) this.choiceView.$destroy();
}

private addChoicesSetting(): void {
const setting = new Setting(this.containerEl);
setting.infoEl.remove();
setting.settingEl.style.display = "block";

this.choiceView = new ChoiceView({
target: setting.settingEl,
props: {
app: this.app,
plugin: this.plugin,
choices: settingsStore.getState().choices,
saveChoices: (choices: IChoice[]) => {
settingsStore.setState({ choices });
},
macros: settingsStore.getState().macros,
saveMacros: (macros: IMacro[]) => {
settingsStore.setState({ macros });
},
},
});
containerEl.createEl("h3", { text: "List of individual Choices (Templates, Captures, Macros)" });
this.addChoicesSetting();
}

private addUseMultiLineInputPromptSetting() {
Expand Down Expand Up @@ -150,4 +113,44 @@ export class QuickAddSettingsTab extends PluginSettingTab {
);
});
}

addAnnounceUpdatesSetting() {
const setting = new Setting(this.containerEl);
setting.setName("Announce Updates");
setting.setDesc(
"Display release notes when a new version is installed. This includes new features, demo videos, and bug fixes."
);
setting.addToggle((toggle) => {
toggle.setValue(settingsStore.getState().announceUpdates);
toggle.onChange((value) => {
settingsStore.setState({ announceUpdates: value });
});
});
}

hide(): void {
if (this.choiceView) this.choiceView.$destroy();
}

private addChoicesSetting(): void {
const setting = new Setting(this.containerEl);
setting.infoEl.remove();
setting.settingEl.style.display = "block";

this.choiceView = new ChoiceView({
target: setting.settingEl,
props: {
app: this.app,
plugin: this.plugin,
choices: settingsStore.getState().choices,
saveChoices: (choices: IChoice[]) => {
settingsStore.setState({ choices });
},
macros: settingsStore.getState().macros,
saveMacros: (macros: IMacro[]) => {
settingsStore.setState({ macros });
},
},
});
}
}