diff --git a/Stanford360.xcodeproj/project.pbxproj b/Stanford360.xcodeproj/project.pbxproj index b2e309f..72e4426 100644 --- a/Stanford360.xcodeproj/project.pbxproj +++ b/Stanford360.xcodeproj/project.pbxproj @@ -86,6 +86,7 @@ C15624902D6D6E6E00298CEB /* InfiniteDayTimelineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C156248F2D6D6E6E00298CEB /* InfiniteDayTimelineView.swift */; }; C15C64082D75CF8500979C62 /* LogWeightSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = C15C64072D75CF8500979C62 /* LogWeightSheet.swift */; }; C15C640A2D75CFF700979C62 /* LogWeightView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C15C64092D75CFF700979C62 /* LogWeightView.swift */; }; + C18772D72D82A57D004967EC /* TPPDF in Frameworks */ = {isa = PBXBuildFile; productRef = C18772D62D82A57D004967EC /* TPPDF */; }; C1CF13CF2D6D72C40057BC77 /* DailyScheduleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1CF13CE2D6D72C40057BC77 /* DailyScheduleView.swift */; }; C1CF13DA2D6D76BE0057BC77 /* ScheduleTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1CF13D92D6D76BE0057BC77 /* ScheduleTask.swift */; }; C1CF13E72D6D7CF20057BC77 /* TaskStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1CF13E62D6D7CF20057BC77 /* TaskStore.swift */; }; @@ -195,6 +196,7 @@ 2FB099B62A875E2B00B20952 /* HealthKitOnFHIR in Frameworks */, 56E7083B2BB06F6F00B08F0A /* SwiftPackageList in Frameworks */, 56E708352BB06B7100B08F0A /* SpeziLicense in Frameworks */, + C18772D72D82A57D004967EC /* TPPDF in Frameworks */, 2FE5DC8A29EDD972004B9AB4 /* SpeziLocalStorage in Frameworks */, 4D2965DE2D7A8084000664B4 /* SpeziLLMLocalDownload in Frameworks */, 2FE5DC8C29EDD972004B9AB4 /* SpeziSecureStorage in Frameworks */, @@ -469,6 +471,7 @@ 4D2965DB2D7A8084000664B4 /* SpeziLLMLocal */, 4D2965DD2D7A8084000664B4 /* SpeziLLMLocalDownload */, 4D2965DF2D7A8084000664B4 /* SpeziLLMOpenAI */, + C18772D62D82A57D004967EC /* TPPDF */, ); productName = Stanford360; productReference = 653A254D283387FE005D4D48 /* Stanford360.app */; @@ -577,6 +580,7 @@ A94DDFFB2CBD1190004930BD /* XCRemoteSwiftPackageReference "SpeziNotifications" */, 4DD4BE2A2D79C04F00B5FFC0 /* XCRemoteSwiftPackageReference "llama.cpp" */, 4D2965D62D7A8084000664B4 /* XCRemoteSwiftPackageReference "SpeziLLM" */, + C18772D22D82A401004967EC /* XCRemoteSwiftPackageReference "TPPDF" */, ); productRefGroup = 653A254E283387FE005D4D48 /* Products */; projectDirPath = ""; @@ -1360,6 +1364,14 @@ minimumVersion = 1.0.2; }; }; + C18772D22D82A401004967EC /* XCRemoteSwiftPackageReference "TPPDF" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/techprimate/TPPDF"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 2.6.1; + }; + }; /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ @@ -1557,6 +1569,11 @@ package = 2F66D20D2BB723180010D555 /* XCRemoteSwiftPackageReference "SwiftLint" */; productName = "plugin:SwiftLintBuildToolPlugin"; }; + C18772D62D82A57D004967EC /* TPPDF */ = { + isa = XCSwiftPackageProductDependency; + package = C18772D22D82A401004967EC /* XCRemoteSwiftPackageReference "TPPDF" */; + productName = TPPDF; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 653A2545283387FE005D4D48 /* Project object */; diff --git a/Stanford360.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Stanford360.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 7dc47d0..75927ff 100644 --- a/Stanford360.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Stanford360.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "ef7379b8da4e7ffd5608f83fec5fa0a8ecd3d5eda1037c2ddc2332af246890f6", + "originHash" : "a0e5b682a3ad5cf3f0fd5341934e0ec50d4fc6c8448b5abf3b87454d9e7996c3", "pins" : [ { "identity" : "abseil-cpp-binary", @@ -487,6 +487,15 @@ "version" : "7.0.2" } }, + { + "identity" : "tppdf", + "kind" : "remoteSourceControl", + "location" : "https://github.com/techprimate/TPPDF", + "state" : { + "revision" : "975049c0e1022922580b7927e030901604024925", + "version" : "2.6.1" + } + }, { "identity" : "xctestextensions", "kind" : "remoteSourceControl", diff --git a/Stanford360/Dashboard/Views/DashboardChart.swift b/Stanford360/Dashboard/Views/DashboardChart.swift index 6c4a3f1..30f2115 100644 --- a/Stanford360/Dashboard/Views/DashboardChart.swift +++ b/Stanford360/Dashboard/Views/DashboardChart.swift @@ -20,82 +20,72 @@ struct DashboardChart: View { var timeFrame: TimeFrame - private var filteredActivities: [Date] { + private var dates: [Date] { let (startDate, endDate) = timeFrame.dateRange() - return Array(activityManager.activitiesByDate.keys) - .filter { date in - date >= startDate && date <= endDate - } - .sorted() - } - - private var filteredHydration: [Date] { - let (startDate, endDate) = timeFrame.dateRange() - return Array(hydrationManager.hydrationByDate.keys) - .filter { date in - date >= startDate && date <= endDate - } - .sorted() - } - - private var filteredMeals: [Date] { - let (startDate, endDate) = timeFrame.dateRange() - return Array(proteinManager.mealsByDate.keys) - .filter { date in - date >= startDate && date <= endDate - } - .sorted() + var dates: [Date] = [] + let calendar = Calendar.current + var currentDate = calendar.startOfDay(for: startDate) + + while currentDate <= endDate { + dates.append(currentDate) + currentDate = calendar.date(byAdding: .day, value: 1, to: currentDate) ?? Date() + } + + return dates } var body: some View { Chart { - ForEach(filteredActivities, id: \.self) { date in - if let activities = activityManager.activitiesByDate[date] { - LineMark( - x: .value("Week", date), - y: .value("Activity Minutes", activityManager.getTotalActivityMinutes(activities)), - series: .value("Metric", "Activity") - ) - .applyChartStyle(color: Color.activityColor) - } - } - - ForEach(filteredHydration, id: \.self) { date in - if let hydration = hydrationManager.hydrationByDate[date] { - LineMark( - x: .value("Week", date), - y: .value("Hydration Ounces", hydrationManager.getTotalHydrationOunces(hydration)), - series: .value("Metric", "Hydration") - ) - .applyChartStyle(color: Color.hydrationColor) - } - } - - ForEach(filteredMeals, id: \.self) { date in - if let meals = proteinManager.mealsByDate[date] { - LineMark( - x: .value("Week", date), - y: .value("Protein Grams", proteinManager.getTotalProteinGrams(meals)), - series: .value("Metric", "Protein") - ) - .applyChartStyle(color: Color.proteinColor) - } + ForEach(dates, id: \.self) { date in + let activities = getActivities(from: date) + LineMark( + x: .value("Week", date), + y: .value("Activity Minutes", activityManager.getTotalActivityMinutes(activities)), + series: .value("Metric", "Activity") + ) + .applyChartStyle(color: Color.activityColor) + + let hydration = getHydration(from: date) + LineMark( + x: .value("Week", date), + y: .value("Hydration Ounces", hydrationManager.getTotalHydrationOunces(hydration)), + series: .value("Metric", "Hydration") + ) + .applyChartStyle(color: Color.hydrationColor) + + let meals = getMeals(from: date) + LineMark( + x: .value("Week", date), + y: .value("Protein Grams", proteinManager.getTotalProteinGrams(meals)), + series: .value("Metric", "Protein") + ) + .applyChartStyle(color: Color.proteinColor) } goalLine() } .frame(height: 300) - .padding() + .padding(.leading, 40) + .padding(.trailing, 10) .chartXAxis { - AxisMarks(values: .automatic) { value in + AxisMarks(values: .stride(by: .day)) { value in if let date = value.as(Date.self) { - AxisValueLabel { - Text(date, format: .dateTime.month().day()) - } + AxisValueLabel(date.formatted(.dateTime.weekday(.abbreviated))) } } } - .chartXScale(domain: timeFrame.dateRange().start...timeFrame.dateRange().end) + } + + private func getActivities(from date: Date) -> [Activity] { + activityManager.activitiesByDate[date] ?? [] + } + + private func getHydration(from date: Date) -> [HydrationLog] { + hydrationManager.hydrationByDate[date] ?? [] + } + + private func getMeals(from date: Date) -> [Meal] { + proteinManager.mealsByDate[date] ?? [] } } @@ -106,16 +96,18 @@ extension LineMark { .symbol { Circle() .fill(color) - .frame(width: 8, height: 8) + .frame(width: 5, height: 5) } } } #Preview { - @Previewable @State var activityManager = ActivityManager() + @Previewable @State var activityManager = ActivityManager(activities: activitiesData) + @Previewable @State var hydrationManager = HydrationManager(hydration: hydrationData) @Previewable @State var proteinManager = ProteinManager(meals: mealsData) - DashboardChart(timeFrame: .month) + DashboardChart(timeFrame: .week) .environment(activityManager) + .environment(hydrationManager) .environment(proteinManager) } diff --git a/Stanford360/Dashboard/Views/DashboardPDFView.swift b/Stanford360/Dashboard/Views/DashboardPDFView.swift new file mode 100644 index 0000000..ee7577b --- /dev/null +++ b/Stanford360/Dashboard/Views/DashboardPDFView.swift @@ -0,0 +1,31 @@ +// +// DashboardPDFView.swift +// Stanford360 +// +// Created by Kelly Bonilla Guzmán on 3/13/25. +// +// SPDX-FileCopyrightText: 2025 Stanford University +// +// SPDX-License-Identifier: MIT +// + +import PDFKit +import SwiftUI +import TPPDF + +struct DashboardPDFView: UIViewRepresentable { + var image: UIImage + + func makeUIView(context: Context) -> PDFView { + let url = PDFDocument.generatePDF(image: image) + let pdfView = PDFView() + pdfView.document = PDFKit.PDFDocument(url: url) + return pdfView + } + + func updateUIView(_ uiView: PDFView, context: Context) { } +} + +#Preview { + DashboardPDFView(image: UIImage(systemName: "chart.xyaxis.line") ?? UIImage()) +} diff --git a/Stanford360/Dashboard/Views/DashboardTimeFrameView.swift b/Stanford360/Dashboard/Views/DashboardTimeFrameView.swift index 44c6574..788656a 100644 --- a/Stanford360/Dashboard/Views/DashboardTimeFrameView.swift +++ b/Stanford360/Dashboard/Views/DashboardTimeFrameView.swift @@ -23,8 +23,8 @@ struct DashboardTimeFrameView: View { .tag(TimeFrame.today) DashboardWeeklyView() .tag(TimeFrame.week) - DashboardMonthlyView() - .tag(TimeFrame.month) +// DashboardMonthlyView() +// .tag(TimeFrame.month) } .tabViewStyle(PageTabViewStyle()) } diff --git a/Stanford360/Dashboard/Views/DashboardTodayView.swift b/Stanford360/Dashboard/Views/DashboardTodayView.swift index 7d04957..6465b3a 100644 --- a/Stanford360/Dashboard/Views/DashboardTodayView.swift +++ b/Stanford360/Dashboard/Views/DashboardTodayView.swift @@ -25,6 +25,7 @@ struct DashboardTodayView: View { ProgressCard( title: "Activity", progress: CGFloat(activityManager.getTodayTotalMinutes()), + unit: "min", color: .activityColor, streak: activityManager.streak ) @@ -32,6 +33,7 @@ struct DashboardTodayView: View { ProgressCard( title: "Hydration", progress: CGFloat(hydrationManager.getTodayTotalOunces()), + unit: "oz", color: .hydrationColor, streak: hydrationManager.streak ) @@ -39,6 +41,7 @@ struct DashboardTodayView: View { ProgressCard( title: "Protein", progress: CGFloat(proteinManager.getTodayTotalGrams()), + unit: "g", color: .proteinColor, streak: proteinManager.streak ) diff --git a/Stanford360/Dashboard/Views/DashboardWeeklyView.swift b/Stanford360/Dashboard/Views/DashboardWeeklyView.swift index 6e5e886..0ab74fc 100644 --- a/Stanford360/Dashboard/Views/DashboardWeeklyView.swift +++ b/Stanford360/Dashboard/Views/DashboardWeeklyView.swift @@ -12,8 +12,22 @@ import SwiftUI struct DashboardWeeklyView: View { + @State var showPDFExportSheet: Bool = false + @State var size: CGSize? + var body: some View { - DashboardChartView(timeFrame: .week) + VStack { + HStack { + Spacer() + ExportPDFButton(showingSheet: $showPDFExportSheet) + .padding(.trailing, 20) + } + + DashboardChartView(timeFrame: .week) + } + .sheet(isPresented: $showPDFExportSheet) { + ExportPDFSheet() + } } } diff --git a/Stanford360/Dashboard/Views/ExportPDFButton.swift b/Stanford360/Dashboard/Views/ExportPDFButton.swift new file mode 100644 index 0000000..c76259f --- /dev/null +++ b/Stanford360/Dashboard/Views/ExportPDFButton.swift @@ -0,0 +1,29 @@ +// +// ExportPDFButton.swift +// Stanford360 +// +// Created by Kelly Bonilla Guzmán on 3/12/25. +// +// SPDX-FileCopyrightText: 2025 Stanford University +// +// SPDX-License-Identifier: MIT +// + +import SwiftUI + +struct ExportPDFButton: View { + @Binding var showingSheet: Bool + + var body: some View { + Button(action: { showingSheet = true }) { + Text("View as PDF") + Image(systemName: "eye") + .accessibilityLabel(Text("View as PDF Button")) + } + } +} + +#Preview { + @Previewable @State var showingSheet: Bool = false + ExportPDFButton(showingSheet: $showingSheet) +} diff --git a/Stanford360/Dashboard/Views/ExportPDFSheet.swift b/Stanford360/Dashboard/Views/ExportPDFSheet.swift new file mode 100644 index 0000000..67d67ee --- /dev/null +++ b/Stanford360/Dashboard/Views/ExportPDFSheet.swift @@ -0,0 +1,93 @@ +// +// ExportPDFSheet.swift +// Stanford360 +// +// Created by Kelly Bonilla Guzmán on 3/12/25. +// +// SPDX-FileCopyrightText: 2025 Stanford University +// +// SPDX-License-Identifier: MIT +// + +import PDFKit +import SwiftUI +import TPPDF + +struct ExportPDFSheet: View { + @Environment(\.dismiss) private var dismiss + @Environment(ActivityManager.self) private var activityManager + @Environment(HydrationManager.self) private var hydrationManager + @Environment(ProteinManager.self) private var proteinManager + + @State private var isSharing: Bool = false + + private var chartView: some View { + VStack(spacing: 24) { + DashboardChart(timeFrame: .week) + } + .padding() + } + + var body: some View { + NavigationStack { + VStack { + // DashboardPDFView(image: image) + ImageRendererPDFView() + } + .toolbar { + ToolbarItem(placement: .navigationBarLeading) { + Button("Cancel") { + dismiss() + } + } + + ToolbarItem(placement: .navigationBarTrailing) { + Button(action: { isSharing = true }) { + Label("Share", systemImage: "square.and.arrow.up") + } + } + } + .sheet(isPresented: $isSharing) { + exportPDF() + } + } + } + + private func exportPDF() -> some View { + // let url = PDFDocument.generatePDF(image: image, patient: patientManager.patient) + GeometryReader { geometry in + let size = geometry.size + // swiftlint:disable force_unwrapping + let url = FileManager.default + .urls(for: .documentDirectory, in: .userDomainMask) + .first! + .appending(path: "Stanford360.pdf") + + let renderer = ImageRenderer( + content: chartView + .frame(width: size.width, height: size.height, alignment: .center) + .environment(activityManager) + .environment(hydrationManager) + .environment(proteinManager) + ) + + // Generating PDF + if let consumer = CGDataConsumer(url: url as CFURL), let context = CGContext(consumer: consumer, mediaBox: nil, nil) { + renderer.render { size, renderer in + var mediaBox = CGRect(origin: .zero, size: size) + // Drawing PDF + context.beginPage(mediaBox: &mediaBox) + renderer(context) + context.endPDFPage() + context.closePDF() + } + } + + return ShareSheet(activityItems: [url]) + } + } +} + +#Preview { + ExportPDFSheet() +} diff --git a/Stanford360/Dashboard/Views/ImageRendererPDFView.swift b/Stanford360/Dashboard/Views/ImageRendererPDFView.swift new file mode 100644 index 0000000..bd6bb96 --- /dev/null +++ b/Stanford360/Dashboard/Views/ImageRendererPDFView.swift @@ -0,0 +1,66 @@ +// +// ImageRendererPDFView.swift +// Stanford360 +// +// Created by Kelly Bonilla Guzmán on 3/13/25. +// +// SPDX-FileCopyrightText: 2025 Stanford University +// +// SPDX-License-Identifier: MIT +// + +import SwiftUI + +struct ImageRendererPDFView: View { + @Environment(ActivityManager.self) private var activityManager + @Environment(HydrationManager.self) private var hydrationManager + @Environment(ProteinManager.self) private var proteinManager + + private var chartView: some View { + VStack(spacing: 24) { + DashboardChart(timeFrame: .week) + } + .padding() + } + + var body: some View { + GeometryReader { geometry in + let size = geometry.size + chartView + .onAppear { + guard let documentsDirectory = FileManager.default + .urls(for: .documentDirectory, in: .userDomainMask) + .first else { + print("Failed to access documents directory") + return + } + + let url = documentsDirectory.appending(path: "Stanford360.pdf") + + let renderer = ImageRenderer( + content: chartView + .frame(width: size.width, height: size.height, alignment: .center) + .environment(activityManager) + .environment(hydrationManager) + .environment(proteinManager) + ) + + // Generating PDF + if let consumer = CGDataConsumer(url: url as CFURL), let context = CGContext(consumer: consumer, mediaBox: nil, nil) { + renderer.render { size, renderer in + var mediaBox = CGRect(origin: .zero, size: size) + // Drawing PDF + context.beginPage(mediaBox: &mediaBox) + renderer(context) + context.endPDFPage() + context.closePDF() + } + } + } + } + } +} + +#Preview { + ImageRendererPDFView() +} diff --git a/Stanford360/Dashboard/Views/PDFGenerator.swift b/Stanford360/Dashboard/Views/PDFGenerator.swift new file mode 100644 index 0000000..d9285de --- /dev/null +++ b/Stanford360/Dashboard/Views/PDFGenerator.swift @@ -0,0 +1,38 @@ +// +// PDFGenerator.swift +// Stanford360 +// +// Created by Kelly Bonilla Guzmán on 3/13/25. +// +// SPDX-FileCopyrightText: 2025 Stanford University +// +// SPDX-License-Identifier: MIT +// + +import Foundation +import TPPDF +import UIKit + +extension PDFDocument { + static func generatePDF(image: UIImage) -> URL { + let document = TPPDF.PDFDocument(format: .a4) + let newWidth: CGFloat = 300 + let newHeight: CGFloat = 300 + + + let imageElement = PDFImage( + image: image, + size: CGSize(width: newWidth, height: newHeight), + quality: 1 + ) + imageElement.sizeFit = .width + document.add(.contentLeft, image: imageElement) + + // generate the pdf + let date = Date().formatted(date: .numeric, time: .omitted).replacingOccurrences(of: "/", with: "-") + let filename = "\(date) Stanford 360 Details.pdf" + let generator = PDFGenerator(document: document) + let url = try? generator.generateURL(filename: filename) + return url ?? URL(fileURLWithPath: "") + } +} diff --git a/Stanford360/Dashboard/Views/ProgressCard.swift b/Stanford360/Dashboard/Views/ProgressCard.swift index d54df32..b7ebf24 100644 --- a/Stanford360/Dashboard/Views/ProgressCard.swift +++ b/Stanford360/Dashboard/Views/ProgressCard.swift @@ -14,6 +14,7 @@ import SwiftUI struct ProgressCard: View { let title: String let progress: CGFloat + let unit: String let color: Color let streak: Int? @@ -42,7 +43,7 @@ struct ProgressCard: View { .font(.system(size: 22, weight: .bold)) .foregroundColor(color) - Text("/ 60") + Text("/ 60 \(unit)") .font(.system(size: 22)) .foregroundColor(.textTertiary) } @@ -56,9 +57,10 @@ struct ProgressCard: View { .shadow(color: Color.black.opacity(0.1), radius: 4, x: 0, y: 4) } - init(title: String, progress: CGFloat, color: Color, streak: Int? = nil) { + init(title: String, progress: CGFloat, unit: String, color: Color, streak: Int? = nil) { self.title = title self.progress = progress + self.unit = unit self.color = color self.streak = streak } @@ -68,6 +70,7 @@ struct ProgressCard: View { ProgressCard( title: "Activity", progress: 10, + unit: "min", color: .red, streak: 5 ) diff --git a/Stanford360/Dashboard/Views/ShareSheet.swift b/Stanford360/Dashboard/Views/ShareSheet.swift new file mode 100644 index 0000000..7b68782 --- /dev/null +++ b/Stanford360/Dashboard/Views/ShareSheet.swift @@ -0,0 +1,26 @@ +// +// ShareSheet.swift +// Stanford360 +// +// Created by Kelly Bonilla Guzmán on 3/13/25. +// +// SPDX-FileCopyrightText: 2025 Stanford University +// +// SPDX-License-Identifier: MIT +// + +import SwiftUI + +struct ShareSheet: UIViewControllerRepresentable { + let activityItems: [Any] + + func makeUIViewController(context: Context) -> UIActivityViewController { + UIActivityViewController(activityItems: activityItems, applicationActivities: nil) + } + + func updateUIViewController(_ uiViewController: UIActivityViewController, context: Context) { } +} + +#Preview { + ShareSheet(activityItems: []) +} diff --git a/Stanford360/Resources/Localizable.xcstrings b/Stanford360/Resources/Localizable.xcstrings index 788941d..31d6a8a 100644 --- a/Stanford360/Resources/Localizable.xcstrings +++ b/Stanford360/Resources/Localizable.xcstrings @@ -1,7 +1,7 @@ { "sourceLanguage" : "en", "strings" : { - "/ 60" : { + "/ 60 %@" : { }, "%.f" : { @@ -630,6 +630,9 @@ }, "selected_image" : { + }, + "Share" : { + }, "Social Support Questionnaire" : { "extractionState" : "stale", @@ -723,9 +726,6 @@ }, "This day doesn't have any scheduled tasks." : { - }, - "This Month" : { - }, "This type of event is currently unsupported. Please contact the developer of this app." : { "localizations" : { @@ -767,6 +767,12 @@ }, "View" : { + }, + "View as PDF" : { + + }, + "View as PDF Button" : { + }, "Water" : { diff --git a/Stanford360/Shared/Components/LineChartContent.swift b/Stanford360/Shared/Components/LineChartContent.swift index d38efb1..926ebd6 100644 --- a/Stanford360/Shared/Components/LineChartContent.swift +++ b/Stanford360/Shared/Components/LineChartContent.swift @@ -19,7 +19,7 @@ func goalLine() -> some ChartContent { ) .foregroundStyle(.red) .lineStyle(StrokeStyle(lineWidth: 1, dash: [5])) - .annotation(position: .trailing) { + .annotation(position: .leading) { Text("Goal") .font(.caption) .foregroundStyle(.red) diff --git a/Stanford360/Shared/Components/TimeFramePicker.swift b/Stanford360/Shared/Components/TimeFramePicker.swift index 648c7b5..4eb9bc6 100644 --- a/Stanford360/Shared/Components/TimeFramePicker.swift +++ b/Stanford360/Shared/Components/TimeFramePicker.swift @@ -18,7 +18,7 @@ struct TimeFramePicker: View { Picker("Time Frame", selection: $selectedTimeFrame) { Text("Today").tag(TimeFrame.today) Text("This Week").tag(TimeFrame.week) - Text("This Month").tag(TimeFrame.month) +// Text("This Month").tag(TimeFrame.month) } .pickerStyle(SegmentedPickerStyle()) .padding(.horizontal) diff --git a/Stanford360/Shared/Data/Data.swift b/Stanford360/Shared/Data/Data.swift index 1f183bf..04f5ae8 100644 --- a/Stanford360/Shared/Data/Data.swift +++ b/Stanford360/Shared/Data/Data.swift @@ -38,6 +38,39 @@ let activitiesData = [ ) ] +let hydrationData = [ + HydrationLog( + hydrationOunces: 32, + timestamp: Date.now, + id: "" + ), + HydrationLog( + hydrationOunces: 8, + timestamp: Date.now, + id: "" + ), + HydrationLog( + hydrationOunces: 10, + timestamp: Date.now, + id: "" + ), + HydrationLog( + hydrationOunces: 64, + timestamp: Calendar.current.date(byAdding: .day, value: -1, to: Date()) ?? Date(), + id: "" + ), + HydrationLog( + hydrationOunces: 78, + timestamp: Calendar.current.date(byAdding: .day, value: -2, to: Date()) ?? Date(), + id: "" + ), + HydrationLog( + hydrationOunces: 48, + timestamp: Calendar.current.date(byAdding: .day, value: -3, to: Date()) ?? Date(), + id: "" + ) +] + let mealsData = [ Meal( name: "Fish", diff --git a/Stanford360Tests/ProteinTest/MealTest.swift b/Stanford360Tests/ProteinTest/MealTest.swift index 0fe63f9..b072e13 100644 --- a/Stanford360Tests/ProteinTest/MealTest.swift +++ b/Stanford360Tests/ProteinTest/MealTest.swift @@ -1,3 +1,4 @@ +// periphery:ignore:all // // MealTest.swift // Stanford360 diff --git a/Stanford360Tests/ProteinTest/ProteinManagerTest.swift b/Stanford360Tests/ProteinTest/ProteinManagerTest.swift index bf7a50a..bc6c76a 100644 --- a/Stanford360Tests/ProteinTest/ProteinManagerTest.swift +++ b/Stanford360Tests/ProteinTest/ProteinManagerTest.swift @@ -1,3 +1,4 @@ +// periphery:ignore:all // // ProteinManagerTest.swift // Stanford360 diff --git a/Stanford360Tests/ProteinTests/ProteinTrackerTests.swift b/Stanford360Tests/ProteinTests/ProteinTrackerTests.swift index e1d3ee8..0ca5e52 100644 --- a/Stanford360Tests/ProteinTests/ProteinTrackerTests.swift +++ b/Stanford360Tests/ProteinTests/ProteinTrackerTests.swift @@ -1,3 +1,4 @@ +// periphery:ignore:all // // This source file is part of the Stanford 360 based on the Stanford Spezi Template Application project //