Skip to content

Commit b75f785

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

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

src/components/Sidebar.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { quitApp } from '../utils/comms';
1515
import Constants from '../utils/constants';
1616
import { getFilterCount } from '../utils/helpers';
1717
import {
18+
openBitbucketPulls,
1819
openGitHubIssues,
1920
openGitHubNotifications,
2021
openGitHubPulls,
@@ -38,8 +39,10 @@ export const Sidebar: FC = () => {
3839
} = useContext(AppContext);
3940

4041
// We naively assume that the first account is the primary account for the purposes of our sidebar quick links
42+
const primaryAccount = auth.accounts[0];
43+
4144
const primaryAccountHostname =
42-
auth.accounts[0]?.hostname ?? Constants.DEFAULT_AUTH_OPTIONS.hostname;
45+
primaryAccount?.hostname ?? Constants.DEFAULT_AUTH_OPTIONS.hostname;
4346

4447
const toggleFilters = () => {
4548
if (location.pathname.startsWith('/filters')) {
@@ -91,16 +94,24 @@ export const Sidebar: FC = () => {
9194
onClick={() => openGitHubNotifications(primaryAccountHostname)}
9295
/>
9396

94-
<SidebarButton
95-
title="My Issues"
96-
icon={IssueOpenedIcon}
97-
onClick={() => openGitHubIssues(primaryAccountHostname)}
98-
/>
97+
{primaryAccount?.platform !== 'Bitbucket Cloud' && (
98+
<SidebarButton
99+
title="My Issues"
100+
icon={IssueOpenedIcon}
101+
onClick={() => openGitHubIssues(primaryAccountHostname)}
102+
/>
103+
)}
99104

100105
<SidebarButton
101106
title="My Pull Requests"
102107
icon={GitPullRequestIcon}
103-
onClick={() => openGitHubPulls(primaryAccountHostname)}
108+
onClick={() => {
109+
if (primaryAccount?.platform === 'Bitbucket Cloud') {
110+
openBitbucketPulls(primaryAccount);
111+
} else {
112+
openGitHubPulls(primaryAccountHostname);
113+
}
114+
}}
104115
/>
105116
</div>
106117

0 commit comments

Comments
 (0)