mirror of
https://github.com/lil-org/tokenary.git
synced 2025-01-07 14:10:28 +03:00
Dim accounts that can't be selected
This commit is contained in:
parent
b17d32ec79
commit
3412510b38
@ -612,7 +612,7 @@ extension AccountsListViewController: NSTableViewDataSource {
|
||||
let account = wallet.accounts[0]
|
||||
let specificWalletAccount = SpecificWalletAccount(walletId: wallet.id, account: account)
|
||||
let isSelected = accountSelectionConfiguration?.selectedAccounts.contains(specificWalletAccount) == true
|
||||
rowView.setup(account: account, isSelected: isSelected)
|
||||
rowView.setup(account: account, isSelected: isSelected, isDisabled: !accountCanBeSelected(account))
|
||||
return rowView
|
||||
case let .mnemonicAccount(walletIndex: walletIndex, accountIndex: accountIndex):
|
||||
let wallet = wallets[walletIndex]
|
||||
@ -620,7 +620,7 @@ extension AccountsListViewController: NSTableViewDataSource {
|
||||
let account = wallet.accounts[accountIndex]
|
||||
let specificWalletAccount = SpecificWalletAccount(walletId: wallet.id, account: account)
|
||||
let isSelected = accountSelectionConfiguration?.selectedAccounts.contains(specificWalletAccount) == true
|
||||
rowView.setup(account: account, isSelected: isSelected)
|
||||
rowView.setup(account: account, isSelected: isSelected, isDisabled: !accountCanBeSelected(account))
|
||||
return rowView
|
||||
case .mnemonicWalletHeader:
|
||||
let rowView = tableView.makeViewOfType(AccountsHeaderRowView.self, owner: self)
|
||||
|
@ -20,10 +20,16 @@ class AccountCellView: NSTableRowView {
|
||||
wantsLayer = true
|
||||
}
|
||||
|
||||
func setup(account: Account, isSelected: Bool) {
|
||||
func setup(account: Account, isSelected: Bool, isDisabled: Bool) {
|
||||
addressImageView.image = account.image
|
||||
addressTextField.stringValue = account.croppedAddress
|
||||
setSelected(isSelected)
|
||||
setDisabled(isDisabled)
|
||||
}
|
||||
|
||||
private func setDisabled(_ disabled: Bool) {
|
||||
addressImageView.alphaValue = disabled ? 0.4 : 1
|
||||
addressTextField.alphaValue = disabled ? 0.4 : 1
|
||||
}
|
||||
|
||||
private func setSelected(_ selected: Bool) {
|
||||
|
Loading…
Reference in New Issue
Block a user