Remove 30-day VoiceInk trend
This commit is contained in:
parent
ecd6228720
commit
39c7e4671c
@ -1,5 +1,4 @@
|
||||
import SwiftUI
|
||||
import Charts
|
||||
|
||||
struct MetricsContent: View {
|
||||
let transcriptions: [Transcription]
|
||||
@ -11,10 +10,8 @@ struct MetricsContent: View {
|
||||
ScrollView {
|
||||
VStack(spacing: 20) {
|
||||
TimeEfficiencyView(totalRecordedTime: totalRecordedTime, estimatedTypingTime: estimatedTypingTime)
|
||||
|
||||
|
||||
metricsGrid
|
||||
|
||||
voiceInkTrendChart
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
@ -65,48 +62,6 @@ struct MetricsContent: View {
|
||||
}
|
||||
}
|
||||
|
||||
private var voiceInkTrendChart: some View {
|
||||
VStack(alignment: .leading, spacing: 10) {
|
||||
Text("30-Day VoiceInk Trend")
|
||||
.font(.headline)
|
||||
|
||||
Chart {
|
||||
ForEach(dailyTranscriptionCounts, id: \.date) { item in
|
||||
LineMark(
|
||||
x: .value("Date", item.date),
|
||||
y: .value("Sessions", item.count)
|
||||
)
|
||||
.interpolationMethod(.catmullRom)
|
||||
|
||||
AreaMark(
|
||||
x: .value("Date", item.date),
|
||||
y: .value("Sessions", item.count)
|
||||
)
|
||||
.foregroundStyle(LinearGradient(colors: [.blue.opacity(0.3), .blue.opacity(0.1)], startPoint: .top, endPoint: .bottom))
|
||||
.interpolationMethod(.catmullRom)
|
||||
}
|
||||
}
|
||||
.chartXAxis {
|
||||
AxisMarks(values: .stride(by: .day, count: 7)) { _ in
|
||||
AxisGridLine()
|
||||
AxisTick()
|
||||
AxisValueLabel(format: .dateTime.day().month(), centered: true)
|
||||
}
|
||||
}
|
||||
.chartYAxis {
|
||||
AxisMarks { value in
|
||||
AxisGridLine()
|
||||
AxisTick()
|
||||
AxisValueLabel()
|
||||
}
|
||||
}
|
||||
.frame(height: 250)
|
||||
}
|
||||
.padding()
|
||||
.background(Color(.controlBackgroundColor))
|
||||
.cornerRadius(10)
|
||||
.shadow(radius: 2)
|
||||
}
|
||||
|
||||
// Computed properties for metrics
|
||||
private var totalWordsTranscribed: Int {
|
||||
@ -124,21 +79,6 @@ struct MetricsContent: View {
|
||||
return estimatedTypingTimeInMinutes * 60
|
||||
}
|
||||
|
||||
private var dailyTranscriptionCounts: [(date: Date, count: Int)] {
|
||||
let calendar = Calendar.current
|
||||
let now = Date()
|
||||
let thirtyDaysAgo = calendar.date(byAdding: .day, value: -29, to: now)!
|
||||
|
||||
let dailyData = (0..<30).compactMap { dayOffset -> (date: Date, count: Int)? in
|
||||
guard let date = calendar.date(byAdding: .day, value: -dayOffset, to: now) else { return nil }
|
||||
let startOfDay = calendar.startOfDay(for: date)
|
||||
let endOfDay = calendar.date(byAdding: .day, value: 1, to: startOfDay)!
|
||||
let count = transcriptions.filter { $0.timestamp >= startOfDay && $0.timestamp < endOfDay }.count
|
||||
return (date: startOfDay, count: count)
|
||||
}
|
||||
|
||||
return dailyData.reversed()
|
||||
}
|
||||
|
||||
// Add computed properties for new metrics
|
||||
private var averageWordsPerMinute: Double {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user