different home screen layouts

This commit is contained in:
Trey t
2025-12-13 09:18:57 -06:00
parent 4713192d55
commit 6adef2d6fc
5 changed files with 382 additions and 15 deletions

View File

@@ -64,6 +64,13 @@ struct CustomizeView: View {
Divider()
// Day View Style
SettingsRow(title: "Entry Style") {
DayViewStylePickerCompact()
}
Divider()
// Voting Layout
SettingsRow(title: "Voting Layout") {
VotingLayoutPickerCompact()
@@ -749,6 +756,106 @@ struct SubscriptionBannerView: View {
}
}
// MARK: - Day View Style Picker
struct DayViewStylePickerCompact: View {
@AppStorage(UserDefaultsStore.Keys.dayViewStyle.rawValue, store: GroupUserDefaults.groupDefaults) private var dayViewStyle: DayViewStyle = .classic
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = DefaultTextColor.textColor
@Environment(\.colorScheme) private var colorScheme
var body: some View {
HStack(spacing: 10) {
ForEach(DayViewStyle.allCases, id: \.rawValue) { style in
Button(action: {
withAnimation(.easeInOut(duration: 0.2)) {
dayViewStyle = style
}
let impactMed = UIImpactFeedbackGenerator(style: .medium)
impactMed.impactOccurred()
EventLogger.log(event: "change_day_view_style", withData: ["style": style.displayName])
}) {
VStack(spacing: 6) {
styleIcon(for: style)
.frame(width: 44, height: 44)
.foregroundColor(dayViewStyle == style ? .accentColor : textColor.opacity(0.4))
Text(style.displayName)
.font(.system(size: 11, weight: .medium))
.foregroundColor(dayViewStyle == style ? .accentColor : textColor.opacity(0.5))
}
.frame(maxWidth: .infinity)
.padding(.vertical, 12)
.background(
RoundedRectangle(cornerRadius: 12)
.fill(dayViewStyle == style
? Color.accentColor.opacity(0.1)
: (colorScheme == .dark ? Color(.systemGray5) : Color(.systemGray6)))
)
}
.buttonStyle(.plain)
}
}
}
@ViewBuilder
private func styleIcon(for style: DayViewStyle) -> some View {
switch style {
case .classic:
// Card with gradient circle and text
HStack(spacing: 6) {
Circle()
.fill(LinearGradient(colors: [.green, .green.opacity(0.5)], startPoint: .topLeading, endPoint: .bottomTrailing))
.frame(width: 16, height: 16)
VStack(alignment: .leading, spacing: 2) {
RoundedRectangle(cornerRadius: 1).frame(width: 18, height: 4)
RoundedRectangle(cornerRadius: 1).frame(width: 12, height: 3).opacity(0.5)
}
}
case .minimal:
// Simple flat card
HStack(spacing: 6) {
Circle()
.strokeBorder(lineWidth: 1.5)
.frame(width: 14, height: 14)
VStack(alignment: .leading, spacing: 2) {
RoundedRectangle(cornerRadius: 1).frame(width: 18, height: 4)
RoundedRectangle(cornerRadius: 1).frame(width: 10, height: 3).opacity(0.5)
}
}
case .compact:
// Timeline dots with bars
HStack(spacing: 4) {
VStack(spacing: 3) {
Circle().frame(width: 6, height: 6)
Circle().frame(width: 6, height: 6)
Circle().frame(width: 6, height: 6)
}
VStack(spacing: 3) {
RoundedRectangle(cornerRadius: 2).frame(width: 24, height: 8)
RoundedRectangle(cornerRadius: 2).frame(width: 24, height: 8)
RoundedRectangle(cornerRadius: 2).frame(width: 24, height: 8)
}
}
case .bubble:
// Full-width colored bars
VStack(spacing: 4) {
RoundedRectangle(cornerRadius: 4).fill(.green).frame(width: 34, height: 10)
RoundedRectangle(cornerRadius: 4).fill(.yellow).frame(width: 34, height: 10)
RoundedRectangle(cornerRadius: 4).fill(.blue).frame(width: 34, height: 10)
}
case .grid:
// 3x3 grid of circles
LazyVGrid(columns: [GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible())], spacing: 4) {
Circle().fill(.green).frame(width: 10, height: 10)
Circle().fill(.yellow).frame(width: 10, height: 10)
Circle().fill(.blue).frame(width: 10, height: 10)
Circle().fill(.orange).frame(width: 10, height: 10)
Circle().fill(.green).frame(width: 10, height: 10)
Circle().fill(.yellow).frame(width: 10, height: 10)
}
}
}
}
struct CustomizeView_Previews: PreviewProvider {
static var previews: some View {
Group {