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

Function generatePCloudSettingsPart

pro/src/settingsPCloud.ts:136–311  ·  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

134}
135
136export const generatePCloudSettingsPart = (
137 containerEl: HTMLElement,
138 t: (x: TransItemType, vars?: any) => string,
139 app: App,
140 plugin: RemotelySavePlugin,
141 saveUpdatedConfigFunc: () => Promise<any> | undefined
142) => {
143 const pCloudDiv = containerEl.createEl("div", {
144 cls: "pcloud-hide",
145 });
146 pCloudDiv.toggleClass(
147 "pcloud-hide",
148 plugin.settings.serviceType !== "pcloud"
149 );
150 pCloudDiv.createEl("h2", { text: t("settings_pcloud") });
151
152 const pcloudLongDescDiv = pCloudDiv.createEl("div", {
153 cls: "settings-long-desc",
154 });
155 for (const c of [
156 t("settings_pcloud_disclaimer1"),
157 t("settings_pcloud_disclaimer2"),
158 ]) {
159 pcloudLongDescDiv.createEl("p", {
160 text: c,
161 cls: "pcloud-disclaimer",
162 });
163 }
164
165 pcloudLongDescDiv.createEl("p", {
166 text: t("settings_pcloud_folder", {
167 remoteBaseDir:
168 plugin.settings.pcloud.remoteBaseDir || app.vault.getName(),
169 }),
170 });
171
172 pcloudLongDescDiv.createDiv({
173 text: stringToFragment(t("settings_pcloud_pro_desc")),
174 cls: "pcloud-disclaimer",
175 });
176
177 const pCloudNotShowUpHintSetting = new Setting(pCloudDiv)
178 .setName(t("settings_pcloud_notshowuphint"))
179 .setDesc(t("settings_pcloud_notshowuphint_desc"))
180 .addButton(async (button) => {
181 button.setButtonText(t("settings_pcloud_notshowuphint_view_pro"));
182 button.onClick(async () => {
183 window.location.href = "#settings-pro";
184 });
185 });
186
187 const pCloudAllowedToUsedDiv = pCloudDiv.createDiv();
188 // if pro enabled, show up; otherwise hide.
189 const allowPCloud =
190 plugin.settings.pro?.enabledProFeatures.filter(
191 (x) => x.featureName === "feature-pcloud"
192 ).length === 1;
193 console.debug(`allow to show up pcloud settings? ${allowPCloud}`);

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