Skip to content

Commit

Permalink
Pdf finalize (#69)
Browse files Browse the repository at this point in the history
# *PDF minor updates*

## ♻️ Current situation & Problem
PDF now on nav stack
This PR is in progress!


## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/CS342/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/CS342/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/CS342/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/CS342/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
ninaboord authored Mar 13, 2024
1 parent 352cad1 commit 5c68ae9
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 63 deletions.
1 change: 0 additions & 1 deletion Intake/Elements.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ struct SubmitButton: View {
@Environment(NavigationPathWrapper.self) private var navigationPath
@Environment(ReachedEndWrapper.self) private var end
var nextView: NavigationViews

var body: some View {
Button(action: {
if end.reachedEnd {
Expand Down
63 changes: 26 additions & 37 deletions Intake/Export/ExportView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,6 @@ struct ExportView: View {
}
}

// FOR UPDATED SURGERY STRUCT
// ForEach(data.surgeries, id: \.self) { item in
// if !item.startDate.isEmpty && !item.endDate.isEmpty && !item.complications.isEmpty{
// HStack {
// Text(item.surgeryName)
// Text(item.startDate)
// Text(item.endDate)
// Text(item.complications)
// }
// }
// }

// ForEach([1,2,3], id: \.self) { item in
// Text(String(item))
// }


private var wrappedBody: some View {
VStack {
Text("MEDICAL HISTORY").fontWeight(.bold)
Expand All @@ -80,19 +63,19 @@ struct ExportView: View {
}
HStack {
Text("Name:").fontWeight(.bold)
Text("John Doe")
Text(data.generalData.name)
}
HStack {
Text("Date of Birth:").fontWeight(.bold)
Text("January 1, 1980")
Text(data.generalData.birthdate)
}
HStack {
Text("Age:").fontWeight(.bold)
Text("35")
Text(data.generalData.age)
}
HStack {
Text("Sex:").fontWeight(.bold)
Text("Female")
Text(data.generalData.name)
}

Spacer()
Expand All @@ -117,8 +100,13 @@ struct ExportView: View {
if data.conditionData.isEmpty {
Text("No medical conditions")
} else {
List(data.conditionData, id: \.id) { item in
Text(item.condition)
ForEach(data.conditionData, id: \.id) { item in
HStack {
Text(item.condition)
Spacer()
Text(item.active ? "Active" : "Inactive")
.foregroundColor(.secondary)
}
}
}
}
Expand All @@ -131,8 +119,11 @@ struct ExportView: View {
if data.surgeries.isEmpty {
Text("No past surgeries")
} else {
List(data.surgeries, id: \.id) { item in
Text(item.surgeryName)
ForEach(data.surgeries, id: \.id) { item in
HStack {
Text(item.surgeryName)
Text(item.date).foregroundColor(.secondary)
}
}
}
}
Expand All @@ -145,7 +136,7 @@ struct ExportView: View {
if data.medicationData.isEmpty {
Text("No medications")
} else {
List(Array(data.medicationData), id: \.id) { item in
ForEach(Array(data.medicationData), id: \.id) { item in
HStack {
Text(item.type.localizedDescription)
Text(item.dosage.localizedDescription)
Expand All @@ -162,10 +153,10 @@ struct ExportView: View {
if data.allergyData.isEmpty {
Text("No known allergies")
} else {
List(data.allergyData, id: \.id) { item in
HStack {
Text(item.allergy)
List(item.reaction, id: \.id) { reactionItem in
ForEach(data.allergyData, id: \.id) { item in
VStack(alignment: .leading) {
Text(item.allergy).fontWeight(.bold)
ForEach(item.reaction, id: \.id) { reactionItem in
Text(reactionItem.reaction)
}
}
Expand Down Expand Up @@ -208,15 +199,13 @@ struct ExportView: View {

// issue: proposed height is not expanding as necessary. uncomment to attempt to fix this.

// var proposedHeightOptional = renderer.uiImage?.size.height
let proposedHeightOptional = renderer.uiImage?.size.height

// guard let proposedHeight = proposedHeightOptional else {
// return nil
// }

// let pageSize = CGSize(width: 612, height: proposedHeight)
guard let proposedHeight = proposedHeightOptional else {
return nil
}

let pageSize = CGSize(width: 612, height: 920)
let pageSize = CGSize(width: 612, height: proposedHeight)

renderer.proposedSize = .init(pageSize)

Expand Down
19 changes: 8 additions & 11 deletions Intake/Home.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ struct HomeView: View {
static var accountEnabled: Bool {
!FeatureFlags.disableFirebase && !FeatureFlags.skipOnboarding
}

@State private var presentingAccount = false
@State private var showSettings = false

@Environment(NavigationPathWrapper.self) private var navigationPath
@Environment(DataStore.self) private var data

Expand All @@ -96,11 +96,11 @@ struct HomeView: View {
.foregroundColor(.gray)
}
}

var body: some View {
@Bindable var navigationPath = navigationPath
@Bindable var data = data

NavigationStack(path: $navigationPath.path) {
VStack {
Spacer()
Expand All @@ -109,11 +109,11 @@ struct HomeView: View {
Spacer()
StartButton(navigationPath: $navigationPath.path)
}

.toolbar {
SettingsButton(showSettings: $showSettings)
SettingsButton(showSettings: $showSettings)
}

.navigationDestination(for: NavigationViews.self) { view in
switch view {
case .smoking: SmokingHistoryView()
Expand All @@ -139,13 +139,10 @@ struct HomeView: View {
.sheet(isPresented: $showSettings) {
SettingsView()
}
// comment out below for pdf testing
.accountRequired(Self.accountEnabled) {
AccountSheet()
}
.verifyRequiredAccountDetails(Self.accountEnabled)

// comment out above for pdf testing
}
}

Expand All @@ -154,7 +151,7 @@ struct HomeView: View {
let details = AccountDetails.Builder()
.set(\.userId, value: "[email protected]")
.set(\.name, value: PersonNameComponents(givenName: "Leland", familyName: "Stanford"))

return HomeView()
.previewWith(standard: IntakeStandard()) {
IntakeScheduler()
Expand Down
30 changes: 16 additions & 14 deletions Intake/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
},
"0 pack years" : {

},
"35" : {

},
"ACCOUNT_NEXT" : {
"localizations" : {
Expand Down Expand Up @@ -281,12 +278,16 @@
},
"Ex: Smoked for 10 years, quit 5 years ago..." : {

},
"Female" : {

},
"FHIR_RESOURCES_CHAT_CANCEL" : {

"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Back"
}
}
}
},
"Full name" : {

Expand Down Expand Up @@ -365,12 +366,6 @@
},
"It looks like an unexpected view was appended to the NavigationPath!" : {

},
"January 1, 1980" : {

},
"John Doe" : {

},
"Last Menstrural Period" : {

Expand Down Expand Up @@ -703,7 +698,14 @@

},
"SETTINGS_TITLE" : {

"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Select a Mock Patient"
}
}
}
},
"Sex" : {

Expand Down
1 change: 1 addition & 0 deletions Intake/ScrollablePDF.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ struct ScrollablePDF: View {

var body: some View {
Button(action: {
navigationPath.path.append(NavigationViews.export)
}) {
Text("Share")
.foregroundColor(.white)
Expand Down

0 comments on commit 5c68ae9

Please sign in to comment.