Skip to content

Commit 2bb06f1

Browse files
Copilotrajbos
andauthored
Add empty-state guidance for first-time users in Details panel
Agent-Logs-Url: https://github.com/rajbos/github-copilot-token-usage/sessions/30fb2886-0abe-4a9c-b957-a415b459bd82 Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
1 parent 5ef22dd commit 2bb06f1

2 files changed

Lines changed: 86 additions & 0 deletions

File tree

vscode-extension/src/webview/details/main.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,12 @@ function renderShell(
151151
const footer = el('div', 'footer', `Last updated: ${lastUpdated.toLocaleString()} · Updates every 5 minutes`);
152152

153153
const sections = el('div', 'sections');
154+
155+
const isEmptyState = (stats.today.tokens ?? 0) === 0 && (stats.last30Days.tokens ?? 0) === 0 && (stats.lastMonth.tokens ?? 0) === 0;
156+
if (isEmptyState) {
157+
sections.append(buildEmptyStateSection());
158+
}
159+
154160
sections.append(buildMetricsSection(stats, projections));
155161

156162
const editorSection = buildEditorUsageSection(stats);
@@ -677,6 +683,44 @@ function buildModelUsageSection(stats: DetailedStats): HTMLElement | null {
677683
return section;
678684
}
679685

686+
function buildEmptyStateSection(): HTMLElement {
687+
const section = el('div', 'section');
688+
const inner = el('div', 'empty-state');
689+
690+
const title = el('div', 'empty-state-title', '👋 Welcome to AI Engineering Fluency');
691+
692+
const desc = el('p', 'empty-state-description',
693+
'This extension tracks your GitHub Copilot token usage by reading Copilot Chat session log files stored locally by VS Code. No token data has been found yet.'
694+
);
695+
696+
const stepsLabel = document.createElement('p');
697+
stepsLabel.className = 'empty-state-description';
698+
const stepsLabelStrong = document.createElement('strong');
699+
stepsLabelStrong.textContent = 'To get started:';
700+
stepsLabel.append(stepsLabelStrong);
701+
702+
const steps = document.createElement('ol');
703+
steps.className = 'empty-state-steps';
704+
const stepTexts = [
705+
'Make sure the GitHub Copilot and GitHub Copilot Chat extensions are installed and active in VS Code.',
706+
'Open the Copilot Chat panel (Ctrl+Alt+I / Cmd+Alt+I) and have a conversation with Copilot.',
707+
'Click the 🔄 Refresh button above to reload the stats after chatting.',
708+
];
709+
stepTexts.forEach(text => {
710+
const li = document.createElement('li');
711+
li.textContent = text;
712+
steps.append(li);
713+
});
714+
715+
const note = el('div', 'empty-state-note',
716+
'💡 If you have been using Copilot but still see no data, open the Diagnostics panel (🔍 Diagnostics button above) to verify that session files are being discovered correctly.'
717+
);
718+
719+
inner.append(title, desc, stepsLabel, steps, note);
720+
section.append(inner);
721+
return section;
722+
}
723+
680724
function buildEstimatesSection(): HTMLElement {
681725
const section = el('div', 'section');
682726
const heading = el('h3');

vscode-extension/src/webview/details/styles.css

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,45 @@ body {
144144
font-size: 11px;
145145
margin-top: 6px;
146146
}
147+
148+
.empty-state {
149+
display: flex;
150+
flex-direction: column;
151+
gap: 12px;
152+
padding: 20px;
153+
}
154+
155+
.empty-state-title {
156+
font-size: 15px;
157+
font-weight: 700;
158+
color: var(--text-primary);
159+
}
160+
161+
.empty-state-description {
162+
color: var(--text-secondary);
163+
font-size: 13px;
164+
line-height: 1.5;
165+
margin: 0;
166+
}
167+
168+
.empty-state-steps {
169+
margin: 0;
170+
padding-left: 20px;
171+
color: var(--text-secondary);
172+
font-size: 13px;
173+
line-height: 1.6;
174+
}
175+
176+
.empty-state-steps li {
177+
margin: 4px 0;
178+
}
179+
180+
.empty-state-note {
181+
background: var(--bg-tertiary);
182+
border: 1px solid var(--border-subtle);
183+
border-radius: 6px;
184+
padding: 10px 14px;
185+
color: var(--text-secondary);
186+
font-size: 12px;
187+
line-height: 1.5;
188+
}

0 commit comments

Comments
 (0)