Skip to content

Conversation

@ananyadua27
Copy link
Collaborator

@ananyadua27 ananyadua27 commented Nov 22, 2025

This PR adds the missing distance label to each Guide Place inside the GuideDetailView.
The goal is to match the behavior already used in Dining, Fitness, and Study views, where each location shows how far it is from the current user.

Previously, the distance-to-user display was implemented inline in HomeSectionListRowView. We now extract that implementation into a shared DistanceLabelView component and use it in both the Home drawer and Guide detail views.

What Was Changed

  • Created a new reusable DistanceLabelView component with the walking figure icon and distance formatting
  • Refactored HomeSectionListRowView to use the new DistanceLabelView component instead of inline implementation
  • Added distance label to each Guide Place inside GuideDetailRowHeaderView using the same component
  • Distance display now consistent across Home drawer (Dining, Fitness, Study) and Guide detail views

Testing

  • Built and tested on iOS Simulator.
  • Confirmed distance displays correctly once user location is available.
  • Verified web, phone, and map buttons still function normally.
  • Verified no layout shifts or broken overlays on the header image.

Closes #462

Screenshot 2025-11-24 at 8 18 11 PM

Copy link
Collaborator

@justinwongeecs justinwongeecs left a comment

Choose a reason for hiding this comment

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

The only file that should be changed in the diff is GuideDetailView and a new file for a reusable view with the person walking symbol and the numerical distance used for items in the home drawer and now in GuideDetailView.

Comment on lines 65 to 70
VStack(alignment: .leading, spacing: 4) {
Text(place.name)
.font(Font(BMFont.bold(20)))

if let d = place.distanceToUser {
Text(String(format: "%.1f miles away", d))
.font(Font(BMFont.regular(14)))
.foregroundStyle(.secondary)
}
}
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.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this file and all the files under Common/FilterView should be in this PR

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think the changes in this file should be part of this PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was working on two issues almost parallelly. These files are a part of this PR: #482. Sorry for the confusion!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Cleaned up my branch with irrelevant commits. Refactored distance label into reusable DistanceLabelView component as requested

Comment on lines 46 to +47
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)))
}
DistanceLabelView(distance: rowItem.distanceToUser)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can remove the distanceLabelView private variable all together because it just contains DistanceLabelView.

You can use DistanceLabelView directly in the view's body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show User Location For Each Guide Place

3 participants