Skip to content
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
6293188
something
Chhumbucket Mar 12, 2025
72e7aec
Created SwiftUI view for MapMarkerDetail
Chhumbucket Mar 13, 2025
dff7222
Added Button templates
Chhumbucket Mar 13, 2025
a6500af
Added fixes and changes button to the formatting guide. Worried about…
Chhumbucket Mar 15, 2025
7afef88
merging
Chhumbucket Mar 20, 2025
0bdc698
Fixed Colors
Chhumbucket Mar 20, 2025
77356ee
message
Chhumbucket Mar 20, 2025
504bff5
Implemented SwiftUI Map marker, bug when on menstrual category, onclo…
Chhumbucket Mar 29, 2025
83d72c1
Fixed padding
Chhumbucket Mar 29, 2025
bb79a60
Save before Essa
Chhumbucket Mar 29, 2025
7d1e11c
Saving
Chhumbucket Mar 31, 2025
d273278
Merge branch 'master' of github.com:asuc-octo/berkeley-mobile-ios
Chhumbucket Mar 31, 2025
b93720b
BER-80: Fix project file structure after merge
Chhumbucket Apr 1, 2025
d48348f
Revert "Fixed padding"
Chhumbucket Apr 1, 2025
152c754
Fixed the MapViewController
Chhumbucket Apr 1, 2025
1d6da83
Added Justin and Baurzjohn fixes
Chhumbucket Apr 2, 2025
5bc47fc
Add new line
Chhumbucket Apr 2, 2025
102796f
Fix spacing
Chhumbucket Apr 2, 2025
c5d7da4
fixed marks
Chhumbucket Apr 2, 2025
af98076
Fixing space
Chhumbucket Apr 2, 2025
329c5e5
Changed sizes
Chhumbucket Apr 3, 2025
a2ae856
Fix alignedmnet
Chhumbucket Apr 3, 2025
3f048bb
Messing with changes
Chhumbucket Apr 5, 2025
8b8707a
Added fixes
Chhumbucket Apr 5, 2025
0d61a4d
Adding changes
Chhumbucket May 2, 2025
ac7752b
Fixed the padding, I want to make the code more modular
Chhumbucket May 2, 2025
2a39354
Modular
Chhumbucket May 2, 2025
6efe6d4
Fixed negative space
Chhumbucket May 3, 2025
12c0663
adding version
Chhumbucket May 3, 2025
ffd7cb5
Merge branch 'master' of github.com:asuc-octo/berkeley-mobile-ios
Chhumbucket May 3, 2025
b25e4c1
Merge branch 'master' into dylchhum/ber-80
Chhumbucket May 3, 2025
ae98773
Merge branch 'master' of github.com:asuc-octo/berkeley-mobile-ios
Chhumbucket May 27, 2025
a7e0d43
Merge branch 'master' into dylchhum/ber-80
Chhumbucket May 27, 2025
e0b442c
Fixed crashing lost info sheet
Chhumbucket May 30, 2025
9d09882
Fixed everything
Chhumbucket May 30, 2025
bf6a6bd
Added fixes
Chhumbucket May 30, 2025
49062fd
Merge branch 'master' of github.com:asuc-octo/berkeley-mobile-ios
Chhumbucket May 30, 2025
81b6135
Merge branch 'master' into dylchhum/ber-80
Chhumbucket May 30, 2025
2b3aae2
Merge branch 'master' of github.com:asuc-octo/berkeley-mobile-ios
Chhumbucket Jun 15, 2025
f363f0c
pushing
Chhumbucket Jun 15, 2025
f3c1a44
add merge fixes
Chhumbucket Jun 15, 2025
5c99411
Added Justin Fixes
Chhumbucket Jun 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions berkeley-mobile.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
55DCF79B237243D4001B01B8 /* MaterialTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55DCF79A237243D4001B01B8 /* MaterialTextField.swift */; };
55DCF79D237243F5001B01B8 /* RippleLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55DCF79C237243F5001B01B8 /* RippleLayer.swift */; };
55DCF7A123724835001B01B8 /* MaterialButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55DCF7A023724835001B01B8 /* MaterialButton.swift */; };
7FC99C602D810A820010724D /* MapMarkerDetailSwiftView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FC99C5F2D810A820010724D /* MapMarkerDetailSwiftView.swift */; };
E80330EB2CE431C200DC9574 /* DepthButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = E80330EA2CE431C200DC9574 /* DepthButtonStyle.swift */; };
E80330ED2CE7EBB100DC9574 /* NSCoding+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = E80330EC2CE7EBB100DC9574 /* NSCoding+Extension.swift */; };
E80ECC312AFB02BA004604BA /* Secrets.swift in Sources */ = {isa = PBXBuildFile; fileRef = E80ECC302AFB02BA004604BA /* Secrets.swift */; };
Expand Down Expand Up @@ -347,6 +348,7 @@
55DCF79C237243F5001B01B8 /* RippleLayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RippleLayer.swift; sourceTree = "<group>"; };
55DCF7A023724835001B01B8 /* MaterialButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MaterialButton.swift; sourceTree = "<group>"; };
61D128E68A4FC209FFCDE60F /* Pods-berkeley-mobile.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-berkeley-mobile.release.xcconfig"; path = "Target Support Files/Pods-berkeley-mobile/Pods-berkeley-mobile.release.xcconfig"; sourceTree = "<group>"; };
7FC99C5F2D810A820010724D /* MapMarkerDetailSwiftView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapMarkerDetailSwiftView.swift; sourceTree = "<group>"; };
E80330EA2CE431C200DC9574 /* DepthButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DepthButtonStyle.swift; sourceTree = "<group>"; };
E80330EC2CE7EBB100DC9574 /* NSCoding+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSCoding+Extension.swift"; sourceTree = "<group>"; };
E80330EE2CE9A8EB00DC9574 /* berkeley-mobile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "berkeley-mobile.entitlements"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -791,6 +793,7 @@
297678862426B7BA00FDD1EB /* SearchAnnotation.swift */,
2E1C227C2D835A9D0021803C /* SearchBarView.swift */,
13492D2C240E179F00AD3D1F /* MapMarkerDetailView.swift */,
7FC99C5F2D810A820010724D /* MapMarkerDetailSwiftView.swift */,
2E765C242D88BF3E008708CD /* SearchResultsView.swift */,
2ED4FB6A2D8BCB390086306A /* SearchViewModel.swift */,
2ED4FB682D8B7C430086306A /* SearchResultsListRowView.swift */,
Expand Down Expand Up @@ -1152,6 +1155,7 @@
0181711C25CB506A00BA6317 /* Encodable+JSON.swift in Sources */,
13135BB3241244370056B169 /* FilterViewCell.swift in Sources */,
016A56D42519E96800531A12 /* CampusCalendarViewController.swift in Sources */,
7FC99C602D810A820010724D /* MapMarkerDetailSwiftView.swift in Sources */,
298EE27025BB82A2002BAF0F /* CardTableViewCell.swift in Sources */,
13580AF62437D7E700D309AA /* LibraryDetailViewController.swift in Sources */,
135D7F77243A9BD1003F8BD1 /* Colors+GymClass.swift in Sources */,
Expand Down Expand Up @@ -1377,7 +1381,7 @@
CODE_SIGN_ENTITLEMENTS = "berkeley-mobile/berkeley-mobile.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 4HBETBULVA;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "berkeley-mobile/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -1401,7 +1405,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 4HBETBULVA;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "berkeley-mobile/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

277 changes: 277 additions & 0 deletions berkeley-mobile/Map/MapMarkerDetailSwiftView.swift
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-06-07.at.22.20.03.mp4

The MapMarkerDetailSwiftView is centered not aligned at the bottom.

Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
//
// MapMakerDetailSwiftView.swift
// berkeley-mobile
//
// Created by Dylan Chhum on 3/11/25.
// Copyright © 2025 ASUC OCTO. All rights reserved.
//

import Foundation
import MapKit
import SwiftUI

// MARK: - MapMarkerDetailSwiftView
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove MARK


struct MapMarkerDetailSwiftView: View {
var marker: MapMarker?
var onClose: (() -> Void)?


var body: some View {
ZStack {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this ZStack necessary?


HStack {
colorAccentBar

VStack(alignment: .leading, spacing: 8) {
headerView
descriptionView
infoRowView
.padding(.horizontal, 6)
}
.padding(.vertical, 10)
}
.background(Color(.systemBackground))
.clipShape(RoundedRectangle(cornerRadius: 12))
.frame(maxWidth: .infinity)
.frame(minWidth: 100, maxHeight: 150)
.shadow(color: .black.opacity(0.2), radius: 5, x: 0, y: 2)
.padding(.horizontal, 20)
}
}

// MARK: - Private Views


private var colorAccentBar: some View {
let markerColor: Color = {
guard let marker else { return .purple }

switch marker.type {
case .known(let type):
return Color(type.color())
case .unknown:
return Color(BMColor.MapMarker.other)
}
}()


return Rectangle()
.fill(markerColor)
.frame(width: 16)

}

private var headerView: some View {
HStack {
Text(marker?.title ?? "Unknown")
.font(Font(BMFont.bold(24)))
.foregroundColor(.primary)
.lineLimit(1)
.minimumScaleFactor(0.7)
Spacer()

Button(action: {
onClose?()
}) {
Image(systemName: "xmark")
.font(.system(size: 20))
.padding(.trailing, 10)
.foregroundStyle(Color.secondary)
}
}
}

private var descriptionView: some View {
Text(marker?.subtitle ?? "No description")
.font(Font(BMFont.regular(14)))
.lineLimit(3)
.minimumScaleFactor(0.6)
.fixedSize(horizontal: false, vertical: true)
.padding(.horizontal, 6)

}

private var infoRowView: some View {
HStack {
HStack {
Image(systemName: "clock.fill")
.font(.system(size: 20))
.foregroundColor(.secondary)
openStatusButton
}

Spacer()

locationInfoView

Spacer()

categoryView
}
.padding(.bottom, 6)
}

private var openStatusButton: some View {
Group {
if marker?.isOpen ?? false {
Capsule()
.fill(Color.blue)
.frame(width: 70, height: 28)
.overlay(Text("Open")
.font(Font(BMFont.medium(14)))
.foregroundStyle(.white))
} else {
Capsule()
.fill(Color(red: 0.4, green: 0.5, blue: 0.9))
.frame(width: 70, height: 28)
.overlay(Text("Closed")
.font(Font(BMFont.medium(14)))
.foregroundStyle(.white))
}
}
}

private var locationInfoView: some View {
HStack {
Image(systemName: "mappin.and.ellipse")
.font(.system(size: 20))
.foregroundColor(.secondary)
Text(marker?.address ?? "No Address")
.font(Font(BMFont.regular(12)))
.foregroundColor(.primary)
.lineLimit(3)
.minimumScaleFactor(0.6)
}
}

private var categoryView: some View {
HStack() {
Image(systemName: getCategoryIcon())
.font(.system(size: 20))
.foregroundColor(.secondary)
if let marker, case .known(let type) = marker.type, type == .cafe, let mealPrice = marker.mealPrice {
Text(mealPrice)
.font(Font(BMFont.regular(12)))
.foregroundColor(.primary)
.minimumScaleFactor(0.7)
} else {
Text("<10")
.font(Font(BMFont.regular(12)))
.foregroundColor(.primary)
}
}
}

private func getCategoryIcon() -> String {
guard let marker else {
return "questionmark.circle"
}

switch marker.type {
case .known(let type):
switch type {
case .cafe:
return "fork.knife"
case .store:
return "bag"
case .mentalHealth:
return "brain"
case .genderInclusiveRestrooms:
return "toilet"
case .menstrualProductDispensers:
return "drop"
case .garden:
return "leaf"
case .bikes:
return "bicycle"
case .lactation:
return "heart"
case .rest:
return "bed.double"
case .microwave:
return "bolt"
case .printer:
return "printer"
case .water:
return "drop.fill"
case .waste:
return "trash"
case .none:
return "mappin"
}
case .unknown:
return "mappin"
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we have a icon() method on a MapMarker that returns a UIImage? maybe use that?



private var girInfoView: some View {
VStack {
let accessibleGIRs = marker?.accessibleGIRs ?? []
let nonAccessibleGIRs = marker?.nonAccessibleGIRs ?? []

Text("Accessible:")
.font(Font(BMFont.bold(12)))
.padding(.leading, 20)

Text(accessibleGIRs.isEmpty ? "None" : accessibleGIRs.joined(separator: ", "))
.font(Font(BMFont.light(12)))
.padding(.leading, 20)

Text("Non-Accessible:")
.font(Font(BMFont.bold(12)))
.padding(.leading, 20)
.padding(.top, 4)

Text(nonAccessibleGIRs.isEmpty ? "None" : nonAccessibleGIRs.joined(separator: ", "))
.font(Font(BMFont.light(12)))
.padding(.leading, 20)
}
}

private var mpdInfoView: some View {
VStack {
ForEach(marker?.mpdRooms ?? [], id: \.roomNumber) { room in
VStack(alignment: .leading, spacing: 2) {
Text("Gender Type: \(room.bathroomType)")
.font(Font(BMFont.light(12)))
Text("Floor: \(room.floorName)")
.font(Font(BMFont.light(12)))
Text("Room Number: \(room.roomNumber)")
.font(Font(BMFont.light(12)))
Text("Products: \(room.productType)")
.font(Font(BMFont.light(12)))
}
.padding(.leading, 20)
.padding(.bottom, 8)
}
}
}
}

// MARK: - Preview

#Preview {
MapMarkerDetailSwiftView(
marker: MapMarker(
type: "Cafe",
location: CLLocationCoordinate2D(latitude: 37.871684, longitude: -122.259934),
name: "Golden Bear Cafe",
description: "A retail Cal Dining location featuring a Peet Coffee & tea store, made- to-go order deli and bagels bar, smoothies, and grab-and-go items.",
address: "Lower Sproul Plaza",
onCampus: true,
phone: "510-123-4567",
email: "[email protected]",
weeklyHours: nil,
appointment: false,
mealPrice: "$5-10",
cal1Card: true,
eatWell: true,
mpdRooms: nil,
accessibleGIRs: nil,
nonAccesibleGIRs: nil
),
onClose: {}
)
}
2 changes: 1 addition & 1 deletion berkeley-mobile/Map/MapMarkerDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protocol MapMarkerDetailViewDelegate {
/** The view that is shown when a `MapMarker` is selected. */
class MapMarkerDetailView: UIView {

open var marker: MapMarker? {
open var marker : MapMarker? {
didSet {
if let marker = marker {
setupView(marker)
Expand Down
Loading