Skip to content

Commit

Permalink
UI Improvements & Smaller Bug Fixes (#9)
Browse files Browse the repository at this point in the history
# UI Improvements & Smaller Bug Fixes

## ⚙️ Release Notes 
- Fixes the layout of cards in lists in dark mode
- Fixes issue where the step count gauge grew with every re-rendering of
the view frame


## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
PSchmiedmayer authored Mar 25, 2024
1 parent 8419e4b commit c4623e9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct DailyStepCountGoal: View {
}
.padding(.horizontal, 20)
}
.frame(minHeight: 140, idealHeight: 160, maxHeight: 200)
.frame(minHeight: 140, idealHeight: 180, maxHeight: 200)
.padding()
.padding(.horizontal, 32)
}
Expand Down
5 changes: 2 additions & 3 deletions StudyApplication/Engagements/DailyStepCountGoal/Gauge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,18 @@ struct Gauge: View {
style: StrokeStyle(lineWidth: 20, lineCap: .round)
)
.rotationEffect(.degrees(-90))
.frame(width: size.width, height: size.height)
.padding(lineWidth / 2)
if progress < 1.0 - (lineWidth / (2 * radius * .pi)) {
Circle()
.frame(width: lineWidth)
.foregroundColor(gradient.stops.first?.color)
.offset(y: -(size.height / 2))
.offset(y: -(size.height / 2) + (lineWidth / 2))
} else {
let shaddowOffset = shaddowOffset
Circle()
.frame(width: lineWidth)
.foregroundColor(gradient.stops.last?.color)
.offset(y: -(size.height / 2))
.offset(y: -(size.height / 2) + (lineWidth / 2))
.rotationEffect(Angle.degrees(360 * Double(progress)))
.shadow(
color: .black.opacity(0.2),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import SwiftUI


struct StudyApplicationListCard<Content: View>: View {
@Environment(\.colorScheme) var colorScheme

var content: () -> Content


Expand All @@ -18,7 +20,7 @@ struct StudyApplicationListCard<Content: View>: View {
.padding(.horizontal, 16)
.padding(.vertical, 8)
.background {
Color(uiColor: .systemBackground)
Color(uiColor: colorScheme == .light ? .systemBackground : .secondarySystemBackground)
.ignoresSafeArea()
}
.clipShape(RoundedRectangle(cornerRadius: 10.0))
Expand Down
5 changes: 1 addition & 4 deletions StudyApplication/Studies/VascTrac/VascTracStudy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,18 @@ extension Study {
task(forQuestionnaire: padWalkingImpairmentQuestionnaire, title: "PAD Walking Impairment", week: 6),
task(forQuestionnaire: peripheralArteryQuestionnaire, title: "Peripheral Artery Questionnaire (PAQ)", week: 6),
task(forQuestionnaire: phq9DepressionQuestionnaire, title: "PHQ-9 Depression", week: 6),
task(forQuestionnaire: physicalActivityQuestionnaire, title: "Physical Activity Questionnaire", week: 6),
task(forQuestionnaire: ahaLE8Questionnaire, title: "AHA LE8", week: 14),
task(forQuestionnaire: berlinQuestionnaire, title: "Berlin", week: 14),
task(forQuestionnaire: exerciseBenefitsBarriersQuestionnaire, title: "Exercise Benefits Barriers", week: 14),
task(forQuestionnaire: padWalkingImpairmentQuestionnaire, title: "PAD Walking Impairment", week: 14),
task(forQuestionnaire: peripheralArteryQuestionnaire, title: "Peripheral Artery Questionnaire (PAQ)", week: 14),
task(forQuestionnaire: phq9DepressionQuestionnaire, title: "PHQ-9 Depression", week: 14),
task(forQuestionnaire: physicalActivityQuestionnaire, title: "Physical Activity Questionnaire", week: 14),
task(forQuestionnaire: ahaLE8Questionnaire, title: "AHA LE8", week: 22),
task(forQuestionnaire: berlinQuestionnaire, title: "Berlin", week: 22),
task(forQuestionnaire: exerciseBenefitsBarriersQuestionnaire, title: "Exercise Benefits Barriers", week: 22),
task(forQuestionnaire: padWalkingImpairmentQuestionnaire, title: "PAD Walking Impairment", week: 22),
task(forQuestionnaire: peripheralArteryQuestionnaire, title: "Peripheral Artery Questionnaire (PAQ)", week: 22),
task(forQuestionnaire: phq9DepressionQuestionnaire, title: "PHQ-9 Depression", week: 22),
task(forQuestionnaire: physicalActivityQuestionnaire, title: "Physical Activity Questionnaire", week: 22)
task(forQuestionnaire: phq9DepressionQuestionnaire, title: "PHQ-9 Depression", week: 22)
]
}

Expand Down
15 changes: 6 additions & 9 deletions StudyApplication/Study/Views/StudyView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ struct StudyView: View {
Divider()
enrollSection
}
.background {
Color(uiColor: .systemBackground)
.ignoresSafeArea()
}
.sheet(isPresented: $showEnrollSheet) {
StudyOnboardingFlow(study: study, studyOnboardingComplete: !$showEnrollSheet)
}
Expand All @@ -47,10 +43,6 @@ struct StudyView: View {
.lineLimit(6)
.padding()
}
.background {
Color(uiColor: .systemBackground)
.ignoresSafeArea()
}
}

@ViewBuilder private var enrollSection: some View {
Expand All @@ -72,7 +64,12 @@ struct StudyView: View {
ZStack {
Color(.systemGroupedBackground)
.edgesIgnoringSafeArea(.all)
StudyView(study: StudyModule().studies[0])
StudyApplicationListCard {
StudyView(study: StudyModule().studies[0])
.padding(.horizontal, -16)
.padding(.vertical, -8)
}
.padding()
}
.previewWith(standard: StudyApplicationStandard()) {
StudyModule()
Expand Down

0 comments on commit c4623e9

Please sign in to comment.