Skip to content

Commit b03d53e

Browse files
committed
feat: bitbucket cloud support
Signed-off-by: Adam Setch <[email protected]>
1 parent 9471f62 commit b03d53e

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

src/components/AccountNotifications.tsx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import type { Notification } from '../typesGitHub';
1313
import { cn } from '../utils/cn';
1414
import {
1515
openAccountProfile,
16+
openBitbucketPulls,
1617
openGitHubIssues,
1718
openGitHubPulls,
1819
} from '../utils/links';
@@ -115,17 +116,26 @@ export const AccountNotifications: FC<IAccountNotifications> = (
115116
</div>
116117
<HoverGroup>
117118
<PlatformIcon type={account.platform} size={Size.SMALL} />
118-
<InteractionButton
119-
title="My Issues"
120-
icon={IssueOpenedIcon}
121-
size={Size.SMALL}
122-
onClick={() => openGitHubIssues(account.hostname)}
123-
/>
119+
{account.platform !== 'Bitbucket Cloud' && (
120+
<InteractionButton
121+
title="My Issues"
122+
icon={IssueOpenedIcon}
123+
size={Size.SMALL}
124+
onClick={() => openGitHubIssues(account.hostname)}
125+
/>
126+
)}
124127
<InteractionButton
125128
title="My Pull Requests"
126129
icon={GitPullRequestIcon}
127130
size={Size.SMALL}
128-
onClick={() => openGitHubPulls(account.hostname)}
131+
onClick={() => {
132+
event.stopPropagation();
133+
if (account.platform === 'Bitbucket Cloud') {
134+
openBitbucketPulls(account);
135+
} else {
136+
openGitHubPulls(account.hostname);
137+
}
138+
}}
129139
/>
130140
<InteractionButton
131141
title={toggleAccountNotificationsLabel}

src/routes/LoginWithBitbucketCloud.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export const LoginWithBitbucketCloud: FC = () => {
5252
const renderForm = (formProps: FormRenderProps) => {
5353
const { handleSubmit, submitting, pristine, values } = formProps;
5454

55+
// TODO - Correctly set account.id and account.hostname
5556
return (
5657
<form onSubmit={handleSubmit}>
5758
<FieldInput

src/utils/links.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ export function openGitHubPulls(hostname: Hostname) {
3333
openExternalLink(url.toString() as Link);
3434
}
3535

36+
export function openBitbucketPulls(account: Account) {
37+
const url = new URL(
38+
`${account.hostname.replace('api.bitbucket.org/internal/workspaces', 'bitbucket.org')}/workspace/pull-requests/?user_filter=ALL&author=${account.user.id}`,
39+
);
40+
openExternalLink(url.toString() as Link);
41+
}
42+
3643
export function openAccountProfile(account: Account) {
3744
if (account.platform === 'Bitbucket Cloud') {
3845
openExternalLink('https://bitbucket.org/account/settings/' as Link);

0 commit comments

Comments
 (0)