2025-04-27 07:06:05 +00:00
|
|
|
@inherits MSGComponentBase
|
2026-03-05 17:37:18 +00:00
|
|
|
@if (this.isInitialLoading)
|
|
|
|
|
{
|
|
|
|
|
<MudStack Class="ma-3" Spacing="1">
|
|
|
|
|
<MudSkeleton Width="40%" Height="30px"/>
|
|
|
|
|
@for (var i = 0; i < 10; i++)
|
2024-07-13 08:37:57 +00:00
|
|
|
{
|
2026-03-05 17:37:18 +00:00
|
|
|
<MudSkeleton Width="95%" Height="26px"/>
|
|
|
|
|
}
|
|
|
|
|
</MudStack>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2026-06-04 17:34:52 +00:00
|
|
|
@if (this.SearchVisible)
|
|
|
|
|
{
|
|
|
|
|
<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">
|
|
|
|
|
<MudTextField T="string"
|
|
|
|
|
Text="@this.searchText"
|
|
|
|
|
TextChanged="@this.OnSearchTextChanged"
|
|
|
|
|
Placeholder="@T("Search chats")"
|
|
|
|
|
Variant="Variant.Outlined"
|
|
|
|
|
Margin="Margin.Dense"
|
|
|
|
|
Immediate="@true"
|
|
|
|
|
Adornment="Adornment.Start"
|
|
|
|
|
AdornmentIcon="@Icons.Material.Filled.Search"/>
|
|
|
|
|
<MudTooltip Text="@T("Clear search")" Placement="@WORKSPACE_ITEM_TOOLTIP_PLACEMENT">
|
|
|
|
|
<MudIconButton Icon="@Icons.Material.Filled.Clear" Size="Size.Medium" Color="Color.Inherit" Disabled="@(string.IsNullOrWhiteSpace(this.searchText))" OnClick="@this.ClearSearchAsync"/>
|
|
|
|
|
</MudTooltip>
|
|
|
|
|
</MudStack>
|
|
|
|
|
|
|
|
|
|
<MudStack Row="@true" AlignItems="AlignItems.Center" Wrap="Wrap.NoWrap" Spacing="1">
|
|
|
|
|
<MudSwitch T="bool" Value="@this.includeThreadContents" ValueChanged="@this.IncludeThreadContentsChanged" Color="Color.Primary">
|
|
|
|
|
@T("Search chat contents")
|
|
|
|
|
</MudSwitch>
|
|
|
|
|
@if (this.isSearchRunning)
|
|
|
|
|
{
|
|
|
|
|
<MudProgressCircular Size="Size.Small" Indeterminate="@true"/>
|
|
|
|
|
}
|
|
|
|
|
</MudStack>
|
|
|
|
|
</MudStack>
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-05 17:37:18 +00:00
|
|
|
<MudTreeView T="ITreeItem" Items="@this.treeItems" SelectionMode="SelectionMode.SingleSelection" Hover="@true" ExpandOnClick="@true" Class="ma-3">
|
|
|
|
|
<ItemTemplate Context="item">
|
|
|
|
|
@switch (item.Value)
|
|
|
|
|
{
|
|
|
|
|
case TreeDivider:
|
|
|
|
|
<li style="min-height: 1em;">
|
|
|
|
|
<MudDivider Style="margin-top: 1em; width: 90%; border-width: 3pt;"/>
|
|
|
|
|
</li>
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TreeItemData treeItem:
|
|
|
|
|
@if (treeItem.Type is TreeItemType.LOADING)
|
|
|
|
|
{
|
2026-05-24 11:50:42 +00:00
|
|
|
<MudTreeViewItem T="ITreeItem" Icon="@this.GetTreeItemIcon(treeItem)" Value="@item.Value" Expanded="@item.Expanded" CanExpand="@false" Items="@(treeItem.Children!)">
|
2026-03-05 17:37:18 +00:00
|
|
|
<BodyContent>
|
|
|
|
|
<MudSkeleton Width="85%" Height="22px"/>
|
|
|
|
|
</BodyContent>
|
|
|
|
|
</MudTreeViewItem>
|
|
|
|
|
}
|
|
|
|
|
else if (treeItem.Type is TreeItemType.CHAT)
|
|
|
|
|
{
|
2026-05-24 11:50:42 +00:00
|
|
|
<MudTreeViewItem T="ITreeItem" Icon="@this.GetTreeItemIcon(treeItem)" Value="@item.Value" Expanded="@item.Expanded" CanExpand="@treeItem.Expandable" Items="@(treeItem.Children!)" OnClick="@(() => this.LoadChatAsync(treeItem.Path, true))">
|
2026-03-05 17:37:18 +00:00
|
|
|
<BodyContent>
|
|
|
|
|
<div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%">
|
|
|
|
|
<MudText Style="justify-self: start;">
|
|
|
|
|
@if (string.IsNullOrWhiteSpace(treeItem.Text))
|
|
|
|
|
{
|
|
|
|
|
@T("Empty chat")
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@treeItem.ShortenedText
|
|
|
|
|
}
|
|
|
|
|
</MudText>
|
|
|
|
|
<div style="justify-self: end;">
|
|
|
|
|
|
|
|
|
|
<MudTooltip Text="@T("Move to workspace")" Placement="@WORKSPACE_ITEM_TOOLTIP_PLACEMENT">
|
2026-05-24 11:50:42 +00:00
|
|
|
<MudIconButton Icon="@Icons.Material.Filled.MoveToInbox" Size="Size.Medium" Color="Color.Inherit" Disabled="@this.IsChatTreeItemBusy(treeItem)" OnClick="@(() => this.MoveChatAsync(treeItem.Path))"/>
|
2026-03-05 17:37:18 +00:00
|
|
|
</MudTooltip>
|
|
|
|
|
|
|
|
|
|
<MudTooltip Text="@T("Rename")" Placement="@WORKSPACE_ITEM_TOOLTIP_PLACEMENT">
|
2026-05-24 11:50:42 +00:00
|
|
|
<MudIconButton Icon="@Icons.Material.Filled.Edit" Size="Size.Medium" Color="Color.Inherit" Disabled="@this.IsChatTreeItemBusy(treeItem)" OnClick="@(() => this.RenameChatAsync(treeItem.Path))"/>
|
2026-03-05 17:37:18 +00:00
|
|
|
</MudTooltip>
|
2024-07-13 08:37:57 +00:00
|
|
|
|
2026-03-05 17:37:18 +00:00
|
|
|
<MudTooltip Text="@T("Delete")" Placement="@WORKSPACE_ITEM_TOOLTIP_PLACEMENT">
|
2026-05-24 11:50:42 +00:00
|
|
|
<MudIconButton Icon="@Icons.Material.Filled.Delete" Size="Size.Medium" Color="Color.Error" Disabled="@this.IsChatTreeItemBusy(treeItem)" OnClick="@(() => this.DeleteChatAsync(treeItem.Path))"/>
|
2026-03-05 17:37:18 +00:00
|
|
|
</MudTooltip>
|
|
|
|
|
</div>
|
2024-07-13 08:37:57 +00:00
|
|
|
</div>
|
2026-03-05 17:37:18 +00:00
|
|
|
</BodyContent>
|
|
|
|
|
</MudTreeViewItem>
|
|
|
|
|
}
|
|
|
|
|
else if (treeItem.Type is TreeItemType.WORKSPACE)
|
|
|
|
|
{
|
2026-05-24 11:50:42 +00:00
|
|
|
<MudTreeViewItem T="ITreeItem" Icon="@this.GetTreeItemIcon(treeItem)" Value="@item.Value" Expanded="@item.Expanded" CanExpand="@treeItem.Expandable" Items="@(treeItem.Children!)" OnClick="@(() => this.OnWorkspaceClicked(treeItem))">
|
2026-03-05 17:37:18 +00:00
|
|
|
<BodyContent>
|
|
|
|
|
<div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%">
|
|
|
|
|
<MudText Style="justify-self: start;">
|
|
|
|
|
@treeItem.Text
|
|
|
|
|
</MudText>
|
2026-06-04 17:34:52 +00:00
|
|
|
@if (!this.HasSearchQuery)
|
|
|
|
|
{
|
|
|
|
|
<div style="justify-self: end;">
|
|
|
|
|
<MudTooltip Text="@this.GetAddChatToWorkspaceTooltip(treeItem.Text)" Placement="@WORKSPACE_ITEM_TOOLTIP_PLACEMENT">
|
|
|
|
|
<MudIconButton Icon="@Icons.Material.Filled.AddComment" Size="Size.Medium" Color="Color.Inherit" OnClick="@(() => this.AddChatAsync(treeItem.Path))"/>
|
|
|
|
|
</MudTooltip>
|
2026-05-31 20:22:33 +00:00
|
|
|
|
2026-06-04 17:34:52 +00:00
|
|
|
<MudTooltip Text="@T("Rename")" Placement="@WORKSPACE_ITEM_TOOLTIP_PLACEMENT">
|
|
|
|
|
<MudIconButton Icon="@Icons.Material.Filled.Edit" Size="Size.Medium" Color="Color.Inherit" OnClick="@(() => this.RenameWorkspaceAsync(treeItem.Path))"/>
|
|
|
|
|
</MudTooltip>
|
2024-07-13 08:37:57 +00:00
|
|
|
|
2026-06-04 17:34:52 +00:00
|
|
|
<MudTooltip Text="@T("Delete")" Placement="@WORKSPACE_ITEM_TOOLTIP_PLACEMENT">
|
|
|
|
|
<MudIconButton Icon="@Icons.Material.Filled.Delete" Size="Size.Medium" Color="Color.Error" OnClick="@(() => this.DeleteWorkspaceAsync(treeItem.Path))"/>
|
|
|
|
|
</MudTooltip>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
2024-07-13 08:37:57 +00:00
|
|
|
</div>
|
2026-03-05 17:37:18 +00:00
|
|
|
</BodyContent>
|
|
|
|
|
</MudTreeViewItem>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2026-05-24 11:50:42 +00:00
|
|
|
<MudTreeViewItem T="ITreeItem" Icon="@this.GetTreeItemIcon(treeItem)" Value="@item.Value" Expanded="@item.Expanded" CanExpand="@treeItem.Expandable" Items="@(treeItem.Children!)">
|
2026-03-05 17:37:18 +00:00
|
|
|
<BodyContent>
|
|
|
|
|
<div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%">
|
|
|
|
|
<MudText Style="justify-self: start;">
|
|
|
|
|
@treeItem.Text
|
|
|
|
|
</MudText>
|
|
|
|
|
</div>
|
|
|
|
|
</BodyContent>
|
|
|
|
|
</MudTreeViewItem>
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TreeButton treeButton:
|
|
|
|
|
<li>
|
|
|
|
|
<div class="mud-treeview-item-content" style="background-color: unset;">
|
|
|
|
|
<div class="mud-treeview-item-arrow"></div>
|
|
|
|
|
<MudButton StartIcon="@treeButton.Icon" Variant="Variant.Filled" OnClick="@treeButton.Action">
|
|
|
|
|
@treeButton.Text
|
|
|
|
|
</MudButton>
|
|
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
</ItemTemplate>
|
|
|
|
|
</MudTreeView>
|
|
|
|
|
}
|