mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-08-15 10:42:12 +00:00
Made the search sticky
This commit is contained in:
parent
4bf895062e
commit
0ecac914f2
@ -11,9 +11,9 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@if (this.isSearchVisible)
|
@if (this.SearchVisible)
|
||||||
{
|
{
|
||||||
<MudStack Class="mx-3 mt-2 mb-1" Spacing="1">
|
<MudStack Class="mx-3 mt-2 mb-1" Spacing="1" Style="position: sticky; top: 0; z-index: 2; background-color: var(--mud-palette-background);">
|
||||||
<MudStack Row="@true" AlignItems="AlignItems.Center" Wrap="Wrap.NoWrap" Spacing="1">
|
<MudStack Row="@true" AlignItems="AlignItems.Center" Wrap="Wrap.NoWrap" Spacing="1">
|
||||||
<MudTextField T="string"
|
<MudTextField T="string"
|
||||||
Text="@this.searchText"
|
Text="@this.searchText"
|
||||||
|
|||||||
@ -32,6 +32,12 @@ public partial class Workspaces : MSGComponentBase
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public bool ExpandRootNodes { get; set; } = true;
|
public bool ExpandRootNodes { get; set; } = true;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public bool SearchVisible { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback<bool> SearchVisibleChanged { get; set; }
|
||||||
|
|
||||||
private const Placement WORKSPACE_ITEM_TOOLTIP_PLACEMENT = Placement.Bottom;
|
private const Placement WORKSPACE_ITEM_TOOLTIP_PLACEMENT = Placement.Bottom;
|
||||||
private readonly SemaphoreSlim treeLoadingSemaphore = new(1, 1);
|
private readonly SemaphoreSlim treeLoadingSemaphore = new(1, 1);
|
||||||
private readonly List<TreeItemData<ITreeItem>> treeItems = [];
|
private readonly List<TreeItemData<ITreeItem>> treeItems = [];
|
||||||
@ -41,7 +47,6 @@ public partial class Workspaces : MSGComponentBase
|
|||||||
private CancellationTokenSource? searchCancellationTokenSource;
|
private CancellationTokenSource? searchCancellationTokenSource;
|
||||||
private bool isInitialLoading = true;
|
private bool isInitialLoading = true;
|
||||||
private bool isDisposed;
|
private bool isDisposed;
|
||||||
private bool isSearchVisible;
|
|
||||||
private bool includeThreadContents;
|
private bool includeThreadContents;
|
||||||
private bool isSearchRunning;
|
private bool isSearchRunning;
|
||||||
private string searchText = string.Empty;
|
private string searchText = string.Empty;
|
||||||
@ -92,7 +97,7 @@ public partial class Workspaces : MSGComponentBase
|
|||||||
await this.StartPrefetchAsync();
|
await this.StartPrefetchAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool HasSearchQuery => this.isSearchVisible && !string.IsNullOrWhiteSpace(this.searchText);
|
private bool HasSearchQuery => this.SearchVisible && !string.IsNullOrWhiteSpace(this.searchText);
|
||||||
|
|
||||||
private void BuildTreeItems(WorkspaceTreeCacheSnapshot snapshot)
|
private void BuildTreeItems(WorkspaceTreeCacheSnapshot snapshot)
|
||||||
{
|
{
|
||||||
@ -410,8 +415,11 @@ public partial class Workspaces : MSGComponentBase
|
|||||||
|
|
||||||
public async Task ToggleSearchAsync()
|
public async Task ToggleSearchAsync()
|
||||||
{
|
{
|
||||||
this.isSearchVisible = !this.isSearchVisible;
|
var searchVisible = !this.SearchVisible;
|
||||||
if (this.isSearchVisible)
|
this.SearchVisible = searchVisible;
|
||||||
|
await this.SearchVisibleChanged.InvokeAsync(searchVisible);
|
||||||
|
|
||||||
|
if (this.SearchVisible)
|
||||||
{
|
{
|
||||||
await this.SafeStateHasChanged();
|
await this.SafeStateHasChanged();
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user