Skip to content
Merged
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
6 changes: 3 additions & 3 deletions Uplift/Models/Equipment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ struct Equipment: Hashable {
/// The name of this equipment.
let name: String

/// The amount of this equipment in the given facility.
let quantity: Int
/// The amount of this equipment in the given facility,`nil` if it cannot be quantified.
let quantity: Int?

// MARK: - Functions

Expand All @@ -38,7 +38,7 @@ struct Equipment: Hashable {
self.equipmentType = equipment.equipmentType.value
self.facilityId = equipment.facilityId
self.name = equipment.name
self.quantity = equipment.quantity ?? 0
self.quantity = equipment.quantity
}

}
Expand Down
21 changes: 11 additions & 10 deletions Uplift/Views/Home/FitnessCenterView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,19 @@ struct FitnessCenterView: View {
VStack(alignment: .leading, spacing: 4) {
Text(equipmentType.description)
.lineLimit(1)
.font(Constants.Fonts.bodySemibold)
.padding(EdgeInsets(top: 16, leading: 16, bottom: 2, trailing: 16))
.foregroundStyle(Constants.Colors.black)
.font(Constants.Fonts.h3)
.padding(.bottom, 2)

equipmentTypeCellView(eqmtType: equipmentType)
.frame(alignment: .leading)

Spacer()
}
.padding(16)
.frame(width: 247)
.fixedSize(horizontal: true, vertical: false)
.overlay(
RoundedRectangle(cornerRadius: 12)
RoundedRectangle(cornerRadius: 4)
.stroke(Constants.Colors.gray01, lineWidth: 1)
.upliftShadow(Constants.Shadows.smallLight)
)
Expand All @@ -167,18 +168,18 @@ struct FitnessCenterView: View {

private func equipmentTypeCellView(eqmtType: EquipmentType) -> some View {
ForEach(fc?.equipment.filter({$0.equipmentType == eqmtType}) ?? [], id: \.self) { eqmt in
HStack {
HStack(spacing: 12) {
Text(eqmt.name)
.foregroundStyle(Constants.Colors.black)
.font(Constants.Fonts.labelLight)
.multilineTextAlignment(.leading)
.padding(.trailing, 20)

Spacer()
.frame(width: 190, alignment: .leading)

Text(String(eqmt.quantity))
Text(eqmt.quantity == nil ? "" : String(eqmt.quantity ?? 0))
.foregroundStyle(Constants.Colors.black)
.font(Constants.Fonts.labelLight)
.frame(maxWidth: .infinity, alignment: .trailing)
}
.padding(.horizontal, 16)
}
}

Expand Down