Skip to content

Commit ae60b34

Browse files
committed
Add missing bitbucket case in getSourceControlPresentation switch
The switch statement in getSourceControlPresentation handled github, gitlab, azure-devops, and change-request but omitted bitbucket. When a Bitbucket provider was active, the function returned undefined, causing runtime crashes in components destructuring .terminology or .Icon from the result. Add a BitbucketIcon SVG component and the corresponding bitbucket case.
1 parent 09485ee commit ae60b34

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

apps/web/src/components/Icons.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ export const AzureDevOpsIcon: Icon = (props) => (
3030
</svg>
3131
);
3232

33+
export const BitbucketIcon: Icon = (props) => (
34+
<svg {...props} viewBox="0 0 24 24" fill="currentColor">
35+
<path d="M2.65 3C2.3 3 2 3.3 2 3.68l2.73 16.59a1.2 1.2 0 0 0 1.18 1h12.39a.88.88 0 0 0 .87-.74L22 3.68A.67.67 0 0 0 21.35 3H2.65Zm11.9 12.41H9.46l-1.2-6.34h7.6l-1.31 6.34Z" />
36+
</svg>
37+
);
38+
3339
export const CursorIcon: Icon = ({ className, ...props }) => (
3440
<svg
3541
{...props}

apps/web/src/sourceControlPresentation.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { GitPullRequestIcon } from "lucide-react";
22
import type { ElementType } from "react";
33
import type { SourceControlProviderInfo } from "@t3tools/contracts";
4-
import { AzureDevOpsIcon, GitHubIcon, GitLabIcon } from "./components/Icons";
4+
import { AzureDevOpsIcon, BitbucketIcon, GitHubIcon, GitLabIcon } from "./components/Icons";
55

66
export interface ChangeRequestPresentation {
77
readonly icon: "github" | "gitlab" | "azure-devops" | "bitbucket" | "change-request";
@@ -151,6 +151,12 @@ export function getSourceControlPresentation(
151151
terminology: getChangeRequestTerminology(provider),
152152
Icon: AzureDevOpsIcon,
153153
};
154+
case "bitbucket":
155+
return {
156+
providerName: provider?.name || presentation.providerName,
157+
terminology: getChangeRequestTerminology(provider),
158+
Icon: BitbucketIcon,
159+
};
154160
case "change-request":
155161
return {
156162
providerName: provider?.name || presentation.providerName,

0 commit comments

Comments
 (0)