mirror of
https://github.com/gearheaded/obsidian-github-contributions.git
synced 2026-07-22 07:43:36 +00:00
fix: remove builtin-modules, avoid newer ButtonComponent APIs
This commit is contained in:
parent
f5143e8216
commit
73773014e9
5 changed files with 34 additions and 24 deletions
24
main.js
24
main.js
|
|
@ -1009,7 +1009,8 @@ var GitHubContributionsSettingTab = class extends import_obsidian.PluginSettingT
|
|||
const oauthSetting = new import_obsidian.Setting(containerEl).setName("Connect GitHub account").setDesc("Click to start the authorization flow");
|
||||
oauthSetting.addButton(
|
||||
(btn) => btn.setButtonText("Connect GitHub").setCta().onClick(async () => {
|
||||
btn.setButtonText("Connecting...").setDisabled(true);
|
||||
btn.setButtonText("Connecting...");
|
||||
btn.buttonEl.setAttr("disabled", "true");
|
||||
cancelled = false;
|
||||
try {
|
||||
const device = await requestDeviceCode();
|
||||
|
|
@ -1040,7 +1041,8 @@ var GitHubContributionsSettingTab = class extends import_obsidian.PluginSettingT
|
|||
oauthSetting.setDesc("\u26A0 " + msg);
|
||||
new import_obsidian.Notice("GitHub connection failed: " + msg);
|
||||
}
|
||||
btn.setButtonText("Connect GitHub").setDisabled(false);
|
||||
btn.setButtonText("Connect GitHub");
|
||||
btn.buttonEl.removeAttribute("disabled");
|
||||
}
|
||||
})
|
||||
);
|
||||
|
|
@ -1048,7 +1050,7 @@ var GitHubContributionsSettingTab = class extends import_obsidian.PluginSettingT
|
|||
(btn) => btn.setButtonText("Cancel").onClick(() => {
|
||||
cancelled = true;
|
||||
oauthSetting.setDesc("Cancelled.");
|
||||
btn.setDisabled(true);
|
||||
btn.buttonEl.setAttr("disabled", "true");
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
@ -1075,14 +1077,18 @@ var GitHubContributionsSettingTab = class extends import_obsidian.PluginSettingT
|
|||
t.onChange((v) => {
|
||||
this.plugin.settings.localRepoRoot = v.trim();
|
||||
});
|
||||
}).addButton(
|
||||
(btn) => btn.setButtonText("Scan").setTooltip("Save path and scan for repositories").onClick(async () => {
|
||||
btn.setButtonText("Scanning\u2026").setDisabled(true);
|
||||
}).addButton((btn) => {
|
||||
btn.setButtonText("Scan");
|
||||
btn.buttonEl.setAttr("title", "Save path and scan for repositories");
|
||||
btn.onClick(async () => {
|
||||
btn.setButtonText("Scanning\u2026");
|
||||
btn.buttonEl.setAttr("disabled", "true");
|
||||
await this.plugin.saveSettings();
|
||||
btn.setButtonText("Scan").setDisabled(false);
|
||||
btn.setButtonText("Scan");
|
||||
btn.buttonEl.removeAttribute("disabled");
|
||||
new import_obsidian.Notice("Repo scan complete - refresh the panel to see results");
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
new import_obsidian.Setting(containerEl).setName("Scan depth").setDesc("How many folder levels deep to search for git repos").addDropdown(
|
||||
(d) => d.addOption("2", "2 levels").addOption("3", "3 levels").addOption("4", "4 levels").addOption("5", "5 levels").addOption("0", "Unlimited (slow on large drives)").setValue(String(this.plugin.settings.scanDepth)).onChange(async (v) => {
|
||||
this.plugin.settings.scanDepth = parseInt(v);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "github-contributions",
|
||||
"name": "GitHub Contributions",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"minAppVersion": "1.0.0",
|
||||
"description": "View GitHub and local Git contributions directly in the sidebar with streak tracking, repository breakdowns, color palettes, and daily note integration.",
|
||||
"author": "gearheaded",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "obsidian-github-contributions",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"description": "GitHub contribution graph for Obsidian",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
@ -14,7 +14,6 @@
|
|||
"@types/node": "^16.11.6",
|
||||
"@typescript-eslint/eslint-plugin": "5.29.0",
|
||||
"@typescript-eslint/parser": "5.29.0",
|
||||
"builtin-modules": "3.3.0",
|
||||
"esbuild": "0.17.3",
|
||||
"obsidian": "latest",
|
||||
"tslib": "^2.4.0",
|
||||
|
|
|
|||
26
src/main.ts
26
src/main.ts
|
|
@ -1327,7 +1327,8 @@ class GitHubContributionsSettingTab extends PluginSettingTab {
|
|||
.setButtonText("Connect GitHub")
|
||||
.setCta()
|
||||
.onClick(async () => {
|
||||
btn.setButtonText("Connecting...").setDisabled(true);
|
||||
btn.setButtonText("Connecting...");
|
||||
btn.buttonEl.setAttr("disabled", "true");
|
||||
cancelled = false;
|
||||
try {
|
||||
const device = await requestDeviceCode();
|
||||
|
|
@ -1365,14 +1366,15 @@ class GitHubContributionsSettingTab extends PluginSettingTab {
|
|||
oauthSetting.setDesc("⚠ " + msg);
|
||||
new Notice("GitHub connection failed: " + msg);
|
||||
}
|
||||
btn.setButtonText("Connect GitHub").setDisabled(false);
|
||||
btn.setButtonText("Connect GitHub");
|
||||
btn.buttonEl.removeAttribute("disabled");
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
oauthSetting.addButton(btn => btn
|
||||
.setButtonText("Cancel")
|
||||
.onClick(() => { cancelled = true; oauthSetting.setDesc("Cancelled."); btn.setDisabled(true); })
|
||||
.onClick(() => { cancelled = true; oauthSetting.setDesc("Cancelled."); btn.buttonEl.setAttr("disabled", "true"); })
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1405,16 +1407,18 @@ class GitHubContributionsSettingTab extends PluginSettingTab {
|
|||
// Store value in memory as user types but don't save/scan yet
|
||||
t.onChange(v => { this.plugin.settings.localRepoRoot = v.trim(); });
|
||||
})
|
||||
.addButton(btn => btn
|
||||
.setButtonText("Scan")
|
||||
.setTooltip("Save path and scan for repositories")
|
||||
.onClick(async () => {
|
||||
btn.setButtonText("Scanning…").setDisabled(true);
|
||||
.addButton(btn => {
|
||||
btn.setButtonText("Scan");
|
||||
btn.buttonEl.setAttr("title", "Save path and scan for repositories");
|
||||
btn.onClick(async () => {
|
||||
btn.setButtonText("Scanning…");
|
||||
btn.buttonEl.setAttr("disabled", "true");
|
||||
await this.plugin.saveSettings();
|
||||
btn.setButtonText("Scan").setDisabled(false);
|
||||
btn.setButtonText("Scan");
|
||||
btn.buttonEl.removeAttribute("disabled");
|
||||
new Notice("Repo scan complete - refresh the panel to see results");
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName("Scan depth")
|
||||
|
|
|
|||
|
|
@ -2,5 +2,6 @@
|
|||
"1.0.0": "0.15.0",
|
||||
"1.0.1": "0.15.0",
|
||||
"1.0.2": "0.15.0",
|
||||
"1.0.3": "1.0.0"
|
||||
"1.0.3": "1.0.0",
|
||||
"1.0.4": "1.0.0"
|
||||
}
|
||||
Loading…
Reference in a new issue