Skip to content

Commit 97a7808

Browse files
committed
complexity tweaks
1 parent 6e51175 commit 97a7808

File tree

3 files changed

+34
-15
lines changed

3 files changed

+34
-15
lines changed

src/github/dashboardWebviewProvider.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export interface IssueData {
4141
createdAt: string;
4242
updatedAt: string;
4343
complexity?: number;
44+
complexityReasoning?: string;
4445
}
4546

4647
export class DashboardWebviewProvider extends WebviewBase {
@@ -219,15 +220,18 @@ export class DashboardWebviewProvider extends WebviewBase {
219220

220221
private async convertIssueToData(issue: IssueModel): Promise<IssueData> {
221222
let complexity: number | undefined;
223+
let complexityReasoning: string | undefined;
222224

223225
// Check if complexity is already calculated (from IssueItem)
224226
if ((issue as any).complexity?.score) {
225227
complexity = (issue as any).complexity.score;
228+
complexityReasoning = (issue as any).complexity.reasoning;
226229
} else {
227230
// Calculate complexity on demand
228231
try {
229232
const complexityResult = await this._complexityService.calculateComplexity(issue);
230233
complexity = complexityResult.score;
234+
complexityReasoning = complexityResult.reasoning;
231235
} catch (error) {
232236
Logger.debug(`Failed to calculate complexity for issue #${issue.number}: ${error}`, DashboardWebviewProvider.ID);
233237
}
@@ -242,7 +246,8 @@ export class DashboardWebviewProvider extends WebviewBase {
242246
url: issue.html_url,
243247
createdAt: issue.createdAt,
244248
updatedAt: issue.updatedAt,
245-
complexity
249+
complexity,
250+
complexityReasoning
246251
};
247252
}
248253

webviews/dashboardView/app.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ interface IssueData {
2828
createdAt: string;
2929
updatedAt: string;
3030
complexity?: number;
31+
complexityReasoning?: string;
3132
}
3233

3334
interface DashboardData {
@@ -222,8 +223,18 @@ function Dashboard() {
222223
className="issue-item"
223224
onClick={() => handleIssueClick(issue.url)}
224225
>
225-
<div className="item-title">
226-
#{issue.number}: {issue.title}
226+
<div className="issue-item-header">
227+
<div className="item-title">
228+
#{issue.number}: {issue.title}
229+
</div>
230+
{issue.complexity && (
231+
<div
232+
className="complexity-score"
233+
title={issue.complexityReasoning || `Complexity score: ${issue.complexity}`}
234+
>
235+
{issue.complexity}
236+
</div>
237+
)}
227238
</div>
228239
<div className="item-metadata">
229240
{issue.assignee && (
@@ -242,11 +253,6 @@ function Dashboard() {
242253
{/* allow-any-unicode-next-line */}
243254
<span>📅 Updated {formatDate(issue.updatedAt)}</span>
244255
</div>
245-
{issue.complexity && (
246-
<div className="metadata-item complexity-score">
247-
<span>Complexity: {issue.complexity}</span>
248-
</div>
249-
)}
250256
</div>
251257
</div>
252258
))

webviews/dashboardView/index.css

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,19 +201,27 @@ html, body, app {
201201
text-decoration: underline;
202202
}
203203

204+
.issue-item-header {
205+
display: flex;
206+
justify-content: space-between;
207+
align-items: flex-start;
208+
gap: 8px;
209+
margin-bottom: 4px;
210+
}
211+
204212
.complexity-score {
205213
background-color: var(--vscode-badge-background);
206214
color: var(--vscode-badge-foreground);
207-
padding: 2px 6px;
208-
border-radius: 10px;
215+
padding: 2px 8px;
216+
border-radius: 12px;
209217
font-size: 11px;
210-
font-weight: 500;
218+
font-weight: 600;
219+
flex-shrink: 0;
220+
transition: background-color 0.2s ease;
211221
}
212222

213-
.complexity-score span {
214-
display: flex;
215-
align-items: center;
216-
gap: 2px;
223+
.complexity-score:hover {
224+
background-color: var(--vscode-button-hoverBackground);
217225
}
218226

219227
.chat-section {

0 commit comments

Comments
 (0)