mirror of
https://github.com/status-im/nft-faucet.git
synced 2025-02-22 19:48:25 +00:00
Add IsDeprecated to Wallet and Uploader
This commit is contained in:
parent
592ffa5bcb
commit
3f97a9cfdf
@ -7,4 +7,5 @@ public interface INamedEntity
|
||||
public string ShortName { get; }
|
||||
public string ImageName { get; }
|
||||
public bool IsSupported { get; }
|
||||
public bool IsDeprecated { get; }
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ public interface INetwork : INamedEntity, IEntityWithOrder
|
||||
public ulong? ChainId { get; }
|
||||
public string Currency { get; }
|
||||
public bool IsTestnet { get; }
|
||||
public bool IsDeprecated { get; }
|
||||
public NetworkType Type { get; }
|
||||
public NetworkSubtype SubType { get; }
|
||||
public Uri PublicRpcUrl { get; }
|
||||
|
@ -10,6 +10,7 @@ public abstract class DefaultEntity : INamedEntity, IEntityWithOrder, IStateful,
|
||||
public abstract string ShortName { get; }
|
||||
public abstract string ImageName { get; }
|
||||
public virtual bool IsSupported { get; } = true;
|
||||
public virtual bool IsDeprecated { get; } = false;
|
||||
|
||||
public virtual int? Order { get; } = null;
|
||||
|
||||
|
@ -9,7 +9,6 @@ public abstract class Network : DefaultEntity, INetwork
|
||||
public virtual ulong? ChainId { get; } = null;
|
||||
public virtual string Currency { get; } = null;
|
||||
public virtual bool IsTestnet { get; } = true;
|
||||
public virtual bool IsDeprecated { get; } = false;
|
||||
public abstract NetworkType Type { get; }
|
||||
public abstract NetworkSubtype SubType { get; }
|
||||
public abstract Uri PublicRpcUrl { get; }
|
||||
|
@ -38,25 +38,24 @@ public partial class CreateUploadDialog : BasicComponent
|
||||
RefreshMediator.NotifyStateHasChangedSafe();
|
||||
}
|
||||
|
||||
private CardListItem MapCardListItem(IUploader uploader)
|
||||
private CardListItem MapCardListItem(IUploader model)
|
||||
{
|
||||
var configurationItems = uploader.GetConfigurationItems();
|
||||
var configurationItems = model.GetConfigurationItems();
|
||||
return new CardListItem
|
||||
{
|
||||
Id = uploader.Id,
|
||||
ImageLocation = uploader.ImageName != null ? "./images/" + uploader.ImageName : null,
|
||||
Header = uploader.Name,
|
||||
Properties = uploader.GetProperties().Select(Map).ToArray(),
|
||||
IsDisabled = !uploader.IsSupported,
|
||||
SelectionIcon = uploader.IsConfigured ? CardListItemSelectionIcon.Checkmark : CardListItemSelectionIcon.Warning,
|
||||
Id = model.Id,
|
||||
ImageLocation = model.ImageName != null ? "./images/" + model.ImageName : null,
|
||||
Header = model.Name,
|
||||
Properties = model.GetProperties().Select(Map).ToArray(),
|
||||
IsDisabled = !model.IsSupported,
|
||||
SelectionIcon = model.IsConfigured ? CardListItemSelectionIcon.Checkmark : CardListItemSelectionIcon.Warning,
|
||||
Badges = new[]
|
||||
{
|
||||
(Settings?.RecommendedUploaders?.Contains(uploader.Id) ?? false)
|
||||
(Settings?.RecommendedUploaders?.Contains(model.Id) ?? false)
|
||||
? new CardListItemBadge {Style = BadgeStyle.Success, Text = "Recommended"}
|
||||
: null,
|
||||
!uploader.IsSupported
|
||||
? new CardListItemBadge {Style = BadgeStyle.Light, Text = "Not Supported"}
|
||||
: null,
|
||||
!model.IsSupported ? new CardListItemBadge { Style = BadgeStyle.Light, Text = "Not Supported" } : null,
|
||||
model.IsDeprecated ? new CardListItemBadge { Style = BadgeStyle.Warning, Text = "Deprecated" } : null,
|
||||
}.Where(x => x != null).ToArray(),
|
||||
Buttons = configurationItems != null && configurationItems.Any()
|
||||
? new[]
|
||||
@ -67,11 +66,11 @@ public partial class CreateUploadDialog : BasicComponent
|
||||
Style = ButtonStyle.Secondary,
|
||||
Action = async () =>
|
||||
{
|
||||
var result = await OpenConfigurationDialog(uploader);
|
||||
var result = await OpenConfigurationDialog(model);
|
||||
RefreshCards();
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
await StateRepository.SaveUploaderState(uploader);
|
||||
await StateRepository.SaveUploaderState(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,25 +37,24 @@ public partial class WalletsPage : BasicComponent
|
||||
WalletCards = Wallets.Select(MapCardListItem).ToArray();
|
||||
}
|
||||
|
||||
private CardListItem MapCardListItem(IWallet wallet)
|
||||
private CardListItem MapCardListItem(IWallet model)
|
||||
{
|
||||
var configurationItems = wallet.GetConfigurationItems();
|
||||
var configurationItems = model.GetConfigurationItems();
|
||||
return new CardListItem
|
||||
{
|
||||
Id = wallet.Id,
|
||||
ImageLocation = wallet.ImageName != null ? "./images/" + wallet.ImageName : null,
|
||||
Header = wallet.Name,
|
||||
IsDisabled = !wallet.IsSupported,
|
||||
Properties = wallet.GetProperties().Select(Map).ToArray(),
|
||||
SelectionIcon = wallet.IsConfigured ? CardListItemSelectionIcon.Checkmark : CardListItemSelectionIcon.Warning,
|
||||
Id = model.Id,
|
||||
ImageLocation = model.ImageName != null ? "./images/" + model.ImageName : null,
|
||||
Header = model.Name,
|
||||
IsDisabled = !model.IsSupported,
|
||||
Properties = model.GetProperties().Select(Map).ToArray(),
|
||||
SelectionIcon = model.IsConfigured ? CardListItemSelectionIcon.Checkmark : CardListItemSelectionIcon.Warning,
|
||||
Badges = new[]
|
||||
{
|
||||
(Settings?.RecommendedWallets?.Contains(wallet.Id) ?? false)
|
||||
(Settings?.RecommendedWallets?.Contains(model.Id) ?? false)
|
||||
? new CardListItemBadge {Style = BadgeStyle.Success, Text = "Recommended"}
|
||||
: null,
|
||||
!wallet.IsSupported
|
||||
? new CardListItemBadge {Style = BadgeStyle.Light, Text = "Not Supported"}
|
||||
: null,
|
||||
!model.IsSupported ? new CardListItemBadge { Style = BadgeStyle.Light, Text = "Not Supported" } : null,
|
||||
model.IsDeprecated ? new CardListItemBadge { Style = BadgeStyle.Warning, Text = "Deprecated" } : null,
|
||||
}.Where(x => x != null).ToArray(),
|
||||
Buttons = configurationItems != null && configurationItems.Any()
|
||||
? new[]
|
||||
@ -66,11 +65,11 @@ public partial class WalletsPage : BasicComponent
|
||||
Style = ButtonStyle.Secondary,
|
||||
Action = async () =>
|
||||
{
|
||||
var result = await OpenConfigurationDialog(wallet);
|
||||
var result = await OpenConfigurationDialog(model);
|
||||
RefreshCards();
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
await StateRepository.SaveWalletState(wallet);
|
||||
await StateRepository.SaveWalletState(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user