diff --git a/Shared/Models/Shapes.swift b/Shared/Models/Shapes.swift index e16d1b8..16ecd17 100644 --- a/Shared/Models/Shapes.swift +++ b/Shared/Models/Shapes.swift @@ -25,7 +25,16 @@ enum BGShape: Int, CaseIterable { minHeight: 5, maxHeight: 500, alignment: .center) - + .overlay( + text + .font(.title2) + .fontWeight(.bold) + .lineLimit(1) + .foregroundColor(textColor) + .minimumScaleFactor(0.2) + .padding(10) + .frame(maxWidth: .infinity, alignment: .center) + ) case .diamond: Diamond() .fill(bgColor) @@ -34,7 +43,16 @@ enum BGShape: Int, CaseIterable { minHeight: 5, maxHeight: 500) .aspectRatio(contentMode: .fit) - + .overlay( + text + .font(.title2) + .fontWeight(.bold) + .lineLimit(1) + .foregroundColor(textColor) + .minimumScaleFactor(0.2) + .padding(10) + .frame(maxWidth: .infinity, alignment: .center) + ) case .rectangle: Rectangle() .fill(bgColor) @@ -43,6 +61,16 @@ enum BGShape: Int, CaseIterable { minHeight: 5, maxHeight: 500, alignment: .center) + .overlay( + text + .font(.title2) + .fontWeight(.bold) + .lineLimit(1) + .foregroundColor(textColor) + .minimumScaleFactor(0.2) + .padding(10) + .frame(maxWidth: .infinity, alignment: .center) + ) case .roundedRectangle: RoundedRectangle(cornerRadius: 8, style: .continuous) .fill(bgColor) @@ -51,15 +79,17 @@ enum BGShape: Int, CaseIterable { minHeight: 5, maxHeight: 500, alignment: .center) + .overlay( + text + .font(.title2) + .fontWeight(.bold) + .lineLimit(1) + .foregroundColor(textColor) + .minimumScaleFactor(0.2) + .padding(10) + .frame(maxWidth: .infinity, alignment: .center) + ) } - text - .font(.title2) - .fontWeight(.bold) - .lineLimit(1) - .foregroundColor(textColor) - .minimumScaleFactor(0.7) - .padding(10) - .frame(maxWidth: .infinity, alignment: .center) }) } } diff --git a/Shared/views/CustomizeView/CustomizeView.swift b/Shared/views/CustomizeView/CustomizeView.swift index 0485e16..050d06e 100644 --- a/Shared/views/CustomizeView/CustomizeView.swift +++ b/Shared/views/CustomizeView/CustomizeView.swift @@ -484,6 +484,7 @@ struct CustomizeView: View { Text(String(localized: "customize_view_view_pick_shape")) .padding([.leading]) .foregroundColor(textColor) + Divider() HStack { diff --git a/Shared/views/HeaderPercView.swift b/Shared/views/HeaderPercView.swift index fc9a74b..26f930e 100644 --- a/Shared/views/HeaderPercView.swift +++ b/Shared/views/HeaderPercView.swift @@ -9,7 +9,7 @@ import SwiftUI enum PercViewType { case text - case circular + case shape } struct HeaderPercView: View { @@ -72,7 +72,7 @@ struct HeaderPercView: View { } } - private var circularViews: some View { + private var shapeViews: some View { VStack { Spacer() HStack { @@ -102,8 +102,9 @@ struct HeaderPercView: View { switch self.type { case .text: textViews - case .circular: - circularViews + case .shape: + shapeViews + .padding([.leading, .trailing]) } } } @@ -113,6 +114,6 @@ struct HeaderPercView_Previews: PreviewProvider { static var previews: some View { HeaderPercView(fakeData: true, backDays: 30, type: .text) - HeaderPercView(fakeData: true, backDays: 30, type: .circular) + HeaderPercView(fakeData: true, backDays: 30, type: .shape) } } diff --git a/Shared/views/MonthView/MonthView.swift b/Shared/views/MonthView/MonthView.swift index 3e8687d..ce9de2e 100644 --- a/Shared/views/MonthView/MonthView.swift +++ b/Shared/views/MonthView/MonthView.swift @@ -196,11 +196,12 @@ extension MonthView { } } Divider() - LazyVGrid(columns: columns, spacing: 25) { + LazyVGrid(columns: columns, spacing: 15) { ForEach(entries, id: \.self) { entry in - shape.view(withText: Text(""), bgColor: entry.mood == .placeholder ? .clear : moodTint.color(forMood: entry.mood), + shape.view(withText: Text(""), + bgColor: entry.mood == .placeholder ? .clear : moodTint.color(forMood: entry.mood), textColor: .clear) - .frame(minHeight: 5, idealHeight: 20, maxHeight: 50, alignment: .center) + .frame(maxWidth: .infinity, maxHeight: .infinity) } } } diff --git a/Shared/views/SwitchableView.swift b/Shared/views/SwitchableView.swift index cd69da1..d178bd4 100644 --- a/Shared/views/SwitchableView.swift +++ b/Shared/views/SwitchableView.swift @@ -40,31 +40,38 @@ struct SwitchableView: View { self._viewType = viewType } + private var mainViews: some View { + switch viewType { + case .total: + return AnyView( + HeaderStatsView(fakeData: false, backDays: daysBack, moodTint: [ + moodTint.color(forMood: .great), + moodTint.color(forMood: .good), + moodTint.color(forMood: .average), + moodTint.color(forMood: .bad), + moodTint.color(forMood: .horrible) + ], textColor: textColor)) + .allowsHitTesting(false) + case .percentageShape: + return AnyView( + HeaderPercView(fakeData: false, backDays: daysBack, type: .shape)) + .allowsHitTesting(false) + case .percentage: + return AnyView( + HeaderPercView(fakeData: false, backDays: daysBack, type: .text)) + .allowsHitTesting(false) + } + } + var body: some View { VStack { ZStack { Text(String(customMoodTintUpdateNumber)) - .hidden() - switch viewType { - case .total: - HeaderStatsView(fakeData: false, backDays: daysBack, moodTint: [ - moodTint.color(forMood: .great), - moodTint.color(forMood: .good), - moodTint.color(forMood: .average), - moodTint.color(forMood: .bad), - moodTint.color(forMood: .horrible) - ], textColor: textColor) - .padding([.leading, .trailing], -15) - .padding([.top, .bottom], 8) - .allowsHitTesting(false) - case .percentageShape: - HeaderPercView(fakeData: false, backDays: daysBack, type: .circular) - .allowsHitTesting(false) - case .percentage: - HeaderPercView(fakeData: false, backDays: daysBack, type: .text) - .allowsHitTesting(false) - } - + .hidden() + + mainViews + .padding(.top) + VStack { HStack { Spacer()