Add deleting bookmark groups

This commit is contained in:
Neil Brommer 2021-12-11 13:56:35 -08:00
parent 1b8460fd3e
commit 64b893b778
12 changed files with 235 additions and 6 deletions

View file

@ -1,6 +1,7 @@
@using System.Drawing
@using Fluxor
@using Start.Client.Store.State
@using Start.Client.Store.Features.DeleteGroup
@inherits Fluxor.Blazor.Web.Components.FluxorComponent
@ -12,6 +13,14 @@
<h2 class="card-title h6 d-inline-block @this.ForegroundTitleColorClass">
@this.Group.Title
</h2>
@if (this.state.Value.EditMode)
{
<button class="btn btn-error tooltip tooltip-left float-right"
data-tooltip="Delete Group" @onclick="this.OnDeleteGroupClicked">
<i class="icon icon-delete"></i>
</button>
}
</div>
<div class="card-body">
<ul class="bookmarks">
@ -72,6 +81,12 @@
}
}
protected void OnDeleteGroupClicked()
{
dispatch.Dispatch(new ShowDeleteGroupFormAction(
this.Group.BookmarkGroupId, this.Group.Title));
}
protected void OnCreateBookmarkClicked()
{
// Placeholder

View file

@ -0,0 +1,46 @@
@using Start.Client.Store.Features.DeleteGroup
@using Fluxor
@inherits Fluxor.Blazor.Web.Components.FluxorComponent
@inject IDispatcher dispatch
@inject IState<DeleteGroupState> state
@{ string title = $"Delete Group \"{this.state.Value.BookmarkGroupTitleToDelete}\""; }
<Dialog Title="@title" Active="this.state.Value.ShowDeleteGroupForm" OnClose="this.OnDialogClose">
@if (this.state.Value.DeleteGroupErrorMessage != null)
{
<Alert Type="Alert.AlertType.Error">
@this.state.Value.DeleteGroupErrorMessage
</Alert>
}
<p>
Are you sure you want to delete the bookmark container
"@this.state.Value.BookmarkGroupTitleToDelete"?
</p>
<div class="text-right">
@if (!this.state.Value.IsLoadingDeleteGroup)
{
<button type="button" class="btn" @onclick="this.OnDialogClose">Cancel</button>
<button type="submit" class="btn btn-error" @onclick="this.OnConfirmDelete">Delete</button>
}
else
{
<button type="button" disabled class="btn" @onclick="this.OnDialogClose">Cancel</button>
<button type="submit" disabled class="btn btn-error loading" @onclick="this.OnConfirmDelete">Delete</button>
}
</div>
</Dialog>
@code {
public void OnDialogClose() {
this.dispatch.Dispatch(new HideDeleteGroupFormAction());
}
public void OnConfirmDelete() {
this.dispatch.Dispatch(new SubmitDeleteGroupFormAction(
this.state.Value.BookmarkGroupIdToDelete));
}
}