62 lines
1.6 KiB
Plaintext
62 lines
1.6 KiB
Plaintext
<MudDialog>
|
|
<DialogContent>
|
|
<EditForm Model="@_dummyModel" OnSubmit="@(_ => Submit())">
|
|
<MudContainer Class="mb-6">
|
|
<MudText>
|
|
Enter Trakt List URL
|
|
</MudText>
|
|
</MudContainer>
|
|
<MudTextField T="string" Label="Trakt List URL"
|
|
Placeholder="https://trakt.tv/users/username/lists/list-name"
|
|
@bind-Text="@_traktListUrl"
|
|
Style="min-width: 400px"
|
|
Class="mb-6 mx-4">
|
|
</MudTextField>
|
|
</EditForm>
|
|
</DialogContent>
|
|
<DialogActions>
|
|
<MudButton OnClick="Cancel" ButtonType="ButtonType.Reset">Cancel</MudButton>
|
|
<MudButton Color="Color.Primary" Variant="Variant.Filled" OnClick="Submit">
|
|
Add
|
|
</MudButton>
|
|
</DialogActions>
|
|
</MudDialog>
|
|
|
|
|
|
@code {
|
|
|
|
[CascadingParameter]
|
|
IMudDialogInstance MudDialog { get; set; }
|
|
|
|
private string _traktListUrl;
|
|
|
|
private record DummyModel;
|
|
|
|
private readonly DummyModel _dummyModel = new();
|
|
|
|
private bool CanSubmit() => !string.IsNullOrWhiteSpace(_traktListUrl);
|
|
|
|
private void Submit()
|
|
{
|
|
if (!CanSubmit())
|
|
{
|
|
return;
|
|
}
|
|
|
|
MudDialog.Close(DialogResult.Ok(_traktListUrl));
|
|
}
|
|
|
|
private void Cancel(MouseEventArgs e)
|
|
{
|
|
// this is gross, but [enter] seems to sometimes trigger cancel instead of submit
|
|
if (e.Detail == 0)
|
|
{
|
|
Submit();
|
|
}
|
|
else
|
|
{
|
|
MudDialog.Cancel();
|
|
}
|
|
}
|
|
|
|
} |