diff --git a/NftFaucet.Plugins/Models/Abstraction/INamedEntity.cs b/NftFaucet.Plugins/Models/Abstraction/INamedEntity.cs index e22dc4a..e1b14a6 100644 --- a/NftFaucet.Plugins/Models/Abstraction/INamedEntity.cs +++ b/NftFaucet.Plugins/Models/Abstraction/INamedEntity.cs @@ -7,4 +7,5 @@ public interface INamedEntity public string ShortName { get; } public string ImageName { get; } public bool IsSupported { get; } + public bool IsDeprecated { get; } } diff --git a/NftFaucet.Plugins/Models/Abstraction/INetwork.cs b/NftFaucet.Plugins/Models/Abstraction/INetwork.cs index 2e9d931..75db37d 100644 --- a/NftFaucet.Plugins/Models/Abstraction/INetwork.cs +++ b/NftFaucet.Plugins/Models/Abstraction/INetwork.cs @@ -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; } diff --git a/NftFaucet.Plugins/Models/DefaultEntity.cs b/NftFaucet.Plugins/Models/DefaultEntity.cs index 0a50e51..0e8db2f 100644 --- a/NftFaucet.Plugins/Models/DefaultEntity.cs +++ b/NftFaucet.Plugins/Models/DefaultEntity.cs @@ -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; diff --git a/NftFaucet.Plugins/Models/Network.cs b/NftFaucet.Plugins/Models/Network.cs index 67b35f3..acb231c 100644 --- a/NftFaucet.Plugins/Models/Network.cs +++ b/NftFaucet.Plugins/Models/Network.cs @@ -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; } diff --git a/NftFaucet/Pages/CreateUploadDialog.razor.cs b/NftFaucet/Pages/CreateUploadDialog.razor.cs index 599c282..79d8af5 100644 --- a/NftFaucet/Pages/CreateUploadDialog.razor.cs +++ b/NftFaucet/Pages/CreateUploadDialog.razor.cs @@ -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); } } } diff --git a/NftFaucet/Pages/WalletsPage.razor.cs b/NftFaucet/Pages/WalletsPage.razor.cs index b248090..89c2c93 100644 --- a/NftFaucet/Pages/WalletsPage.razor.cs +++ b/NftFaucet/Pages/WalletsPage.razor.cs @@ -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); } } }