diff --git a/AddED+.xcodeproj/project.pbxproj b/AddED+.xcodeproj/project.pbxproj index 590c9b0..5893276 100644 --- a/AddED+.xcodeproj/project.pbxproj +++ b/AddED+.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ E754E0B12C4EEAB200D526A1 /* ProgramName.swift in Sources */ = {isa = PBXBuildFile; fileRef = E754E0B02C4EEAB200D526A1 /* ProgramName.swift */; }; E754E0B32C4EEADB00D526A1 /* ProgramInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = E754E0B22C4EEADB00D526A1 /* ProgramInfo.swift */; }; E754E0B52C4EEB0800D526A1 /* AddProgramPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = E754E0B42C4EEB0700D526A1 /* AddProgramPage.swift */; }; + E768B4262C5818B400270BB4 /* SearchCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E768B4252C5818B400270BB4 /* SearchCardView.swift */; }; E7BD348E2C4106FB00BDA300 /* AddED_App.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7BD348D2C4106FB00BDA300 /* AddED_App.swift */; }; E7BD34902C4106FB00BDA300 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7BD348F2C4106FB00BDA300 /* ContentView.swift */; }; E7BD34922C4106FD00BDA300 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E7BD34912C4106FD00BDA300 /* Assets.xcassets */; }; @@ -40,6 +41,7 @@ E754E0B02C4EEAB200D526A1 /* ProgramName.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProgramName.swift; sourceTree = ""; }; E754E0B22C4EEADB00D526A1 /* ProgramInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProgramInfo.swift; sourceTree = ""; }; E754E0B42C4EEB0700D526A1 /* AddProgramPage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddProgramPage.swift; sourceTree = ""; }; + E768B4252C5818B400270BB4 /* SearchCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchCardView.swift; sourceTree = ""; }; E7BD348A2C4106FB00BDA300 /* AddED+.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "AddED+.app"; sourceTree = BUILT_PRODUCTS_DIR; }; E7BD348D2C4106FB00BDA300 /* AddED_App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddED_App.swift; sourceTree = ""; }; E7BD348F2C4106FB00BDA300 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; @@ -82,6 +84,7 @@ E754E0B22C4EEADB00D526A1 /* ProgramInfo.swift */, F0A9CB3F2C49B095004B509A /* RatingStarsView.swift */, F0A9CB352C49A309004B509A /* ProgramCardView.swift */, + E768B4252C5818B400270BB4 /* SearchCardView.swift */, F0A9CB372C49A314004B509A /* TagRectangleView.swift */, F63775632C51A55700491F55 /* TagListView.swift */, E7DA68442C49C464000C7486 /* TabBar.swift */, @@ -226,6 +229,7 @@ F0A9CB342C49A1CC004B509A /* ProgramModel.swift in Sources */, E754E0B32C4EEADB00D526A1 /* ProgramInfo.swift in Sources */, F63377762C50A7E70024D2BD /* ProgramRecommendedView.swift in Sources */, + E768B4262C5818B400270BB4 /* SearchCardView.swift in Sources */, F63775642C51A55700491F55 /* TagListView.swift in Sources */, F0A9CB402C49B095004B509A /* RatingStarsView.swift in Sources */, F0A9CB3A2C49A3FD004B509A /* ProgramView.swift in Sources */, diff --git a/AddED+/Models/ProgramModel.swift b/AddED+/Models/ProgramModel.swift index 33bfb56..762d099 100644 --- a/AddED+/Models/ProgramModel.swift +++ b/AddED+/Models/ProgramModel.swift @@ -135,7 +135,7 @@ var placeholderTags: [Tag] = [technologyTag, paidTag, artsTag, sportsTag, civicT var inputTag: [Tag] = [businessTag, researchTag, volunteerTag] var ECCChicago = Program(inputName: "Everyone Can Code Chicago", inputDescription: "The Everyone Can Code Chicago initiative was launched as a public-private partnership that expands opportunities for youth to develop coding skills and explore career pathways. Through this initiative, employees at local businesses share their professional experience with youth. And the youth have the opportunity to gain work experience through internships.", inputTime: "2:00 PM - 5:00 PM", inputDays: "Weekdays 06/24/2024-8/02/2024", inputPlace: "Truman College", isVerified: true, ratingsArray: [], tagsArray: [technologyTag, paidTag], idNumber: 1, imageID: "ECC") -var afterSchoolMatters = Program(inputName: "After School Matters", inputDescription: "After School Matters inspires Chicago’s teens to discover their passions, develop skills for life beyond high school, and make friends along the way.", inputTime: "", inputDays: "07/16/2024-07/16/2025", inputPlace: "Chicago, Il", isVerified: true, ratingsArray: [], tagsArray: [technologyTag, artsTag, culinaryTag, paidTag], idNumber: 2, imageID:"afterSchoolMatters") +var afterSchoolMatters = Program(inputName: "After School Matters", inputDescription: "After School Matters inspires Chicago’s teens to discover their passions, develop skills for life beyond high school, and make friends along the way.", inputTime: "", inputDays: "07/16/2024-07/16/2025", inputPlace: "Chicago, Il", isVerified: true, ratingsArray: [], tagsArray: [technologyTag, artsTag, culinaryTag, paidTag, sportsTag, civicTag], idNumber: 2, imageID:"afterSchoolMatters") var cyberSecurityProgram = Program(inputName: "Intro to Cybersecurity", inputDescription: "Program Info", inputTime: "07/25/24",inputDays: "08/25/24", inputPlace: "Chicago, IL", isVerified: true, ratingsArray: [], tagsArray: [technologyTag, paidTag], idNumber: 3, imageID:"Placeholder") var webDevProgram = Program(inputName: "Intro to Web Development", inputDescription: "After School Matters inspires Chicago’s teens to discover their passions, develop skills for life beyond high school, and make friends along the way.", inputTime: "07/25/24",inputDays: "08/25/24", inputPlace: "Chicago, IL", isVerified: true, ratingsArray: [], tagsArray: [technologyTag, paidTag], idNumber: 4, imageID:"Placeholder") diff --git a/AddED+/Views/HomeScreen.swift b/AddED+/Views/HomeScreen.swift index 7a30abb..611d634 100644 --- a/AddED+/Views/HomeScreen.swift +++ b/AddED+/Views/HomeScreen.swift @@ -85,7 +85,7 @@ extension HomeScreen { ForEach(0..<(placeholderPrograms.count)/2, id:\.self) { i in ProgramRecommendedView(program1: placeholderPrograms[i*2], program2: placeholderPrograms[i*2+1]) } - + } } } diff --git a/AddED+/Views/ProgramCardView.swift b/AddED+/Views/ProgramCardView.swift index 08050dc..3396882 100644 --- a/AddED+/Views/ProgramCardView.swift +++ b/AddED+/Views/ProgramCardView.swift @@ -60,6 +60,11 @@ struct ProgramCardView: View { .foregroundColor(.blue) .font(.system(size:24)) } + else { + Image(systemName: "bookmark") + .foregroundColor(.blue) + .font(.system(size:24)) + } } .padding(.all, 8.0) diff --git a/AddED+/Views/RatingStarsView.swift b/AddED+/Views/RatingStarsView.swift index 2f5ab10..c3d5330 100644 --- a/AddED+/Views/RatingStarsView.swift +++ b/AddED+/Views/RatingStarsView.swift @@ -63,11 +63,6 @@ struct RatingStarsView: View { Image(systemName:"star") } - - - // Image(systemName:"star") - // Image(systemName:"star.fill") - } } diff --git a/AddED+/Views/SearchCardView.swift b/AddED+/Views/SearchCardView.swift new file mode 100644 index 0000000..c6d8218 --- /dev/null +++ b/AddED+/Views/SearchCardView.swift @@ -0,0 +1,73 @@ +// +// ProgramCardView.swift +// AddED+ +// +// Created by 6 GO Gantz on 7/13/24. +// + +import SwiftUI + +struct SearchCardView: View { + @State var displayedProgram: Program + @State var areTagsRemovable: Bool + @State var paddingAmount: Double + + var body: some View { + ZStack { + Rectangle() + .fill(.white) + .frame(width: 350, height: 130) + .cornerRadius(10) + .shadow(color: Color(red: 0.4, green: 0.4, blue: 0.4), radius:5, y:5) + .padding() + VStack { + HStack { + Text(displayedProgram.name) + .font(.system(size:20)) + .padding(.trailing, 5) + Spacer() + } + .frame(maxWidth:300, maxHeight:20) + .padding([.top, .leading, .bottom], 5) + ScrollView(.horizontal) { + HStack { + ForEach(displayedProgram.tags) { tag in + TagRectangleView(displayTag: tag, removable: areTagsRemovable, itemTagged: displayedProgram) + } + } + } + .padding(.leading, 25) + .frame(maxWidth:350, maxHeight: 20) + HStack { + Image(systemName:"star.fill") + .frame(alignment:.trailing) + .foregroundColor(.yellow) + .font(.system(size:25)) + Text("(" + String(displayedProgram.ratingsAverageScore()) + ")") + .foregroundColor(.yellow) + .bold() + .font(.system(size: 24)) + Spacer() + if (currentUser.savedPrograms.contains(displayedProgram.id)) { + Image(systemName:"bookmark.fill") + .foregroundColor(.blue) + .font(.system(size:24)) + } + else { + Image(systemName: "bookmark") + .foregroundColor(.blue) + .font(.system(size:24)) + } + } + .padding(.all, 8.0) + .frame(maxWidth:300) + + + } + } + } +} + +#Preview { + SearchCardView(displayedProgram: ECCChicago, areTagsRemovable: false, paddingAmount: 10.0) +} diff --git a/AddED+/Views/SearchView.swift b/AddED+/Views/SearchView.swift index 41e2b5d..c112ed8 100644 --- a/AddED+/Views/SearchView.swift +++ b/AddED+/Views/SearchView.swift @@ -10,44 +10,56 @@ import SwiftUI struct SearchView: View { @State var jobSearchedValue: String = "" @State var foundJobs: [Program] = [] + var tags: [Tag] = placeholderTags + var searchResults: [Program] = placeholderPrograms + var body: some View { ZStack { VStack { GreenHeader() //Searching bar - ZStack { - //Search bar background - Rectangle() - .fill(.white) - .frame(width: UIScreen.main.bounds.width - 40, height: 40) - .cornerRadius(10) - //Search bar functionality and button - HStack { - TextField("Job Search", text: $jobSearchedValue) - .padding([.leading, .trailing], 30.0) - .frame(alignment:.leading) - - Button (action: {foundJobs = searchFunction( query:jobSearchedValue)}, label: { - Label("", systemImage:"magnifyingglass") - }) - .foregroundColor(.black) - .frame(width: 20, height: 20) - .padding([.trailing], 30.0) + HStack { + ZStack { + //Search bar background + Rectangle() + .fill(.white) + .frame(width: UIScreen.main.bounds.width - 75, height: 40) + .cornerRadius(10) + //Search bar functionality and button + HStack { + TextField("Job Search", text: $jobSearchedValue) + .padding(.leading, 30.0) + .frame(alignment:.leading) + + Button (action: {foundJobs = searchFunction( query:jobSearchedValue)}, label: { + Label("", systemImage:"magnifyingglass") + }) + .foregroundColor(.black) + .frame(width: 20, height: 20) + .padding([.trailing], 30.0) + } } + Image(systemName: "line.3.horizontal.decrease.circle") + .font(.system(size: 25)) } - - VStack(alignment:.leading) { - - HStack { - Text("Filters") - .bold() - .padding(.leading, 20) - Spacer() + .padding() + HStack { + ScrollView(.horizontal) { + HStack { + ForEach(tags) { tag in + TagRectangleView(displayTag: tag, removable: false) + .fixedSize() + } + } + .padding(.leading, 20) + .padding(.trailing, 20) + .padding() } } - - List { - + ScrollView { + ForEach(searchResults) { program in + SearchCardView(displayedProgram: program, areTagsRemovable: false, paddingAmount: 10) + } } .frame(width: UIScreen.main.bounds.width-20, alignment:.leading) .cornerRadius(8) diff --git a/AddED+/Views/UserInterests.swift b/AddED+/Views/UserInterests.swift index d451294..5fc472d 100644 --- a/AddED+/Views/UserInterests.swift +++ b/AddED+/Views/UserInterests.swift @@ -6,12 +6,13 @@ // import SwiftUI -import WrappingHStack +//import WrappingHStack struct UserInterests: View { var tags: [Tag] = placeholderTags var inputTags: [Tag] = inputTag - // @State var addedTag: Bool + @State private var totalHeight + = CGFloat.zero var body: some View { VStack { @@ -34,12 +35,18 @@ struct UserInterests: View { .background(.white) .cornerRadius(8) ZStack { - ScrollView() { - VStack(spacing: 0) { + ScrollView(.horizontal) { + LazyVGrid(columns: [ + .init(.fixed(120), spacing: 90), + .init(.adaptive( + minimum: 40), spacing: 60) + ]) { ForEach(tags) { tag in - TagListView(usedTag: tag) + TagRectangleView(displayTag: tag, removable: true) + .fixedSize() } } + .padding(16) } } .frame(width: UIScreen.main.bounds.width-20, height: 250, alignment: .topLeading) @@ -57,7 +64,7 @@ struct UserInterests: View { ZStack { Rectangle() .fill(.addED) - .frame(width:200, height: 80) + .frame(width:200, height: 70) .cornerRadius(8) Text("Next") .foregroundColor(.white) @@ -73,10 +80,3 @@ struct UserInterests: View { #Preview { UserInterests() } - -// if !addedTag { -// forEach(inputTags) { -// tag in -//TagRectangleView(displayTag: tag, removable: true) -// } -// }