Skip to content

Commit 93c726e

Browse files
committed
initial showing note on the UI
1 parent a3d5bf2 commit 93c726e

File tree

3 files changed

+35
-18
lines changed

3 files changed

+35
-18
lines changed

WooCommerce/Classes/Bookings/BookingsTabView.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ struct BookingsTabView: View {
5050
} detail: {
5151
if let selectedBooking {
5252
let viewModel = BookingDetailsViewModel(booking: selectedBooking)
53-
BookingDetailsView(viewModel)
53+
NavigationStack {
54+
BookingDetailsView(viewModel)
55+
}
5456
} else {
5557
Text("Select a booking to see details.")
5658
}

WooCommerce/Classes/ViewModels/Booking Details/BookingDetailsViewModel.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ final class BookingDetailsViewModel: ObservableObject {
3333
booking.attendanceStatus
3434
}
3535

36+
var note: String { booking.note }
37+
3638
init(booking: Booking,
3739
stores: StoresManager = ServiceLocator.stores,
3840
storage: StorageManagerType = ServiceLocator.storageManager) {
@@ -379,9 +381,9 @@ private extension BookingDetailsViewModel {
379381
)
380382

381383
static let bookingNotesSectionHeaderTitle = NSLocalizedString(
382-
"BookingDetailsView.bookingNotes.headerTitle",
383-
value: "Booking notes",
384-
comment: "Header title for the 'Booking notes' section in the booking details screen."
384+
"BookingDetailsView.bookingNote.headerTitle",
385+
value: "Booking note",
386+
comment: "Header title for the 'Booking note' section in the booking details screen."
385387
)
386388

387389
static let cancelBookingAlertMessage = NSLocalizedString(

WooCommerce/Classes/ViewRelated/Bookings/Booking Details/BookingDetailsView.swift

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -239,17 +239,29 @@ private extension BookingDetailsView {
239239
}
240240

241241
func bookingNotesView() -> some View {
242-
HStack(spacing: Layout.contentSidePadding) {
243-
Image(systemName: "plus")
244-
.font(.title3.weight(.medium))
245-
Text(Localization.bookingNotesRowText)
246-
.rowTextStyle()
247-
Spacer()
248-
}
249-
.foregroundStyle(Color.accentColor)
250-
.padding(.vertical, Layout.rowTextVerticalPadding)
251-
.tappable {
252-
print("On Add a note tap")
242+
NavigationLink {
243+
// TODO: push booking notes editor
244+
Text(viewModel.note)
245+
} label: {
246+
HStack(alignment: .center, spacing: Layout.contentSidePadding) {
247+
if viewModel.note.isEmpty {
248+
Image(systemName: "plus")
249+
.font(.title3.weight(.medium))
250+
251+
Text(Localization.bookingNotesRowText)
252+
.rowTextStyle()
253+
.foregroundColor(.accentColor)
254+
} else {
255+
Text(viewModel.note)
256+
.rowTextStyle()
257+
.multilineTextAlignment(.leading)
258+
}
259+
260+
Spacer()
261+
262+
DisclosureIndicator()
263+
}
264+
.padding(.vertical, Layout.rowTextVerticalPadding)
253265
}
254266
}
255267
}
@@ -305,9 +317,9 @@ extension BookingDetailsView {
305317

306318
/// Booking notes
307319
static let bookingNotesRowText = NSLocalizedString(
308-
"BookingDetailsView.bookingNotes.addANoteRow.title",
320+
"BookingDetailsView.bookingNote.addANoteRow.title",
309321
value: "Add a note",
310-
comment: "Add a note row title in booking notes section in booking details view."
322+
comment: "Add a booking note section in booking details view."
311323
)
312324
}
313325
}
@@ -338,7 +350,8 @@ struct BookingDetailsView_Previews: PreviewProvider {
338350
localTimezone: "America/New_York",
339351
currency: "USD",
340352
orderInfo: nil,
341-
note: ""
353+
// note: ""
354+
note: "note note 123 note note note note note note note note note note note note note n312 ote note note note note note note note 123 note note note note note note note note note note note note note note note note note note note note note note note note note note "
342355
)
343356
let viewModel = BookingDetailsViewModel(booking: sampleBooking)
344357
return BookingDetailsView(viewModel)

0 commit comments

Comments
 (0)