Skip to content

Commit

Permalink
Added dot when note is not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-nirali-s committed Nov 28, 2024
1 parent d081741 commit 41baafd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 17 deletions.
42 changes: 27 additions & 15 deletions Splito/UI/Home/Expense/AddExpenseView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ struct AddExpenseView: View {
.scrollBounceBehavior(.basedOnSize)

AddNoteImageFooterView(date: $viewModel.expenseDate, showImagePickerOptions: $viewModel.showImagePickerOptions,
image: viewModel.expenseImage, imageUrl: viewModel.expenseImageUrl,
handleNoteBtnTap: viewModel.handleNoteBtnTap, handleImageTap: viewModel.handleExpenseImageTap,
handleActionSelection: viewModel.handleActionSelection(_:))
image: viewModel.expenseImage, imageUrl: viewModel.expenseImageUrl,
isNoteEmpty: viewModel.expenseNote.isEmpty, handleNoteBtnTap: viewModel.handleNoteBtnTap,
handleImageTap: viewModel.handleExpenseImageTap,
handleActionSelection: viewModel.handleActionSelection(_:))
}
}
.background(surfaceColor)
Expand Down Expand Up @@ -210,6 +211,7 @@ struct AddNoteImageFooterView: View {

let image: UIImage?
let imageUrl: String?
let isNoteEmpty: Bool

let handleNoteBtnTap: (() -> Void)
let handleImageTap: (() -> Void)
Expand All @@ -227,7 +229,7 @@ struct AddNoteImageFooterView: View {

ImageAttachmentView(image: image, imageUrl: imageUrl, handleImageBtnTap: handleImageTap)

NoteButtonView(handleNoteBtnTap: handleNoteBtnTap)
NoteButtonView(isNoteEmpty: isNoteEmpty, handleNoteBtnTap: handleNoteBtnTap)
}
.padding(.vertical, 12)
.padding(.horizontal, 16)
Expand Down Expand Up @@ -274,20 +276,30 @@ private struct ImageAttachmentView: View {

private struct NoteButtonView: View {

let isNoteEmpty: Bool

let handleNoteBtnTap: (() -> Void)

var body: some View {
Button {
UIApplication.shared.endEditing()
handleNoteBtnTap()
} label: {
Image(.noteIcon)
.resizable()
.scaledToFit()
.frame(width: 24, height: 24)
.padding(4)
.background(container2Color)
.cornerRadius(8)
ZStack(alignment: .topTrailing) {
Button {
UIApplication.shared.endEditing()
handleNoteBtnTap()
} label: {
Image(.noteIcon)
.resizable()
.scaledToFit()
.frame(width: 24, height: 24)
.padding(4)
.background(container2Color)
.cornerRadius(8)
}

if !isNoteEmpty {
Circle()
.fill(primaryColor)
.frame(width: 6, height: 6)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ struct GroupPaymentView: View {
.scrollBounceBehavior(.basedOnSize)

AddNoteImageFooterView(date: $viewModel.paymentDate, showImagePickerOptions: $viewModel.showImagePickerOptions,
image: viewModel.paymentImage, imageUrl: viewModel.paymentImageUrl, handleNoteBtnTap: viewModel.handleNoteBtnTap,
handleImageTap: viewModel.handlePaymentImageTap, handleActionSelection: viewModel.handleActionSelection(_:))
image: viewModel.paymentImage, imageUrl: viewModel.paymentImageUrl,
isNoteEmpty: viewModel.paymentNote.isEmpty, handleNoteBtnTap: viewModel.handleNoteBtnTap,
handleImageTap: viewModel.handlePaymentImageTap,
handleActionSelection: viewModel.handleActionSelection(_:))
}
}
}
Expand Down

0 comments on commit 41baafd

Please sign in to comment.