2026-11-10 18:17:44 +01:00
@inherits MSGComponentBase
<MudText Typo="Typo.h6" Class="mt-6 mb-1">@T("Research")</MudText>
2026-11-15 15:39:34 +01:00
<MudJustifiedText Typo="Typo.body2" Class="mb-3">@TA("Research agents of the lab look into the event, its participants, and the public debate on its topic, one agent for each. The conversation of this step builds on what they find.")</MudJustifiedText>
2026-11-10 18:17:44 +01:00
@if (this.IsNotPublic)
{
@* An event which is not public is never researched, and earlier research no longer counts: *@
2026-11-11 14:20:49 +01:00
<MudAlert Severity="Severity.Info" Variant="Variant.Outlined" Dense="true" Icon="@AppIcons.NOT_PUBLIC" Class="mb-3">
2026-11-15 15:39:34 +01:00
<MudJustifiedText Typo="Typo.body2">@string.Format(Culture, TA("The event is not public. Therefore, the lab does not research it on the web, and none of your details reach a search. If the event is public after all, change this in the step '{0}'."), BflStep.FRAMEWORK.Title)</MudJustifiedText>
2026-11-10 18:17:44 +01:00
</MudAlert>
}
else
{
@* What the research receives, and what it never receives: *@
2026-11-11 14:20:49 +01:00
<MudAlert Severity="Severity.Info" Variant="Variant.Outlined" Dense="true" Icon="@AppIcons.PRIVACY" Class="mb-3">
2026-11-15 15:39:34 +01:00
<MudJustifiedText Typo="Typo.body2">@TA("The research agents receive only the public details about the event. Your other details, your material, your work states, and your conversations stay in your preparation and never reach a search.")</MudJustifiedText>
2026-11-10 18:17:44 +01:00
@if (this.PublicDetails.Count > 0)
{
<MudText Typo="Typo.body2" Class="mt-2">@T("The research receives these details:")</MudText>
<ul class="ml-4">
@foreach (var detail in this.PublicDetails)
{
<li><MudText Typo="Typo.body2">@LabelOf(detail): @detail.Value</MudText></li>
}
</ul>
}
else
{
2026-11-15 15:39:34 +01:00
<MudJustifiedText Typo="Typo.body2" Class="mt-2">@string.Format(Culture, TA("You have not entered any public details yet. Enter them in the step '{0}', such as the topic of the event or its link."), BflStep.FRAMEWORK.Title)</MudJustifiedText>
2026-11-10 18:17:44 +01:00
}
</MudAlert>
@if (this.ProviderIssue is { } providerIssue)
{
2026-11-15 15:39:34 +01:00
<MudAlert Severity="Severity.Warning" Variant="Variant.Outlined" Dense="true" Class="mb-3">
<MudJustifiedText Typo="Typo.body2">@providerIssue</MudJustifiedText>
</MudAlert>
2026-11-10 18:17:44 +01:00
}
else if (this.availability is { CanResearch: false } unavailable)
{
2026-11-15 15:39:34 +01:00
<MudAlert Severity="Severity.Warning" Variant="Variant.Outlined" Dense="true" Class="mb-3">
<MudJustifiedText Typo="Typo.body2">@unavailable.Message</MudJustifiedText>
</MudAlert>
2026-11-10 18:17:44 +01:00
}
<MudButton Variant="@(this.research.Count > 0 ? Variant.Outlined : Variant.Filled)"
Color="Color.Primary"
2026-11-11 14:20:49 +01:00
StartIcon="@AppIcons.WEB_RESEARCH"
2026-11-10 18:17:44 +01:00
OnClick="@this.StartAllAsync"
Disabled="@(!this.CanStart)"
Class="mb-3">
@(this.research.Count > 0 ? T("Research all topics again") : T("Start the research"))
</MudButton>
@* Only one topic is open at a time, so that the step stays clear: *@
<MudExpansionPanels MultiExpansion="@false" Class="mb-3">
@foreach (var topic in BflResearchTopic.All)
{
var found = this.research.GetValueOrDefault(topic);
var isRunning = this.IsRunning(topic);
<MudExpansionPanel @key="topic" Class="border-solid border rounded-lg" Expanded="@(this.expandedTopic == topic)" ExpandedChanged="@(expanded => this.SetExpanded(topic, expanded))">
<TitleContent>
<div class="d-flex align-center">
@if (isRunning)
{
<MudProgressCircular Size="Size.Small" Indeterminate="true" Color="Color.Primary" Class="mr-3"/>
}
else
{
<MudIcon Icon="@this.StatusIcon(found)" Color="@this.StatusColor(found)" Class="mr-3"/>
}
<MudText Typo="Typo.h6">@topic.Title</MudText>
<MudTooltip Text="@topic.Description" Placement="Placement.Top">
2026-11-11 14:20:49 +01:00
<MudIcon Icon="@AppIcons.INFO" Size="Size.Small" Color="Color.Info" Class="ml-2"/>
2026-11-10 18:17:44 +01:00
</MudTooltip>
<MudSpacer/>
<MudText Typo="Typo.caption" Class="mr-2">@this.StatusText(found, isRunning)</MudText>
</div>
</TitleContent>
<ChildContent>
@if (isRunning)
{
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="mb-1"/>
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2" Class="mb-3">
<MudText Typo="Typo.caption">@T("The agent researches this topic")</MudText>
2026-11-11 14:20:49 +01:00
<MudButton Size="Size.Small" StartIcon="@AppIcons.STOP" OnClick="@(() => this.CancelAsync(topic))">@T("Stop")</MudButton>
2026-11-10 18:17:44 +01:00
</MudStack>
}
2026-11-15 15:39:34 +01:00
@* While the agent researches anew, the earlier research would look like its result: *@
@if (!isRunning && found is null)
2026-11-10 18:17:44 +01:00
{
2026-11-15 15:39:34 +01:00
<MudJustifiedText Typo="Typo.body2" Class="mb-3">@topic.Description</MudJustifiedText>
2026-11-10 18:17:44 +01:00
}
2026-11-15 15:39:34 +01:00
else if (!isRunning && found is not null)
2026-11-10 18:17:44 +01:00
{
@if (found.IsOutdated(this.PublicDetails))
{
<MudAlert Severity="Severity.Info" Variant="Variant.Outlined" Dense="true" Class="mb-2">
2026-11-15 15:39:34 +01:00
<MudJustifiedText Typo="Typo.body2">@TA("The public details changed since this research. You can research this topic again.")</MudJustifiedText>
2026-11-10 18:17:44 +01:00
</MudAlert>
}
<div class="border rounded pa-2 mb-3" style="max-height: 400px; overflow-y: auto;">
<MudMarkdown Value="@found.Text" Props="Markdown.DefaultConfig" MarkdownPipeline="Markdown.SAFE_MARKDOWN_PIPELINE"/>
</div>
2026-11-15 15:39:34 +01:00
<BflResearchTrace Research="@found"/>
2026-11-10 18:17:44 +01:00
}
<MudButton Size="Size.Small"
Variant="Variant.Outlined"
2026-11-11 14:20:49 +01:00
StartIcon="@AppIcons.WEB"
2026-11-10 18:17:44 +01:00
OnClick="@(() => this.StartAsync(topic))"
2026-11-15 15:39:34 +01:00
Disabled="@(!this.CanStart || isRunning)">
2026-11-10 18:17:44 +01:00
@(found is null ? T("Research this topic") : T("Research this topic again"))
</MudButton>
</ChildContent>
</MudExpansionPanel>
}
</MudExpansionPanels>
2026-11-15 15:39:34 +01:00
@* While the list of participants is researched anew, the earlier list no longer counts: *@
<BflPersonResearchPanel ProjectId="@this.ProjectId"
List="@(this.IsRunning(BflResearchTopic.PARTICIPANTS) ? null : this.research.GetValueOrDefault(BflResearchTopic.PARTICIPANTS))"
PublicDetails="@this.PublicDetails"
CanStart="@this.CanStart"
Provider="@this.Provider"
ProviderIssue="@this.ProviderIssue"
ResearchStored="@this.ResearchStored"/>
2026-11-10 18:17:44 +01:00
}