Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions berkeley-mobile.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@
55DCF78923722CF1001B01B8 /* Fonts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55DCF78823722CF1001B01B8 /* Fonts.swift */; };
55DCF79623723CF2001B01B8 /* UIView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55DCF79523723CF2001B01B8 /* UIView+Extensions.swift */; };
C14CCB612D9CC2730075FE69 /* BMFilterButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = C14CCB602D9CC2680075FE69 /* BMFilterButton.swift */; };
C60EC4352ED5641B007195A0 /* DistanceLabelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C60EC4342ED56412007195A0 /* DistanceLabelView.swift */; };
C67BE4412ED12A6E0037005D /* BMSortOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = C67BE4402ED12A6E0037005D /* BMSortOption.swift */; };
C67BE4432ED12AFE0037005D /* BMSortMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C67BE4422ED12AFB0037005D /* BMSortMenuView.swift */; };
C67BE4452ED12B730037005D /* BMSortEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = C67BE4442ED12B6E0037005D /* BMSortEngine.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 @@ -337,6 +341,10 @@
55DCF79523723CF2001B01B8 /* UIView+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Extensions.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>"; };
C14CCB602D9CC2680075FE69 /* BMFilterButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BMFilterButton.swift; sourceTree = "<group>"; };
C60EC4342ED56412007195A0 /* DistanceLabelView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DistanceLabelView.swift; sourceTree = "<group>"; };
C67BE4402ED12A6E0037005D /* BMSortOption.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BMSortOption.swift; sourceTree = "<group>"; };
C67BE4422ED12AFB0037005D /* BMSortMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BMSortMenuView.swift; sourceTree = "<group>"; };
C67BE4442ED12B6E0037005D /* BMSortEngine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BMSortEngine.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 @@ -676,6 +684,7 @@
2913595524B135B600DE9AD6 /* DetailView */ = {
isa = PBXGroup;
children = (
C60EC4342ED56412007195A0 /* DistanceLabelView.swift */,
01BC8EAF24E8C3E3005B4969 /* DetailView.swift */,
01FA50F224E8BA5400DCC490 /* LocationDetailView.swift */,
29345E2624A7E76300859A88 /* OverviewCardView.swift */,
Expand Down Expand Up @@ -1225,6 +1234,7 @@
29345E2724A7E76300859A88 /* OverviewCardView.swift in Sources */,
01D11B902504560700BDF660 /* GymDetailViewController.swift in Sources */,
55AF442D2453ACE600F13232 /* BMDiningLocation.swift in Sources */,
C60EC4352ED5641B007195A0 /* DistanceLabelView.swift in Sources */,
136DC97B2398B4D1009B1810 /* UIViewController+Extensions.swift in Sources */,
2913595724B136BE00DE9AD6 /* CollapsibleCardView.swift in Sources */,
E83C6CED2B71DF190085E277 /* SafariWebView.swift in Sources */,
Expand Down
25 changes: 25 additions & 0 deletions berkeley-mobile/Common/DetailView/DistanceLabelView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// DistanceLabelView.swift
// berkeley-mobile
//
// Created by Ananya Dua on 11/24/25.
// Copyright © 2025 ASUC OCTO. All rights reserved.
//

import SwiftUI

struct DistanceLabelView: View {
let distance: Double?

var body: some View {
HStack {
Image(systemName: "figure.walk")
.foregroundStyle(Color(BMColor.blackText))
.font(.system(size: 12))

Text("\(distance ?? 0.0, specifier: "%.1f") mi")
.foregroundStyle(Color(BMColor.blackText))
.font(Font(BMFont.light(12)))
}
}
}
20 changes: 12 additions & 8 deletions berkeley-mobile/Home/Guides/GuideDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,18 @@ struct GuideDetailRowHeaderView: View {
.frame(maxWidth: 370)
.frame(height: 220)
.clipped()

VStack {
Spacer()

HStack(spacing: 10) {
Text(place.name)
.font(Font(BMFont.bold(20)))
VStack(alignment: .leading, spacing: 4) {
Text(place.name)
.font(Font(BMFont.bold(20)))

DistanceLabelView(distance: place.distanceToUser)
}
Comment on lines +65 to +70
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should use the user distance to location view that we already use in the home drawer:

Image

It's located as distanceLabelView in HomeSectionListRowView.swift. You should refactor this into its own reusable view.


Spacer()

if place.hasWebsite {
Expand All @@ -75,7 +82,7 @@ struct GuideDetailRowHeaderView: View {
viewModel.call(place)
}
}

if place.hasCoordinate {
GuideDetailRowActionItemView(systemName: "map", backgroundColor: .blue) {
viewModel.openPlaceInMaps(for: place)
Expand All @@ -89,22 +96,19 @@ struct GuideDetailRowHeaderView: View {
}
}
.fullScreenCover(isPresented: $isPresentingWebView) {
if let websiteURLString = place.websiteURLString, let url = URL(string: websiteURLString) {
if let urlString = place.websiteURLString,
let url = URL(string: urlString) {
SafariWebView(url: url)
}
}
}
}


// MARK: - GuideDetailRowActionItemView

struct GuideDetailRowActionItemView: View {
@Environment(GuidesViewModel.self) private var viewModel

var systemName: String
var backgroundColor: Color

var actionHandler: () -> Void

var body: some View {
Expand Down
34 changes: 17 additions & 17 deletions berkeley-mobile/Home/HomeSectionListRowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct HomeSectionListRowView: View {
HStack {
Group {
openClosedStatusView
distanceLabelView
DistanceLabelView(distance: rowItem.distanceToUser)
}
.applyHomeDrawerRowAttributesStyle()
}
Expand All @@ -43,27 +43,27 @@ struct HomeSectionListRowView: View {
}
}

private var distanceLabelView: some View {
HStack {
Image(systemName: "figure.walk")
.foregroundStyle(Color(BMColor.blackText))
.font(.system(size: 12))

Text("\(rowItem.distanceToUser ?? 0.0, specifier: "%.1f") mi")
.foregroundStyle(Color(BMColor.blackText))
.font(Font(BMFont.light(12)))
}
}

private var imageView: some View {
BMCachedAsyncImageView(imageURL: rowItem.imageURL, placeholderImage: BMConstants.doeGladeImage, aspectRatio: .fill)
.frame(maxWidth: 80, maxHeight: 80)
.clipShape(RoundedRectangle(cornerRadius: 12))
BMCachedAsyncImageView(
imageURL: rowItem.imageURL,
placeholderImage: BMConstants.doeGladeImage,
aspectRatio: .fill
)
.frame(maxWidth: 80, maxHeight: 80)
.clipShape(RoundedRectangle(cornerRadius: 12))
}
}

#Preview {
let foothillDiningHall = BMDiningHall(name: "Foothill", address: nil, phoneNumber: nil, imageLink: "https://firebasestorage.googleapis.com/v0/b/berkeley-mobile.appspot.com/o/images%2FFoothill.jpg?alt=media&token=b645d675-6f51-45ea-99f7-9b36576e14b7", hours: [], latitude: 37.87538, longitude: -122.25612109999999)
let foothillDiningHall = BMDiningHall(
name: "Foothill",
address: nil,
phoneNumber: nil,
imageLink: "https://firebasestorage.googleapis.com/v0/b/berkeley-mobile.appspot.com/o/images%2FFoothill.jpg?alt=media&token=b645d675-6f51-45ea-99f7-9b36576e14b7",
hours: [],
latitude: 37.87538,
longitude: -122.25612109999999
)

return HomeSectionListRowView(rowItem: foothillDiningHall)
.padding(40)
Expand Down