Add creating bookmark groups
This commit is contained in:
parent
d997655b59
commit
7841d1d1a8
28 changed files with 692 additions and 114 deletions
|
|
@ -5,7 +5,6 @@
|
|||
@using System.Linq
|
||||
@using Start.Client.Components
|
||||
@using Start.Client.Store.State
|
||||
@using Start.Client.Store.Features.ContainersList
|
||||
@using Start.Client.Store.Features.CurrentContainer
|
||||
@using Start.Client.Store.Features.CreateContainer
|
||||
@using Start.Client.Store.Features.DeleteContainer
|
||||
|
|
@ -52,27 +51,24 @@ else
|
|||
</li>
|
||||
}
|
||||
<li class="tab-item tab-action">
|
||||
<button @onclick="OnCreateContainerClicked" class="btn btn-link"
|
||||
title="Create New Container" aria-label="Create New Container">
|
||||
<button @onclick="OnCreateContainerClicked" class="btn btn-link tooltip tooltip-left"
|
||||
title="Create New Container" aria-label="Create New Container"
|
||||
data-tooltip="Create Container">
|
||||
+
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<BookmarkContainer Container="this.state.Value.CurrentContainerState.Container" />
|
||||
<BookmarkContainer />
|
||||
|
||||
<CreateContainer />
|
||||
<DeleteContainer />
|
||||
|
||||
<CreateGroup />
|
||||
}
|
||||
|
||||
@code
|
||||
{
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
this.dispatch.Dispatch(new LoadContainerListAction());
|
||||
this.dispatch.Dispatch(new LoadCurrentContainerAction(await this.GetSelectedContainerId()));
|
||||
}
|
||||
|
||||
protected void OnContainerSelected(int bookmarkContainerId)
|
||||
{
|
||||
dispatch.Dispatch(new LoadCurrentContainerAction(bookmarkContainerId));
|
||||
|
|
@ -95,26 +91,4 @@ else
|
|||
{
|
||||
dispatch.Dispatch(new ShowCreateContainerFormAction());
|
||||
}
|
||||
|
||||
// Save the currently selected container in LocalStorage so that the same container remains
|
||||
// selected between new tabs
|
||||
|
||||
protected async Task<int> GetSelectedContainerId()
|
||||
{
|
||||
bool hasValue = await localStorage.ContainKeyAsync("SelectedContainer");
|
||||
|
||||
if (hasValue)
|
||||
return await localStorage.GetItemAsync<int>("SelectedContainer");
|
||||
|
||||
// Default to the first container
|
||||
int firstContainer = this.state.Value.ContainerListState.Containers
|
||||
.First().BookmarkContainerId;
|
||||
await this.SetSelectedContainer(firstContainer);
|
||||
return firstContainer;
|
||||
}
|
||||
|
||||
protected async Task SetSelectedContainer(int selectedContainerId)
|
||||
{
|
||||
await localStorage.SetItemAsync<int>("SelectedContainer", selectedContainerId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue