nft-faucet/NftFaucet/Pages/MintDialog.razor
2022-10-05 21:30:14 -05:00

107 lines
4.3 KiB
Plaintext

@page "/mint/in-progress"
@inherits BasicComponent
<PageTitle>Minting...</PageTitle>
@if (!string.IsNullOrEmpty(ProgressBarText))
{
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">@ProgressBarText</RadzenText>
<RadzenProgressBar Value="100" ShowValue="false" Mode="ProgressBarMode.Indeterminate" />
}
else if (State == MintingState.CheckingNetwork)
{
<RadzenContent Container="main">
<h4>Network mismatch!</h4>
<p>
<text style="font-weight: bold;">Selected network: </text>
<text style="color: green;">@(AppState?.SelectedNetwork?.Name ?? "<unknown>")</text>
</p>
<p>
<text style="font-weight: bold;">Wallet network: </text>
<text style="color: red;">@(WalletNetwork?.Name ?? "<unknown>")</text>
</p>
<div style="display: flex; justify-content: end;">
<RadzenButton Click="@(async (args) => await CheckNetwork())" Text="Try again" Disabled="@(!string.IsNullOrEmpty(ProgressBarText))" />
</div>
</RadzenContent>
} else if (State == MintingState.CheckingAddress)
{
<RadzenContent Container="main">
<h3>Address is not available!</h3>
<p>
<text style="font-weight: bold;">Wallet address: </text>
<text style="color: red;">&lt;null&gt;</text>
</p>
<div style="display: flex; justify-content: end;">
<RadzenButton Click="@(async (args) => await CheckNetwork())" Text="Try again" Disabled="@(!string.IsNullOrEmpty(ProgressBarText))" />
</div>
</RadzenContent>
} else if (State == MintingState.CheckingBalance)
{
<RadzenContent Container="main">
<h3>Not enough balance!</h3>
<p>
<text style="font-weight: bold;">Balance</text>
<text> (@SourceAddress)</text>
<text style="font-weight: bold;">: </text>
<text style="color: red;">
@if (Balance != null)
{
@($"{Balance.Value:n0} {AppState.SelectedNetwork.SmallestCurrency}")
}
else if (!string.IsNullOrEmpty(GetBalanceError))
{
@GetBalanceError
}
else
{
@:&lt;unknown&gt;
}
</text>
</p>
<p>
<text style="font-weight: bold;">Minimum required balance: </text>
<text style="color: green;">
@($"{AppState.SelectedContract.MinBalanceRequired:n0} {AppState.SelectedNetwork.SmallestCurrency}")
</text>
</p>
<div style="display: flex; justify-content: end;">
@if (AppState.SelectedNetwork.SupportsAirdrop)
{
<RadzenButton Click="@(async (args) => await RequestAirdrop())" Text="Request airdrop" Disabled="@(!string.IsNullOrEmpty(ProgressBarText))" Style="margin-right: 1rem;" />
}
<RadzenButton Click="@(async (args) => await CheckNetwork())" Text="Try again" Disabled="@(!string.IsNullOrEmpty(ProgressBarText))"/>
</div>
</RadzenContent>
} else if (State == MintingState.SendingTransaction)
{
<RadzenContent Container="main">
<h3>Failed to send transaction!</h3>
<p>
<text>Error message:</text>
<br/>
<text style="font-weight: bold; color: red;">@SendTransactionError</text>
</p>
<div style="display: flex; justify-content: end;">
<RadzenButton Click="@(async (args) => await CheckNetwork())" Text="Try again" Disabled="@(!string.IsNullOrEmpty(ProgressBarText))" />
</div>
</RadzenContent>
} else if (State == MintingState.Done)
{
<RadzenContent Container="main">
<h3>Success</h3>
<p>
<text style="font-weight: bold;">Token minted!</text>
<br/>
<br/>
<br/>
<text style="font-weight: bold;">Transaction hash: </text>
<br/>
<RadzenLink Icon="open_in_new" Path="@(new Uri(AppState.SelectedNetwork.ExplorerUrl, "tx/" + TransactionHash).ToString())" Text="@TransactionHash" Target="_blank"/>
</p>
<div style="display: flex; justify-content: end;">
<RadzenButton Click="@((args) => Close())" Text="Close" Disabled="@(!string.IsNullOrEmpty(ProgressBarText))" />
</div>
</RadzenContent>
}