1
0
mirror of synced 2024-12-21 10:55:55 +01:00
TaikoLocalServer/TaikoWebUI/Pages/Dialogs/OTPDialog.razor

36 lines
975 B
Plaintext
Raw Normal View History

@inject HttpClient Client
@inject ISnackbar Snackbar
@inject IJSRuntime Js
<MudDialog>
<DialogContent>
<MudText Typo="Typo.h6">@Otp</MudText>
<div style="height: 1rem"></div>
<MudButton Variant="Variant.Filled" Color="Color.Primary"
OnClick="@(_ => CopyToClipboard(Otp))">
@Localizer["Copy to Clipboard"]
</MudButton>
<div style="height: 1rem"></div>
</DialogContent>
<DialogActions>
<MudButton Color="Color.Primary" OnClick="@Submit">@Localizer["Dialog OK"]</MudButton>
</DialogActions>
</MudDialog>
@code {
[CascadingParameter]
MudDialogInstance MudDialog { get; set; } = null!;
[Parameter]
public string Otp { get; set; } = "";
private async Task CopyToClipboard(string text)
{
await Js.InvokeVoidAsync("clipboardCopy.copyText", text);
}
private void Submit()
{
MudDialog.Close(DialogResult.Ok(true));
}
}