Skip to content

Commit

Permalink
Simple Home View
Browse files Browse the repository at this point in the history
  • Loading branch information
nriedman committed Apr 3, 2024
1 parent b56db18 commit e700e46
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 28 deletions.
20 changes: 20 additions & 0 deletions ENGAGEHF.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
4DB025BD2BBDE9F7002D2545 /* HeartHealthView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DB025BC2BBDE9F7002D2545 /* HeartHealthView.swift */; };
4DB025BF2BBDEA03002D2545 /* EducationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DB025BE2BBDEA03002D2545 /* EducationView.swift */; };
4DB025C12BBDEA0B002D2545 /* MedicationsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DB025C02BBDEA0B002D2545 /* MedicationsView.swift */; };
4DB025C62BBE21EF002D2545 /* index.js in Resources */ = {isa = PBXBuildFile; fileRef = 4DB025C52BBE21EF002D2545 /* index.js */; };
56E708352BB06B7100B08F0A /* SpeziLicense in Frameworks */ = {isa = PBXBuildFile; productRef = 56E708342BB06B7100B08F0A /* SpeziLicense */; };
56E7083B2BB06F6F00B08F0A /* SwiftPackageList in Frameworks */ = {isa = PBXBuildFile; productRef = 56E7083A2BB06F6F00B08F0A /* SwiftPackageList */; };
653A2551283387FE005D4D48 /* ENGAGEHF.swift in Sources */ = {isa = PBXBuildFile; fileRef = 653A2550283387FE005D4D48 /* ENGAGEHF.swift */; };
Expand Down Expand Up @@ -132,6 +133,7 @@
4DB025BC2BBDE9F7002D2545 /* HeartHealthView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeartHealthView.swift; sourceTree = "<group>"; };
4DB025BE2BBDEA03002D2545 /* EducationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EducationView.swift; sourceTree = "<group>"; };
4DB025C02BBDEA0B002D2545 /* MedicationsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MedicationsView.swift; sourceTree = "<group>"; };
4DB025C52BBE21EF002D2545 /* index.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = index.js; sourceTree = "<group>"; };
653A254D283387FE005D4D48 /* ENGAGEHF.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ENGAGEHF.app; sourceTree = BUILT_PRODUCTS_DIR; };
653A2550283387FE005D4D48 /* ENGAGEHF.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ENGAGEHF.swift; sourceTree = "<group>"; };
653A255428338800005D4D48 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
Expand Down Expand Up @@ -313,6 +315,21 @@
path = Education;
sourceTree = "<group>";
};
4DB025C32BBE219B002D2545 /* Functions */ = {
isa = PBXGroup;
children = (
4DB025C52BBE21EF002D2545 /* index.js */,
);
path = Functions;
sourceTree = "<group>";
};
4DB025C72BBE24B9002D2545 /* Firebase */ = {
isa = PBXGroup;
children = (
);
path = Firebase;
sourceTree = "<group>";
};
653A2544283387FE005D4D48 = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -343,6 +360,8 @@
2FF53D8C2A8729D600042B76 /* ENGAGEHFStandard.swift */,
2F4E23822989D51F0013F3D9 /* ENGAGEHFTestingSetup.swift */,
2FC975A72978F11A00BA99FE /* Home.swift */,
4DB025C72BBE24B9002D2545 /* Firebase */,
4DB025C32BBE219B002D2545 /* Functions */,
4DB025B52BBDE8EC002D2545 /* Dashboard */,
4DB025B92BBDE9CB002D2545 /* HeartHealth */,
4DB025BB2BBDE9E2002D2545 /* Education */,
Expand Down Expand Up @@ -555,6 +574,7 @@
2FC3439129EE6349002D773C /* AppIcon.png in Resources */,
653A255528338800005D4D48 /* Assets.xcassets in Resources */,
2FC3439029EE6346002D773C /* SocialSupportQuestionnaire.json in Resources */,
4DB025C62BBE21EF002D2545 /* index.js in Resources */,
2FA0BFED2ACC977500E0EF83 /* Localizable.xcstrings in Resources */,
2F6025CB29BBE70F0045459E /* GoogleService-Info.plist in Resources */,
);
Expand Down
62 changes: 37 additions & 25 deletions ENGAGEHF/Dashboard/DashboardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,58 @@ import SpeziAccount
import SpeziMockWebService
import SwiftUI

struct HomeTitle: View {
@Binding var presentingAccount: Bool
struct Greeting: View {
@State private var dateString: String?

var body: some View {
HStack {
titleBar
AccountButton(isPresented: $presentingAccount)
Text("Hello, world!")
.font(.title2)
Spacer()
Text(dateString ?? "No date")
.font(.title2)
}
.padding()
.task {
getDateString()
}
}

Check warning on line 33 in ENGAGEHF/Dashboard/DashboardView.swift

View check run for this annotation

Codecov / codecov/patch

ENGAGEHF/Dashboard/DashboardView.swift#L21-L33

Added lines #L21 - L33 were not covered by tests

private var titleBar: some View {
Text("ENGAGE-HF Home")
.font(.title)
.foregroundColor(.white)
.padding()
.frame(maxWidth: .infinity)
.background(Color("AccentColor"))
private func getDateString() {
let currentDate = Date()
let dateFormatter = DateFormatter()

dateFormatter.dateStyle = .short

dateString = dateFormatter.string(from: currentDate)
}

Check warning on line 42 in ENGAGEHF/Dashboard/DashboardView.swift

View check run for this annotation

Codecov / codecov/patch

ENGAGEHF/Dashboard/DashboardView.swift#L35-L42

Added lines #L35 - L42 were not covered by tests
}

struct Dashboard: View {
@Binding var presentingAccount: Bool

var body: some View {
VStack {
// Title


// Greeting and Date

// Notifications

// To-Do list

// Latest Vitals
NavigationStack {
VStack {
Greeting()
Spacer()
}
.navigationBarTitleDisplayMode(.inline)
.navigationTitle("ENGAGE-HF: Home") // Todo: Make this white

// Symptom Survey
}
.toolbar {
AccountButton(isPresented: $presentingAccount)
ToolbarItem(placement: .topBarTrailing) {
AccountButton(isPresented: $presentingAccount)
.foregroundColor(.white)
}
}
.toolbarBackground(.visible, for: .navigationBar)
.toolbarBackground(Color("AccentColor"), for: .navigationBar)
}
}

Check warning on line 66 in ENGAGEHF/Dashboard/DashboardView.swift

View check run for this annotation

Codecov / codecov/patch

ENGAGEHF/Dashboard/DashboardView.swift#L48-L66

Added lines #L48 - L66 were not covered by tests
}

#Preview {
@State var presentingAccount = false
return Dashboard(presentingAccount: $presentingAccount)
}
19 changes: 19 additions & 0 deletions ENGAGEHF/Functions/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// This source file is part of the ENGAGE-HF project based on the Stanford Spezi Template Application project
//
// SPDX-FileCopyrightText: 2023 Stanford University
//
// SPDX-License-Identifier: MIT
//

// Based on https://github.com/StanfordBDHG/PediatricAppleWatchStudy/pull/54

const {onCall} = require("firebase-functions/v2/https");
const {logger, https} = require("firebase-functions/v2");
const {FieldValue} = require("firebase-admin/firestore");
const admin = require("firebase-admin");
const {beforeUserCreated} = require("firebase-functions/v2/identity");

admin.initializeApp();


9 changes: 6 additions & 3 deletions ENGAGEHF/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@
},
"Education Test" : {

},
"ENGAGE-HF: Home" : {

},
"HEALTHKIT_PERMISSIONS_BUTTON" : {
"localizations" : {
Expand Down Expand Up @@ -157,6 +160,9 @@
},
"Heart Health Test" : {

},
"Hello, world!" : {

},
"Home" : {

Expand Down Expand Up @@ -421,9 +427,6 @@
}
}
}
},
"Test" : {

},
"WELCOME_AREA1_DESCRIPTION" : {
"localizations" : {
Expand Down

0 comments on commit e700e46

Please sign in to comment.