( container: HTMLElement, plugin: TaskNotesPlugin, save: () => void )
| 50 | * Renders the Appearance & UI tab - visual customization settings |
| 51 | */ |
| 52 | export function renderAppearanceTab( |
| 53 | container: HTMLElement, |
| 54 | plugin: TaskNotesPlugin, |
| 55 | save: () => void |
| 56 | ): void { |
| 57 | container.empty(); |
| 58 | |
| 59 | const translate = (key: TranslationKey, params?: Record<string, string | number>) => |
| 60 | plugin.i18n.translate(key, params); |
| 61 | |
| 62 | // Task Cards Section |
| 63 | const availableProperties = getAvailableProperties(plugin); |
| 64 | const currentProperties = plugin.settings.defaultVisibleProperties || []; |
| 65 | const currentLabels = getPropertyLabels(plugin, currentProperties); |
| 66 | |
| 67 | createSettingGroup( |
| 68 | container, |
| 69 | { |
| 70 | heading: translate("settings.appearance.taskCards.header"), |
| 71 | description: translate("settings.appearance.taskCards.description"), |
| 72 | }, |
| 73 | (group) => { |
| 74 | group.addSetting((setting) => { |
| 75 | setting |
| 76 | .setName( |
| 77 | translate("settings.appearance.taskCards.defaultVisibleProperties.name") |
| 78 | ) |
| 79 | .setDesc( |
| 80 | translate( |
| 81 | "settings.appearance.taskCards.defaultVisibleProperties.description" |
| 82 | ) |
| 83 | ) |
| 84 | .addButton((button) => { |
| 85 | button.setButtonText("Configure").onClick(() => { |
| 86 | const modal = new PropertySelectorModal( |
| 87 | plugin.app, |
| 88 | availableProperties, |
| 89 | currentProperties, |
| 90 | async (selected) => { |
| 91 | plugin.settings.defaultVisibleProperties = selected; |
| 92 | save(); |
| 93 | new Notice("Default task card properties updated"); |
| 94 | // Re-render to update display |
| 95 | renderAppearanceTab(container, plugin, save); |
| 96 | }, |
| 97 | "Select Default Task Card Properties", |
| 98 | "Choose which properties to display in task cards (views, kanban, etc.). Selected properties will appear in the order shown below." |
| 99 | ); |
| 100 | modal.open(); |
| 101 | }); |
| 102 | }); |
| 103 | }); |
| 104 | |
| 105 | // Show currently selected properties |
| 106 | group.addSetting((setting) => { |
| 107 | setting.setDesc(`Currently showing: ${currentLabels.join(", ")}`); |
| 108 | setting.settingEl.addClass("settings-view__group-description"); |
| 109 | }); |
nothing calls this directly
no test coverage detected