webui: hide GitHub link in push dialog for non-GitHub remotes
Only show "Open on GitHub" button when pushing to GitHub remotes.
The dialog now checks the remote's is_github property before generating
a branch URL, returning empty string for non-GitHub remotes.
Changes:
- Modified _computeBranchURL() to check selectedRemote.is_github
- Added test coverage for GitHub, GitLab, and self-hosted remotes
- Updated demo mock to include non-GitHub remotes for testing
This prevents the confusing "Open on GitHub" button from appearing
when pushing to GitLab, self-hosted Git servers, or other non-GitHub
remote repositories.
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: sb441bfcebf8fea07k
diff --git a/webui/src/web-components/sketch-push-button.ts b/webui/src/web-components/sketch-push-button.ts
index 3d0a4b0..c6e2ad7 100644
--- a/webui/src/web-components/sketch-push-button.ts
+++ b/webui/src/web-components/sketch-push-button.ts
@@ -187,7 +187,7 @@
private _computeBranchURL(): string {
const selectedRemote = this._getSelectedRemote();
- if (!selectedRemote) {
+ if (!selectedRemote || !selectedRemote.is_github) {
return "";
}
return `https://github.com/${selectedRemote?.display_name}/tree/${this._branch}`;