From 8f0f2b4b4f4b747b5d5fcc5a433f2f4b5109c940 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Mon, 13 Apr 2026 20:41:49 -0500 Subject: fix: sonarqube quality fixes --- DayByDay/DayCard.swift | 8 +++++++- DayByDay/MonthCard.swift | 8 +++++++- DayByDay/SeasonCard.swift | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) (limited to 'DayByDay') diff --git a/DayByDay/DayCard.swift b/DayByDay/DayCard.swift index 4ee3614..1c9d698 100644 --- a/DayByDay/DayCard.swift +++ b/DayByDay/DayCard.swift @@ -12,6 +12,12 @@ struct DayCard: View { var isHighlighted = false @State private var isTapped = false + private var cardScale: CGFloat { + if isTapped { return 1.12 } + if isHighlighted { return 1.04 } + return 1.0 + } + var body: some View { ZStack { RoundedRectangle(cornerRadius: 32, style: .continuous) @@ -36,7 +42,7 @@ struct DayCard: View { } } .shadow(color: isHighlighted ? .white.opacity(0.8) : .clear, radius: 12) - .scaleEffect(isTapped ? 1.12 : (isHighlighted ? 1.04 : 1.0)) + .scaleEffect(cardScale) .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous)) .rotation3DEffect(.degrees(isTapped ? 6 : 0), axis: (x: 1, y: 0, z: 0)) .animation(.spring(response: 0.35, dampingFraction: 0.5), value: isTapped) diff --git a/DayByDay/MonthCard.swift b/DayByDay/MonthCard.swift index f462fd4..4b1d6ae 100644 --- a/DayByDay/MonthCard.swift +++ b/DayByDay/MonthCard.swift @@ -12,6 +12,12 @@ struct MonthCard: View { var isHighlighted = false @State private var isTapped = false + private var cardScale: CGFloat { + if isTapped { return 1.12 } + if isHighlighted { return 1.04 } + return 1.0 + } + var body: some View { ZStack { RoundedRectangle(cornerRadius: 32, style: .continuous) @@ -36,7 +42,7 @@ struct MonthCard: View { } } .shadow(color: isHighlighted ? .white.opacity(0.8) : .clear, radius: 12) - .scaleEffect(isTapped ? 1.12 : (isHighlighted ? 1.04 : 1.0)) + .scaleEffect(cardScale) .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous)) .rotation3DEffect(.degrees(isTapped ? 6 : 0), axis: (x: 1, y: 0, z: 0)) .animation(.spring(response: 0.35, dampingFraction: 0.5), value: isTapped) diff --git a/DayByDay/SeasonCard.swift b/DayByDay/SeasonCard.swift index c84dfb6..e64aa21 100644 --- a/DayByDay/SeasonCard.swift +++ b/DayByDay/SeasonCard.swift @@ -12,6 +12,12 @@ struct SeasonCard: View { var isHighlighted = false @State private var isTapped = false + private var cardScale: CGFloat { + if isTapped { return 1.12 } + if isHighlighted { return 1.04 } + return 1.0 + } + var body: some View { ZStack { RoundedRectangle(cornerRadius: 32, style: .continuous) @@ -36,7 +42,7 @@ struct SeasonCard: View { } } .shadow(color: isHighlighted ? .white.opacity(0.8) : .clear, radius: 12) - .scaleEffect(isTapped ? 1.12 : (isHighlighted ? 1.04 : 1.0)) + .scaleEffect(cardScale) .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous)) .rotation3DEffect(.degrees(isTapped ? 6 : 0), axis: (x: 1, y: 0, z: 0)) .animation(.spring(response: 0.35, dampingFraction: 0.5), value: isTapped) -- cgit v1.2.3