polish iOS study flow
This commit is contained in:
@@ -1,7 +1,48 @@
|
||||
import SwiftUI
|
||||
|
||||
struct ResultView: View {
|
||||
let title: String
|
||||
let subtitle: String
|
||||
let selectionLabel: String
|
||||
let selectionValue: String
|
||||
let outcomeLabel: String
|
||||
let outcomeValue: String
|
||||
let didWin: Bool
|
||||
let winLabel: String
|
||||
let loseLabel: String
|
||||
let nextRoundTitle: String
|
||||
let onNextRound: () -> Void
|
||||
|
||||
@EnvironmentObject private var analytics: HermesAnalyticsClient
|
||||
|
||||
var body: some View {
|
||||
Text("Result scaffold")
|
||||
VStack(alignment: .leading, spacing: HermesTheme.sectionSpacing) {
|
||||
HermesSectionHeader(title: title, subtitle: subtitle)
|
||||
|
||||
HStack(spacing: 12) {
|
||||
HermesMetricPill(label: selectionLabel, value: selectionValue)
|
||||
HermesMetricPill(label: outcomeLabel, value: outcomeValue)
|
||||
}
|
||||
|
||||
HStack(spacing: 10) {
|
||||
Image(systemName: didWin ? "checkmark.seal.fill" : "xmark.seal.fill")
|
||||
.foregroundStyle(didWin ? HermesTheme.positive : HermesTheme.warning)
|
||||
Text(didWin ? winLabel : loseLabel)
|
||||
.font(.headline.weight(.semibold))
|
||||
.foregroundStyle(HermesTheme.textPrimary)
|
||||
}
|
||||
|
||||
Button {
|
||||
analytics.track("next_round_requested", attributes: ["screen_name": "result"])
|
||||
onNextRound()
|
||||
} label: {
|
||||
Text(nextRoundTitle)
|
||||
}
|
||||
.buttonStyle(HermesPrimaryButtonStyle())
|
||||
}
|
||||
.onAppear {
|
||||
analytics.track("screen_viewed", attributes: ["screen_name": "result"])
|
||||
analytics.track("result_viewed", attributes: ["screen_name": "result", "selection": selectionValue, "outcome": outcomeValue])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user