Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
danvleju-rdx committed Mar 26, 2024
1 parent 9b5ff6f commit 7727c04
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 15 deletions.
12 changes: 10 additions & 2 deletions RadixWallet/Core/FeaturePrelude/AddressView/AddressView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
public struct AddressView: View {
let identifiable: LedgerIdentifiable
let isTappable: Bool
let imageColor: Color?
private let showFull: Bool
private let action: Action

Expand All @@ -16,11 +17,13 @@ public struct AddressView: View {
public init(
_ identifiable: LedgerIdentifiable,
showFull: Bool = false,
isTappable: Bool = true
isTappable: Bool = true,
imageColor: Color? = nil
) {
self.identifiable = identifiable
self.showFull = showFull
self.isTappable = isTappable
self.imageColor = imageColor

switch identifiable {
case .address, .identifier(.nonFungibleGlobalID):
Expand Down Expand Up @@ -89,7 +92,12 @@ extension AddressView {
HStack(spacing: .small3) {
Text(identifiable.formatted(.default))
.lineLimit(1)
image
if let imageColor {
image
.foregroundStyle(imageColor)
} else {
image
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,16 @@ struct AssetResourceDetailsSection: View {
.padding(.horizontal, .large2)

VStack(alignment: .leading, spacing: .medium3) {
KeyValueView(resourceAddress: viewState.resourceAddress)
KeyValueView(
resourceAddress: viewState.resourceAddress,
imageColor: .app.gray2
)

if let validatorAddress = viewState.validatorAddress {
KeyValueView(validatorAddress: validatorAddress)
KeyValueView(
validatorAddress: validatorAddress,
imageColor: .app.gray2
)
}

if let resourceName = viewState.resourceName {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ struct KeyValueView<Content: View>: View {
let key: String
let content: Content

init(resourceAddress: ResourceAddress) where Content == AddressView {
init(resourceAddress: ResourceAddress, imageColor: Color?) where Content == AddressView {
self.init(key: L10n.AssetDetails.resourceAddress) {
AddressView(.address(.resource(resourceAddress)))
AddressView(.address(.resource(resourceAddress)), imageColor: imageColor)
}
}

init(validatorAddress: ValidatorAddress) where Content == AddressView {
init(validatorAddress: ValidatorAddress, imageColor: Color?) where Content == AddressView {
self.init(key: L10n.AssetDetails.validator) {
AddressView(.address(.validator(validatorAddress)))
AddressView(.address(.validator(validatorAddress)), imageColor: imageColor)
}
}

init(nonFungibleGlobalID: NonFungibleGlobalId) where Content == AddressView {
init(nonFungibleGlobalID: NonFungibleGlobalId, imageColor: Color?) where Content == AddressView {
self.init(key: L10n.AssetDetails.NFTDetails.id) {
AddressView(.identifier(.nonFungibleGlobalID(nonFungibleGlobalID)))
AddressView(.identifier(.nonFungibleGlobalID(nonFungibleGlobalID)), imageColor: imageColor)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ extension NonFungibleTokenDetails {
.padding(.horizontal, -.large2)
}

KeyValueView(nonFungibleGlobalID: tokenDetails.nonFungibleGlobalID)
KeyValueView(
nonFungibleGlobalID: tokenDetails.nonFungibleGlobalID,
imageColor: .app.gray2
)

if let stakeClaim = tokenDetails.stakeClaim {
stakeClaimView(stakeClaim) {
Expand Down Expand Up @@ -160,7 +163,7 @@ extension NonFungibleTokenDetails {

case let .address(address):
KeyValueView(key: field.name) {
AddressView(.address(address))
AddressView(.address(address), imageColor: .app.gray2)
}

case let .decimal(value):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,12 @@ extension DappDetails.View {

Spacer(minLength: 0)

AddressView(.address(.account(viewStore.address)))
.foregroundColor(.app.gray1)
.textStyle(.body1HighImportance)
AddressView(
.address(.account(viewStore.address)),
imageColor: .app.gray2
)
.foregroundColor(.app.gray1)
.textStyle(.body1HighImportance)
}

if let domain = viewStore.domain {
Expand Down

0 comments on commit 7727c04

Please sign in to comment.