Skip to content

Commit

Permalink
refactor(settings): optimize descriptions and titles of settings
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianWoelki committed Jan 1, 2024
1 parent 0bb4fd8 commit 61f4dd1
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/settings/ui/customIconPack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default class CustomIconPackSetting extends IconFolderSetting {
public display(): void {
new Setting(this.containerEl)
.setName('Add custom icon pack')
.setDesc('Add a custom icon pack')
.setDesc('Add a custom icon pack.')
.addText((text) => {
text.setPlaceholder('Your icon pack name');
this.textComponent = text;
Expand Down
4 changes: 3 additions & 1 deletion src/settings/ui/customIconRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ export default class CustomIconRuleSetting extends IconFolderSetting {
public display(): void {
new Setting(this.containerEl)
.setName('Add icon rule')
.setDesc('Will add the icon based on the specific string.')
.setDesc(
'Will add the icon based on the defined rule (as a plain string or in regex format).',
)
.addText((text) => {
text.onChange((value) => {
this.chooseIconBtn.setDisabled(value.length === 0);
Expand Down
2 changes: 1 addition & 1 deletion src/settings/ui/emojiStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import iconTabs from '../../lib/icon-tabs';
export default class EmojiStyleSetting extends IconFolderSetting {
public display(): void {
const emojiStyle = new Setting(this.containerEl)
.setName('Emoji Style')
.setName('Emoji style')
.setDesc('Change the style of your emojis.');
emojiStyle.addDropdown((dropdown) => {
dropdown.addOption('none', 'None');
Expand Down
2 changes: 1 addition & 1 deletion src/settings/ui/iconPacksBackgroundChecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import IconFolderSetting from './iconFolderSetting';
export default class IconPacksBackgroundChecker extends IconFolderSetting {
public display(): void {
new Setting(this.containerEl)
.setName('Icons Background Check')
.setName('Icons background check')
.setDesc(
'Check in the background on every load of Obsidian, if icons are missing and it will try to add them to the specific icon pack.',
)
Expand Down
4 changes: 2 additions & 2 deletions src/settings/ui/iconPacksPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export default class IconPacksPathSetting extends IconFolderSetting {

public display(): void {
const iconPacksPathSetting = new Setting(this.containerEl)
.setName('Icon Packs folder path')
.setDesc('Change the default icon packs folder path');
.setName('Icon packs folder path')
.setDesc('Change the default icon packs folder path.');

iconPacksPathSetting.addText((text) => {
this.iconPacksSettingTextComp = text;
Expand Down
19 changes: 11 additions & 8 deletions src/settings/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,33 @@ export default class IconFolderSettings extends PluginSettingTab {
const { plugin, containerEl, app } = this;
containerEl.empty();

containerEl.createEl('h2', { text: 'Icon Folder Settings' });
containerEl.createEl('h1', { text: 'General' });
new RecentlyUsedIconsSetting(plugin, containerEl).display();
new IconPacksPathSetting(plugin, containerEl).display();
new IconPacksBackgroundChecker(plugin, containerEl).display();
new EmojiStyleSetting(plugin, containerEl).display();
containerEl.createEl('h3', { text: 'Visibility of icons' });
new ToggleIconInTabs(plugin, containerEl).display();
new ToggleIconInTitle(plugin, containerEl).display();
new ToggleFrontmatterIcon(plugin, containerEl).display();
new ToggleIconsInNotes(plugin, containerEl).display();

containerEl.createEl('h3', { text: 'Icon Packs' });
containerEl.createEl('h1', {
text: 'Icon customization for files/folders',
});
new IconFontSizeSetting(plugin, containerEl).display();
new IconColorSetting(plugin, containerEl).display();
new ExtraMarginSetting(plugin, containerEl).display();

containerEl.createEl('h1', { text: 'Icon packs' });
new PredefinedIconPacksSetting(plugin, containerEl, app, () =>
this.display(),
).display();
new CustomIconPackSetting(plugin, containerEl, () =>
this.display(),
).display();

containerEl.createEl('h3', { text: 'Icon Customization' });
new IconFontSizeSetting(plugin, containerEl).display();
new IconColorSetting(plugin, containerEl).display();
new ExtraMarginSetting(plugin, containerEl).display();

containerEl.createEl('h3', { text: 'Custom Icon Rules' });
containerEl.createEl('h1', { text: 'Custom icon rules' });
new CustomIconRuleSetting(plugin, containerEl, app, () =>
this.display(),
).display();
Expand Down
2 changes: 1 addition & 1 deletion src/settings/ui/predefinedIconPacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class PredefinedIconPacksSetting extends IconFolderSetting {
public display(): void {
new Setting(this.containerEl)
.setName('Add predefined icon pack')
.setDesc('Add an icon pack like FontAwesome or Remixicons')
.setDesc('Add a predefined icon pack that is officially supported.')
.addButton((btn) => {
btn.setButtonText('Browse icon packs');
btn.onClick(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/settings/ui/recentlyUsedIcons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { DEFAULT_SETTINGS } from '../data';
export default class RecentlyUsedIconsSetting extends IconFolderSetting {
public display(): void {
new Setting(this.containerEl)
.setName('Recently used Icons limit')
.setName('Recently used icons limit')
.setDesc(
'Change the limit for the recently used icons displayed in the icon modal.',
'Change the limit for the recently used icons displayed in the icon selection modal.',
)
.addSlider((slider) => {
slider
Expand Down
2 changes: 1 addition & 1 deletion src/settings/ui/toggleIconInTabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TabHeaderLeaf } from '../../@types/obsidian';
export default class ToggleIconInTabs extends IconFolderSetting {
public display(): void {
new Setting(this.containerEl)
.setName('Toggle Icon in Tabs')
.setName('Toggle icon in tabs')
.setDesc('Toggles the visibility of an icon for a file in the tab bar.')
.addToggle((toggle) => {
toggle
Expand Down
4 changes: 2 additions & 2 deletions src/settings/ui/toggleIconInTitle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { InlineTitleView } from '../../@types/obsidian';
export default class ToggleIconInTitle extends IconFolderSetting {
public display(): void {
new Setting(this.containerEl)
.setName('Toggle Icon in Title')
.setDesc('Toggles the visibility of an icon for a file above the title.')
.setName('Toggle icon in title')
.setDesc('Toggles the visibility of an icon above the title of a file.')
.addToggle((toggle) => {
toggle
.setValue(this.plugin.getSettings().iconInTitleEnabled)
Expand Down
2 changes: 1 addition & 1 deletion src/settings/ui/toggleIconsInNotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import config from '@app/config';
export default class ToggleIconsInEditor extends IconFolderSetting {
public display(): void {
new Setting(this.containerEl)
.setName('Toggle Icons while editing notes')
.setName('Toggle icons while editing notes')
.setDesc(
'Toggles whether you are able to add and see icons in your notes and editor (e.g., ability to have :LiSofa: as an icon in your notes).',
)
Expand Down

0 comments on commit 61f4dd1

Please sign in to comment.