2021-12-06 00:26:14 +00:00
|
|
|
@using System.Drawing
|
2021-12-08 01:12:20 +00:00
|
|
|
@using Fluxor
|
|
|
|
@using Start.Client.Store.State
|
2021-12-11 21:56:35 +00:00
|
|
|
@using Start.Client.Store.Features.DeleteGroup
|
2021-12-14 00:27:13 +00:00
|
|
|
@using Start.Client.Store.Features.CreateBookmark
|
2021-12-08 01:12:20 +00:00
|
|
|
|
|
|
|
@inherits Fluxor.Blazor.Web.Components.FluxorComponent
|
|
|
|
|
|
|
|
@inject IState<RootState> state
|
|
|
|
@inject IDispatcher dispatch
|
2021-12-06 00:26:14 +00:00
|
|
|
|
|
|
|
<div class="card bookmarkGroup">
|
2021-12-05 23:50:48 +00:00
|
|
|
<div class="card-header" style="background-color: @this.Group.Color">
|
2021-12-08 01:12:20 +00:00
|
|
|
<h2 class="card-title h6 d-inline-block @this.ForegroundTitleColorClass">
|
2021-12-06 00:26:14 +00:00
|
|
|
@this.Group.Title
|
|
|
|
</h2>
|
2021-12-11 21:56:35 +00:00
|
|
|
|
|
|
|
@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>
|
|
|
|
}
|
2021-12-05 23:50:48 +00:00
|
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
|
|
<ul class="bookmarks">
|
|
|
|
@if (this.Group.Bookmarks == null || !this.Group.Bookmarks.Any())
|
|
|
|
{
|
|
|
|
<li class="noBookmarksItem">
|
|
|
|
<div class="empty">
|
|
|
|
<div class="empty-icon">
|
|
|
|
<i class="icon icon-bookmark"></i>
|
|
|
|
</div>
|
2021-12-08 01:34:47 +00:00
|
|
|
<p class="empty-title h6">No Bookmarks</p>
|
2021-12-05 23:50:48 +00:00
|
|
|
<div class="empty-action">
|
2021-12-14 00:27:13 +00:00
|
|
|
<button type="button" class="btn btn-primary" @onclick="this.OnCreateBookmarkClicked">
|
2021-12-05 23:50:48 +00:00
|
|
|
<i class="icon icon-plus"></i> Create Bookmark
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
foreach (BookmarkDto bookmark in this.Group.Bookmarks)
|
|
|
|
{
|
|
|
|
<Bookmark Model="bookmark" />
|
|
|
|
}
|
2021-12-08 01:12:20 +00:00
|
|
|
|
|
|
|
@if (this.state.Value.EditMode)
|
|
|
|
{
|
|
|
|
<li class="addBookmarkItem">
|
2021-12-14 06:04:07 +00:00
|
|
|
<button type="button" class="addBookmarkButton btn" @onclick="this.OnCreateBookmarkClicked">
|
2021-12-08 01:12:20 +00:00
|
|
|
<i class="icon icon-plus"></i>
|
|
|
|
Create Bookmark
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
}
|
2021-12-05 23:50:48 +00:00
|
|
|
}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-11-21 06:47:10 +00:00
|
|
|
|
|
|
|
@code
|
|
|
|
{
|
|
|
|
[Parameter]
|
2021-12-05 23:50:48 +00:00
|
|
|
public BookmarkGroupDto Group { get; set; } = null!;
|
|
|
|
|
2021-12-08 01:12:20 +00:00
|
|
|
protected string ForegroundTitleColorClass
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
2021-12-06 00:26:14 +00:00
|
|
|
const int threshold = 105;
|
|
|
|
Color bgColor = ColorTranslator.FromHtml(this.Group.Color);
|
|
|
|
|
|
|
|
double val = Math.Floor((bgColor.R * .299) + (bgColor.G * 0.587) + (bgColor.B * 0.114));
|
|
|
|
|
|
|
|
if ((255 - val) < threshold)
|
|
|
|
return "text-dark";
|
|
|
|
return "text-light";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-11 21:56:35 +00:00
|
|
|
protected void OnDeleteGroupClicked()
|
|
|
|
{
|
|
|
|
dispatch.Dispatch(new ShowDeleteGroupFormAction(
|
|
|
|
this.Group.BookmarkGroupId, this.Group.Title));
|
|
|
|
}
|
|
|
|
|
2021-12-05 23:50:48 +00:00
|
|
|
protected void OnCreateBookmarkClicked()
|
|
|
|
{
|
2021-12-14 00:27:13 +00:00
|
|
|
dispatch.Dispatch(new ShowCreateBookmarkFormAction(this.Group.BookmarkGroupId,
|
|
|
|
this.Group.Title));
|
2021-12-05 23:50:48 +00:00
|
|
|
}
|
2021-11-21 06:47:10 +00:00
|
|
|
}
|