Fix widget layout clipping and add comprehensive widget previews
- Fix LargeVotingView mood icons getting clipped at edges by using flexible HStack spacing with maxWidth: .infinity - Fix VotingView medium layout with smaller icons and even distribution - Add comprehensive #Preview macros for all widget states: - Vote widget: small/medium, voted/not voted, all mood states - Timeline widget: small/medium/large with various data states - Reduce icon sizes and padding to fit within widget bounds - Update accessibility labels and hints across views 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -174,13 +174,13 @@ struct YearCard: View {
|
||||
VStack(spacing: 0) {
|
||||
// Header with year
|
||||
Text(String(year))
|
||||
.font(.system(size: 48, weight: .heavy, design: .rounded))
|
||||
.font(.largeTitle.weight(.heavy))
|
||||
.foregroundColor(textColor)
|
||||
.padding(.top, 40)
|
||||
.padding(.bottom, 8)
|
||||
|
||||
Text("Year in Review")
|
||||
.font(.system(size: 18, weight: .medium, design: .rounded))
|
||||
.font(.headline.weight(.medium))
|
||||
.foregroundColor(textColor.opacity(0.6))
|
||||
.padding(.bottom, 30)
|
||||
|
||||
@@ -196,15 +196,16 @@ struct YearCard: View {
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.foregroundColor(.white)
|
||||
.padding(28)
|
||||
.accessibilityLabel(topMood.strValue)
|
||||
)
|
||||
.shadow(color: moodTint.color(forMood: topMood).opacity(0.5), radius: 25, x: 0, y: 12)
|
||||
|
||||
Text("Top Mood")
|
||||
.font(.system(size: 14, weight: .medium, design: .rounded))
|
||||
.font(.subheadline.weight(.medium))
|
||||
.foregroundColor(textColor.opacity(0.5))
|
||||
|
||||
Text(topMood.strValue.uppercased())
|
||||
.font(.system(size: 24, weight: .bold, design: .rounded))
|
||||
.font(.title2.weight(.bold))
|
||||
.foregroundColor(moodTint.color(forMood: topMood))
|
||||
}
|
||||
.padding(.bottom, 30)
|
||||
@@ -214,10 +215,10 @@ struct YearCard: View {
|
||||
HStack(spacing: 0) {
|
||||
VStack(spacing: 4) {
|
||||
Text("\(totalEntries)")
|
||||
.font(.system(size: 42, weight: .bold, design: .rounded))
|
||||
.font(.largeTitle.weight(.bold))
|
||||
.foregroundColor(textColor)
|
||||
Text("Days Tracked")
|
||||
.font(.system(size: 13, weight: .medium, design: .rounded))
|
||||
.font(.caption.weight(.medium))
|
||||
.foregroundColor(textColor.opacity(0.5))
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
@@ -237,6 +238,7 @@ struct YearCard: View {
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.foregroundColor(.white)
|
||||
.padding(8)
|
||||
.accessibilityLabel(metric.mood.strValue)
|
||||
)
|
||||
|
||||
GeometryReader { geo in
|
||||
@@ -252,7 +254,7 @@ struct YearCard: View {
|
||||
.frame(height: 16)
|
||||
|
||||
Text("\(Int(metric.percent))%")
|
||||
.font(.system(size: 16, weight: .semibold, design: .rounded))
|
||||
.font(.body.weight(.semibold))
|
||||
.foregroundColor(textColor)
|
||||
.frame(width: 45, alignment: .trailing)
|
||||
}
|
||||
@@ -263,7 +265,7 @@ struct YearCard: View {
|
||||
|
||||
// App branding
|
||||
Text("ifeel")
|
||||
.font(.system(size: 14, weight: .medium, design: .rounded))
|
||||
.font(.subheadline.weight(.medium))
|
||||
.foregroundColor(textColor.opacity(0.3))
|
||||
.padding(.bottom, 20)
|
||||
}
|
||||
@@ -275,7 +277,13 @@ struct YearCard: View {
|
||||
VStack(spacing: 0) {
|
||||
// Year Header
|
||||
HStack {
|
||||
Button(action: { withAnimation(.easeInOut(duration: 0.2)) { showStats.toggle() } }) {
|
||||
Button(action: {
|
||||
if UIAccessibility.isReduceMotionEnabled {
|
||||
showStats.toggle()
|
||||
} else {
|
||||
withAnimation(.easeInOut(duration: 0.2)) { showStats.toggle() }
|
||||
}
|
||||
}) {
|
||||
HStack {
|
||||
Text(String(year))
|
||||
.font(.title2.bold())
|
||||
@@ -324,6 +332,7 @@ struct YearCard: View {
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(width: 16, height: 16)
|
||||
.foregroundColor(moodTint.color(forMood: metric.mood))
|
||||
.accessibilityLabel(metric.mood.strValue)
|
||||
|
||||
GeometryReader { geo in
|
||||
ZStack(alignment: .leading) {
|
||||
@@ -357,7 +366,7 @@ struct YearCard: View {
|
||||
HStack(spacing: 2) {
|
||||
ForEach(months.indices, id: \.self) { index in
|
||||
Text(months[index])
|
||||
.font(.system(size: 9, weight: .medium))
|
||||
.font(.caption2.weight(.medium))
|
||||
.foregroundColor(textColor.opacity(0.5))
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user