Skip to content
This repository was archived by the owner on Nov 16, 2025. It is now read-only.

Commit f7ef920

Browse files
steipeteclaude
andcommitted
Enable progressive loading for Claude Token Usage Report
- Show data immediately as files are parsed, not after all complete - Display progress bar at top of table when loading continues - Keep loading indicator visible until all files are processed - Fix loading state logic to allow simultaneous data display and loading - Improve user experience by showing partial results during scan The report now displays entries as soon as they're parsed while showing progress in the header, allowing users to see data immediately instead of waiting for all 275+ files to complete processing. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 162b461 commit f7ef920

File tree

1 file changed

+29
-28
lines changed

1 file changed

+29
-28
lines changed

VibeMeter/Presentation/Views/ClaudeUsageReportView.swift

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct ClaudeUsageReportView: View {
4444

4545
// Content
4646
Group {
47-
if dataLoader.isLoading, dataLoader.dailyUsage.isEmpty {
47+
if dataLoader.dailyUsage.isEmpty && dataLoader.isLoading {
4848
VStack(spacing: 16) {
4949
Spacer()
5050
ProgressView()
@@ -84,7 +84,7 @@ struct ClaudeUsageReportView: View {
8484
.buttonStyle(.borderedProminent)
8585
Spacer()
8686
}
87-
} else if sortedDays.isEmpty, !dataLoader.isLoading {
87+
} else if sortedDays.isEmpty && !dataLoader.isLoading {
8888
Spacer()
8989
VStack(spacing: 12) {
9090
Image(systemName: "doc.text.magnifyingglass")
@@ -101,30 +101,32 @@ struct ClaudeUsageReportView: View {
101101
.padding()
102102
Spacer()
103103
} else {
104-
// Show loading indicator at the top if still processing
105-
if dataLoader.isLoading && dataLoader.totalFiles > 0 {
106-
VStack(spacing: 8) {
107-
HStack {
108-
ProgressView()
109-
.progressViewStyle(.circular)
110-
.scaleEffect(0.8)
111-
112-
Text(dataLoader.loadingMessage)
113-
.font(.caption)
114-
.foregroundStyle(.secondary)
115-
116-
Spacer()
104+
// Show data with loading indicator
105+
VStack(spacing: 0) {
106+
// Show loading indicator at the top if still processing
107+
if dataLoader.isLoading && dataLoader.totalFiles > 0 {
108+
VStack(spacing: 8) {
109+
HStack {
110+
ProgressView()
111+
.progressViewStyle(.circular)
112+
.scaleEffect(0.8)
113+
114+
Text(dataLoader.loadingMessage)
115+
.font(.caption)
116+
.foregroundStyle(.secondary)
117+
118+
Spacer()
119+
}
120+
121+
ProgressView(value: Double(dataLoader.filesProcessed), total: Double(dataLoader.totalFiles))
122+
.progressViewStyle(.linear)
117123
}
124+
.padding(.horizontal)
125+
.padding(.vertical, 8)
126+
.background(.ultraThinMaterial)
118127

119-
ProgressView(value: Double(dataLoader.filesProcessed), total: Double(dataLoader.totalFiles))
120-
.progressViewStyle(.linear)
128+
Divider()
121129
}
122-
.padding(.horizontal)
123-
.padding(.vertical, 8)
124-
.background(.ultraThinMaterial)
125-
126-
Divider()
127-
}
128130

129131
// Table
130132
Table(of: DailyUsageSummary.self, sortOrder: $sortOrder) {
@@ -164,6 +166,7 @@ struct ClaudeUsageReportView: View {
164166
}
165167
}
166168
.tableStyle(.inset(alternatesRowBackgrounds: true))
169+
}
167170

168171
// Summary footer with material background
169172
VStack(spacing: 0) {
@@ -367,11 +370,9 @@ extension ClaudeUsageDataLoader: ClaudeLogProgressDelegate {
367370

368371
let percentage = totalFiles > 0 ? Int((Double(filesProcessed) / Double(totalFiles)) * 100) : 0
369372
self.loadingMessage = "Processing files... \(percentage)% (\(filesProcessed)/\(totalFiles))"
370-
371-
// If we have some data, we're no longer in the initial loading state
372-
if !dailyUsage.isEmpty {
373-
self.isLoading = false
374-
}
373+
374+
// Keep isLoading true until all files are processed
375+
// This allows the progress bar to remain visible
375376
}
376377

377378
func logProcessingDidComplete(dailyUsage: [Date: [ClaudeLogEntry]]) {

0 commit comments

Comments
 (0)