Skip to content

Commit 5c4edad

Browse files
committed
Add github link from issue count
1 parent c2f2cce commit 5c4edad

File tree

5 files changed

+65
-8
lines changed

5 files changed

+65
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@
770770
},
771771
"githubIssues.taskDashboard.query": {
772772
"type": "string",
773-
"default": "is:open assignee:@me milestone:\"September 2025\"",
773+
"default": "state:open assignee:@me milestone:\"September 2025\"",
774774
"description": "The GitHub query to use for the task dashboard"
775775
}
776776
}

src/github/dashboardWebviewProvider.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ export interface DashboardReady {
2626
issueQuery: string;
2727
activeSessions: SessionData[];
2828
milestoneIssues: IssueData[];
29+
repository?: {
30+
owner: string;
31+
name: string;
32+
};
2933
}
3034

3135
export interface GlobalDashboardLoading {
@@ -163,11 +167,23 @@ export class DashboardWebviewProvider extends WebviewBase {
163167
}
164168

165169
const data = await this.getDashboardData();
170+
171+
// Get current repository info
172+
let repository: { owner: string; name: string } | undefined;
173+
const targetRepos = this.getTargetRepositories();
174+
if (targetRepos.length > 0) {
175+
const [owner, name] = targetRepos[0].split('/');
176+
if (owner && name) {
177+
repository = { owner, name };
178+
}
179+
}
180+
166181
const readyData: DashboardReady = {
167182
state: 'ready',
168183
issueQuery: this._issueQuery,
169184
activeSessions: data.activeSessions,
170-
milestoneIssues: data.milestoneIssues
185+
milestoneIssues: data.milestoneIssues,
186+
repository
171187
};
172188
this._postMessage({
173189
command: 'update-dashboard',
@@ -568,6 +584,9 @@ export class DashboardWebviewProvider extends WebviewBase {
568584
case 'start-remote-agent':
569585
await this.startRemoteAgent(message.args?.issue);
570586
break;
587+
case 'open-external-url':
588+
await vscode.env.openExternal(vscode.Uri.parse(message.args.url));
589+
break;
571590
default:
572591
await super._onDidReceiveMessage(message);
573592
break;

webviews/dashboardView/app.tsx

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { IssueItem } from './components/IssueItem';
1313
import { LoadingState } from './components/LoadingState';
1414
import { SessionItem } from './components/SessionItem';
1515
import { SortDropdown } from './components/SortDropdown';
16-
import { DashboardState, extractMilestoneFromQuery, IssueData, ProjectData, SessionData, vscode } from './types';
16+
import { DashboardReady, DashboardState, extractMilestoneFromQuery, GlobalDashboardReady, IssueData, ProjectData, SessionData, vscode } from './types';
1717

1818
export function main() {
1919
render(<Dashboard />, document.getElementById('app'));
@@ -113,6 +113,24 @@ function Dashboard() {
113113
});
114114
}, []);
115115

116+
const handleIssueCountClick = useCallback(() => {
117+
if (dashboardState?.state === 'ready' && !dashboardState.isGlobal) {
118+
const readyState = dashboardState as DashboardReady;
119+
const { owner, name } = readyState.repository || { owner: '', name: '' };
120+
121+
if (owner && name) {
122+
const githubQuery = readyState.issueQuery;
123+
124+
const githubUrl = `https://github.com/${owner}/${name}/issues?q=${encodeURIComponent(githubQuery)}`;
125+
// Open in external browser
126+
vscode.postMessage({
127+
command: 'open-external-url',
128+
args: { url: githubUrl }
129+
});
130+
}
131+
}
132+
}, [dashboardState]);
133+
116134
// Sort issues based on selected option
117135
const getSortedIssues = useCallback((issues: readonly IssueData[]) => {
118136
if (!issues) return [];
@@ -149,12 +167,12 @@ function Dashboard() {
149167
});
150168
}, [dashboardState]);
151169

152-
// Derived state from discriminated union
170+
// Derived state from discriminated union with proper type narrowing
153171
const isGlobal = dashboardState?.isGlobal;
154-
const issueQuery = dashboardState && !dashboardState.isGlobal ? (dashboardState.issueQuery || '') : '';
155-
const milestoneIssues = !dashboardState?.isGlobal && dashboardState?.state === 'ready' && !dashboardState.isGlobal ? dashboardState.milestoneIssues : [];
172+
const issueQuery = dashboardState && !dashboardState.isGlobal ? (dashboardState as DashboardReady).issueQuery || '' : '';
173+
const milestoneIssues = dashboardState && !dashboardState.isGlobal && dashboardState.state === 'ready' ? (dashboardState as DashboardReady).milestoneIssues : [];
156174
const activeSessions = dashboardState?.state === 'ready' ? dashboardState.activeSessions : [];
157-
const recentProjects = dashboardState?.isGlobal && dashboardState?.state === 'ready' && dashboardState.isGlobal ? dashboardState.recentProjects : [];
175+
const recentProjects = dashboardState && dashboardState.isGlobal && dashboardState.state === 'ready' ? (dashboardState as GlobalDashboardReady).recentProjects : [];
158176

159177
// For global dashboards, create a mixed array of sessions and projects
160178
const mixedItems = isGlobal ? (() => {
@@ -244,7 +262,11 @@ function Dashboard() {
244262
)}
245263
</div>
246264
{dashboardState?.state === 'ready' && (
247-
<div className="section-count">
265+
<div
266+
className="section-count clickable-count"
267+
onClick={handleIssueCountClick}
268+
title="Click to open GitHub issues"
269+
>
248270
{milestoneIssues.length || 0} issue{milestoneIssues.length !== 1 ? 's' : ''}
249271
</div>
250272
)}

webviews/dashboardView/index.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,18 @@ body {
9090
margin-bottom: 8px;
9191
}
9292

93+
/* Clickable count indicator */
94+
.section-count.clickable-count {
95+
cursor: pointer;
96+
transition: color 0.2s;
97+
text-decoration: underline;
98+
text-decoration-style: dotted;
99+
}
100+
101+
.section-count.clickable-count:hover {
102+
color: var(--vscode-textLink-foreground);
103+
}
104+
93105
/* Section header with count and sort dropdown */
94106
.section-header {
95107
display: flex;

webviews/dashboardView/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ export interface DashboardReady {
5151
readonly issueQuery: string;
5252
readonly activeSessions: readonly SessionData[];
5353
readonly milestoneIssues: readonly IssueData[];
54+
readonly repository?: {
55+
readonly owner: string;
56+
readonly name: string;
57+
};
5458
}
5559

5660
export interface GlobalDashboardLoading {

0 commit comments

Comments
 (0)