Conversation
justinwongeecs
left a comment
There was a problem hiding this comment.
love the design! just a few comments
| } header: { | ||
| HStack { | ||
| Text(mealCategory.categoryName) | ||
| .font(Font(BMFont.bold(20))) | ||
| .font(.headline) | ||
| Spacer() | ||
| } |
There was a problem hiding this comment.
Let's keep it in the section header because maybe in the future if we decide to add collapsible headers then we can really easily do it.
Also if we decide to change up the list or form style, putting the view in the header gives us automatic styling changes.
| List { | ||
| ScrollView { | ||
| DiningItemsListView(selectedTabIndex: $selectedTabIndex, | ||
| categoriesAndMenuItems: categoriesAndMenuItems, | ||
| diningHall: diningHall, | ||
| filteredTabNames: filteredTabNames) | ||
| } | ||
| .listStyle(.plain) | ||
| .scrollContentBackground(.hidden) | ||
| .contentMargins(.top, 0) |
There was a problem hiding this comment.
We should keep the List because it's more performant. A ScrollView keeps all of its subviews in memory regardless if it's visible. A List has cell reusability like what UITableView and UICollectionView do.
|
|
||
| // MARK: - DiningMenuItemDetailView | ||
|
|
||
| struct DiningMenuItemDetailView: View { |
There was a problem hiding this comment.
Refactor DiningMenuItemDetailView into another file.
| if let servingSize = menuDetail.servingSize { | ||
| VStack(alignment: .leading, spacing: 8) { | ||
| Text("Serving Size") | ||
| .font(Font(BMFont.bold(20))) | ||
| DiningDetailRowView { | ||
| Text(servingSize) | ||
| .font(Font(BMFont.regular(15))) | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Let's refactor these subviews into private var under DiningDetailView for better readability
| let calories = Double(nutrition["Calories (kcal)"] ?? "0") ?? 0 | ||
| let remainingNutrition = nutrition.filter { $0.key != "Calories (kcal)" } | ||
| let protein = Int(nutrition["Protein (g)"]?.filter { $0.isNumber } ?? "0") ?? 0 | ||
| let carb = Int(nutrition["Carbohydrate (g)"]?.filter { $0.isNumber } ?? "0") ?? 0 | ||
| let fat = (Int(nutrition["Total Lipid/Fat (g)"]?.filter { $0.isNumber } ?? "0") ?? 0) + (Int(nutrition["Trans Fat (g)"]?.filter { $0.isNumber } ?? "0") ?? 0) |
There was a problem hiding this comment.
Maybe we should have these as computed properties under BMMenuItemDetail?
| VStack(alignment: .leading, spacing: 8) { | ||
| Text("Ingredients") | ||
| .font(Font(BMFont.bold(20))) | ||
| Text(ingredients) | ||
| .font(Font(BMFont.regular(15))) | ||
| } | ||
| .padding() | ||
| .frame(maxWidth: .infinity, alignment: .leading) | ||
| .shadowfy() |
There was a problem hiding this comment.
It looks a bit weird how the header "Ingredients" is within the padded rectangle but "Serving Size", "MacroNutrients", and "Nutrition Facts" are "outside the content" if you get what I mean.
For consistency, we should bring the header "Ingredients" out.
| } | ||
| .padding() | ||
| .frame(maxWidth: .infinity) | ||
| .shadowfy() |
There was a problem hiding this comment.
Maybe we don't .shadowfy()? The rest of the DiningDetailRowView don't have shadows so it's kinda of weird how "MacroNutrients" and "Ingredients" are the ones that only have shadows.
| ("Fat", .orange) | ||
| ] | ||
| VStack(alignment: .leading, spacing: 8) { | ||
| Text("MacroNutrients") |
There was a problem hiding this comment.
nit: MacroNutrients → Macronutrients
| } | ||
| } | ||
|
|
||
| struct ProgressCapsule: View { |
There was a problem hiding this comment.
Maybe we should rename it to something more specific? ProgressCapsule sounds like it's a generic view that can be used for many different scenarios. But it looks like it's built specifically to show macronutrients. So something like MacronutrientsBreakdownCapsuleView?
| Circle() | ||
| .fill(macro.color) | ||
| .frame(width: 12, height: 12) | ||
| Text(macro.label) |
There was a problem hiding this comment.
I feel "Protein", "Carb", and "Fact" font size should be smaller than the "Calories" one since they're just like the legend for a map. Right now, they are larger than the calories text which is the primary text we want users to focus on.
Added the information from the webscrapper to now be presented on the app. The menu are not clickable that appends the view into the stack.
Screen.Recording.2026-03-06.at.2.33.15.AM.mov
On top of adding recipes and allergens. I added a macronutrients bar that tells the user the ratios between protein, fat, and carbs that they are eating.
Let me know if you want other features added on this. Also notice a bug where we have two brown's Cafe. For the Browns the recipe works but for Brown's Cafe the recipe does not work. The scrapper does not seem to add to brown cafe. Might need to remove Brown's cafe and change it.