- Add 4 voting layout styles: horizontal, cards, radial, stacked - Add color-filled backgrounds to mood entries (tinted by mood color) - Add sticky month headers with blur material effect - Add voting layout picker to Customize tab - Add haptic feedback on mood selection - Improve typography and spacing throughout 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
68 lines
2.3 KiB
Swift
68 lines
2.3 KiB
Swift
//
|
|
// EntryListView.swift
|
|
// Feels (iOS)
|
|
//
|
|
// Created by Trey Tartt on 3/6/22.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct EntryListView: View {
|
|
@AppStorage(UserDefaultsStore.Keys.moodImages.rawValue, store: GroupUserDefaults.groupDefaults) private var imagePack: MoodImages = .FontAwesome
|
|
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
|
|
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = DefaultTextColor.textColor
|
|
|
|
public let entry: MoodEntry
|
|
|
|
private var moodColor: Color {
|
|
moodTint.color(forMood: entry.mood)
|
|
}
|
|
|
|
var body: some View {
|
|
HStack(spacing: 14) {
|
|
imagePack.icon(forMood: entry.mood)
|
|
.resizable()
|
|
.aspectRatio(contentMode: .fit)
|
|
.frame(width: 42, height: 42)
|
|
.foregroundColor(moodColor)
|
|
|
|
VStack(alignment: .leading, spacing: 4) {
|
|
HStack(spacing: 4) {
|
|
Text(Random.weekdayName(fromDate: entry.forDate!))
|
|
.font(.headline)
|
|
.foregroundColor(textColor)
|
|
Text("-")
|
|
.foregroundColor(textColor.opacity(0.6))
|
|
Text(Random.dayFormat(fromDate: entry.forDate!))
|
|
.font(.headline)
|
|
.foregroundColor(textColor)
|
|
}
|
|
|
|
Text(entry.moodValue == Mood.missing.rawValue ? String(localized: "mood_value_missing_tap_to_add") : "\(entry.moodString)")
|
|
.font(.subheadline)
|
|
.foregroundColor(textColor.opacity(0.7))
|
|
}
|
|
|
|
Spacer()
|
|
}
|
|
.padding(.horizontal, 16)
|
|
.padding(.vertical, 14)
|
|
.background(
|
|
RoundedRectangle(cornerRadius: 14)
|
|
.fill(moodColor.opacity(0.12))
|
|
)
|
|
}
|
|
}
|
|
|
|
struct EntryListView_Previews: PreviewProvider {
|
|
static let fakeData = PersistenceController.shared.randomEntries(count: 1).first!
|
|
|
|
static var previews: some View {
|
|
VStack(spacing: 8) {
|
|
EntryListView(entry: EntryListView_Previews.fakeData)
|
|
EntryListView(entry: EntryListView_Previews.fakeData)
|
|
}
|
|
.padding()
|
|
}
|
|
}
|