diff --git a/NftFaucet/Pages/ConnectMetamask.razor b/NftFaucet/Pages/ConnectMetamask.razor
index aef4939..ffbcb6f 100644
--- a/NftFaucet/Pages/ConnectMetamask.razor
+++ b/NftFaucet/Pages/ConnectMetamask.razor
@@ -2,6 +2,18 @@
@layout EmptyLayout
@inherits ConnectMetamaskComponent
-
You should connect MetaMask first!
-
-
+
+
+
+
+
+
+
+ @TitleText
+
+
+
+
+
+
+
diff --git a/NftFaucet/Pages/ConnectMetamask.razor.cs b/NftFaucet/Pages/ConnectMetamask.razor.cs
index 53faff4..43367c9 100644
--- a/NftFaucet/Pages/ConnectMetamask.razor.cs
+++ b/NftFaucet/Pages/ConnectMetamask.razor.cs
@@ -1,3 +1,5 @@
+using Microsoft.AspNetCore.Components;
+using Microsoft.JSInterop;
using NftFaucet.Components;
using NftFaucet.Extensions;
@@ -5,6 +7,13 @@ namespace NftFaucet.Pages;
public class ConnectMetamaskComponent : BasicComponent
{
+ [Inject]
+ protected IJSRuntime JsRuntime { get; set; }
+
+ protected bool HasMetaMask { get; set; }
+ protected string TitleText => $"You should {(HasMetaMask ? "connect" : "install")} MetaMask first";
+ protected string ButtonText => HasMetaMask ? "Connect" : "Install";
+
protected override async Task OnInitializedAsync()
{
if (await Metamask.IsConnected())
@@ -12,10 +21,19 @@ public class ConnectMetamaskComponent : BasicComponent
await Metamask.RefreshAddress();
UriHelper.NavigateToRelative("/");
}
+
+ HasMetaMask = Metamask.HasMetaMask ?? false;
}
protected async Task Connect()
{
+ if (!HasMetaMask)
+ {
+ string url = "https://metamask.io/download/";
+ await JsRuntime.InvokeAsync