( containerEl: HTMLElement, t: (x: TransItemType, vars?: any) => string, app: App, plugin: RemotelySavePlugin, saveUpdatedConfigFunc: () => Promise<any> | undefined )
| 197 | } |
| 198 | |
| 199 | export const generateKoofrSettingsPart = ( |
| 200 | containerEl: HTMLElement, |
| 201 | t: (x: TransItemType, vars?: any) => string, |
| 202 | app: App, |
| 203 | plugin: RemotelySavePlugin, |
| 204 | saveUpdatedConfigFunc: () => Promise<any> | undefined |
| 205 | ) => { |
| 206 | const koofrDiv = containerEl.createEl("div", { |
| 207 | cls: "koofr-hide", |
| 208 | }); |
| 209 | koofrDiv.toggleClass("koofr-hide", plugin.settings.serviceType !== "koofr"); |
| 210 | koofrDiv.createEl("h2", { text: t("settings_koofr") }); |
| 211 | |
| 212 | const koofrLongDescDiv = koofrDiv.createEl("div", { |
| 213 | cls: "settings-long-desc", |
| 214 | }); |
| 215 | for (const c of [ |
| 216 | t("settings_koofr_disclaimer1"), |
| 217 | t("settings_koofr_disclaimer2"), |
| 218 | ]) { |
| 219 | koofrLongDescDiv.createEl("p", { |
| 220 | text: c, |
| 221 | cls: "koofr-disclaimer", |
| 222 | }); |
| 223 | } |
| 224 | |
| 225 | koofrLongDescDiv.createEl("p", { |
| 226 | text: t("settings_koofr_folder", { |
| 227 | remoteBaseDir: plugin.settings.koofr.remoteBaseDir || app.vault.getName(), |
| 228 | }), |
| 229 | }); |
| 230 | |
| 231 | koofrLongDescDiv.createDiv({ |
| 232 | text: stringToFragment(t("settings_koofr_pro_desc")), |
| 233 | cls: "koofr-disclaimer", |
| 234 | }); |
| 235 | |
| 236 | const koofrNotShowUpHintSetting = new Setting(koofrDiv) |
| 237 | .setName(t("settings_koofr_notshowuphint")) |
| 238 | .setDesc(t("settings_koofr_notshowuphint_desc")) |
| 239 | .addButton(async (button) => { |
| 240 | button.setButtonText(t("settings_koofr_notshowuphint_view_pro")); |
| 241 | button.onClick(async () => { |
| 242 | window.location.href = "#settings-pro"; |
| 243 | }); |
| 244 | }); |
| 245 | |
| 246 | const koofrAllowedToUsedDiv = koofrDiv.createDiv(); |
| 247 | // if pro enabled, show up; otherwise hide. |
| 248 | const allowKoofr = |
| 249 | plugin.settings.pro?.enabledProFeatures.filter( |
| 250 | (x) => x.featureName === "feature-koofr" |
| 251 | ).length === 1; |
| 252 | console.debug(`allow to show up koofr settings? ${allowKoofr}`); |
| 253 | if (allowKoofr) { |
| 254 | koofrAllowedToUsedDiv.removeClass("koofr-allow-to-use-hide"); |
| 255 | koofrNotShowUpHintSetting.settingEl.addClass("koofr-allow-to-use-hide"); |
| 256 | } else { |
no test coverage detected