MCPcopy
hub / github.com/remotely-save/remotely-save / generateKoofrSettingsPart

Function generateKoofrSettingsPart

pro/src/settingsKoofr.ts:199–367  ·  view source on GitHub ↗
(
  containerEl: HTMLElement,
  t: (x: TransItemType, vars?: any) => string,
  app: App,
  plugin: RemotelySavePlugin,
  saveUpdatedConfigFunc: () => Promise<any> | undefined
)

Source from the content-addressed store, hash-verified

197}
198
199export 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 {

Callers 1

displayMethod · 0.90

Calls 4

stringToFragmentFunction · 0.90
getClientFunction · 0.90
saveSettingsMethod · 0.80
checkConnectMethod · 0.45

Tested by

no test coverage detected