diff --git a/BDKSwiftExampleWallet/View/Activity/TransactionItemView.swift b/BDKSwiftExampleWallet/View/Activity/TransactionItemView.swift index b268faa3..b843fa93 100644 --- a/BDKSwiftExampleWallet/View/Activity/TransactionItemView.swift +++ b/BDKSwiftExampleWallet/View/Activity/TransactionItemView.swift @@ -30,50 +30,50 @@ struct TransactionItemView: View { var body: some View { - HStack(spacing: 15) { + VStack(alignment: .leading, spacing: 20) { - if isRedacted { - Image( - systemName: - "circle.fill" - ) - .font(.largeTitle) - .symbolRenderingMode(.palette) - .foregroundStyle( - Color.gray.opacity(0.5) - ) - } else { - ZStack { - Image(systemName: "circle.fill") - .font(.largeTitle) - .foregroundStyle(Color.gray.opacity(0.25)) + let delta = txDetails.balanceDelta + let prefix = (delta >= 0 ? "+ " : "- ").appending("\(format.displayPrefix) ") + let amount = format.formatted(UInt64(abs(delta)), fiatPrice: fiatPrice) + let suffix = format.displayText + + Text("\(prefix)\(amount) \(suffix)") + .font(.title) + .fontWeight(.semibold) + .fontDesign(.rounded) + .lineLimit(1) + .redacted(reason: isRedacted ? .placeholder : []) + + HStack { + if isRedacted { Image( systemName: - txDetails.balanceDelta >= 0 - ? "arrow.down" : "arrow.up" + "circle.fill" ) - .font(.callout) + .symbolRenderingMode(.palette) .foregroundStyle( - { - switch txDetails.chainPosition { - case .confirmed(_, _): - Color.bitcoinOrange - case .unconfirmed(_): - Color.gray.opacity(0.5) - } - }() + Color.gray.opacity(0.5) ) + } else { + ZStack { + Image( + systemName: + txDetails.balanceDelta >= 0 + ? "arrow.down" : "arrow.up" + ) + .foregroundStyle( + { + switch txDetails.chainPosition { + case .confirmed(_, _): + Color.bitcoinOrange + case .unconfirmed(_): + Color.gray.opacity(0.5) + } + }() + ) + } } - } - VStack(alignment: .leading, spacing: 5) { - Text(txDetails.txid.description) - .truncationMode(.middle) - .lineLimit(1) - .fontDesign(.monospaced) - .fontWeight(.semibold) - .font(.title) - .foregroundStyle(.primary) switch txDetails.chainPosition { case .confirmed(let confirmationBlockTime, _): Text( @@ -83,8 +83,7 @@ struct TransactionItemView: View { ) ) .lineLimit(dynamicTypeSize.isAccessibilitySize ? 2 : 1) - .font(.caption2) - .fontWidth(.condensed) + .redacted(reason: isRedacted ? .placeholder : []) case .unconfirmed(let timestamp): if let timestamp { Text( @@ -94,38 +93,31 @@ struct TransactionItemView: View { ) ) .lineLimit(dynamicTypeSize.isAccessibilitySize ? 2 : 1) - .font(.caption2) - .fontWidth(.condensed) + .redacted(reason: isRedacted ? .placeholder : []) } else { Text("Pending") .lineLimit(dynamicTypeSize.isAccessibilitySize ? 2 : 1) - .font(.caption2) - .fontWidth(.condensed) + .redacted(reason: isRedacted ? .placeholder : []) } } + } .foregroundStyle(.secondary) - .font(.subheadline) - .padding(.trailing, 30.0) - .redacted(reason: isRedacted ? .placeholder : []) - - Spacer() + .font(.callout) - let delta = txDetails.balanceDelta - let prefix = (delta >= 0 ? "+ " : "- ").appending("\(format.displayPrefix) ") - let amount = format.formatted(UInt64(abs(delta)), fiatPrice: fiatPrice) - let suffix = format.displayText - - Text("\(prefix)\(amount) \(suffix)") - .font(.subheadline) - .fontWeight(.semibold) - .fontDesign(.rounded) - .lineLimit(1) - .redacted(reason: isRedacted ? .placeholder : []) + HStack { + Text(txDetails.txid.description) + .truncationMode(.middle) + .lineLimit(1) + .fontDesign(.monospaced) + .font(.callout) + .foregroundStyle(.primary) + Spacer(minLength: 80) + } + .redacted(reason: isRedacted ? .placeholder : []) } - .padding(.vertical, 15.0) - .padding(.vertical, 5.0) + .padding(.vertical) .minimumScaleFactor(0.5) }