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