Skip to content

Commit

Permalink
Vehicle Display in settings (#341)
Browse files Browse the repository at this point in the history
* style: Change Vehicle Display in settings

* style: (corrected v2) Change Vehicle Display in settings

* style: The vehicle name with the bolded words, instead of year, make and model

* Remove Display Name title

---------

Co-authored-by: Mikaela Caron <mikaelacaron@gmail.com>
  • Loading branch information
maartinj and mikaelacaron authored Oct 15, 2024
1 parent a3dad0e commit 6e6a911
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 21 deletions.
9 changes: 9 additions & 0 deletions Basic-Car-Maintenance/Shared/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,9 @@
}
}
}
},
"Color: %@" : {

},
"Continue" : {

Expand Down Expand Up @@ -3578,6 +3581,9 @@
},
"Open Source" : {

},
"Plate: %@" : {

},
"Preferred units" : {
"comment" : "Label for units selected when adding an odometer reading",
Expand Down Expand Up @@ -5784,6 +5790,9 @@
}
}
}
},
"VIN: %@" : {

},
"Welcome 🥳" : {

Expand Down
50 changes: 29 additions & 21 deletions Basic-Car-Maintenance/Shared/Settings/Views/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,30 +90,38 @@ struct SettingsView: View {

Section {
ForEach(viewModel.vehicles) { vehicle in
VStack(alignment: .leading) {
Text(vehicle.name)
VStack(alignment: .leading, spacing: 2) {
Text("\(vehicle.name)")
.fontWeight(.bold)
.font(.headline)

Text(vehicle.make)

Text(vehicle.model)

if let year = vehicle.year, !year.isEmpty {
Text(year)
}

if let color = vehicle.color, !color.isEmpty {
Text(color)
}

if let vin = vehicle.vin, !vin.isEmpty {
Text(vin)
}

if let licensePlateNumber = vehicle.licensePlateNumber,
!licensePlateNumber.isEmpty {
Text(licensePlateNumber)
Group {
HStack {
if let year = vehicle.year, !year.isEmpty {
Text(year)
}

Text(vehicle.make)

Text(vehicle.model)
}

if let licensePlateNumber =
vehicle.licensePlateNumber,
!licensePlateNumber.isEmpty {
Text("Plate: \(licensePlateNumber)")
}

if let vin = vehicle.vin, !vin.isEmpty {
Text("VIN: \(vin)")
}

if let color = vehicle.color, !color.isEmpty {
Text("Color: \(color)")
}
}
.font(.callout)
.foregroundStyle(.secondary)
}
.swipeActions {
Button(role: .destructive) {
Expand Down

0 comments on commit 6e6a911

Please sign in to comment.