Added the guided chat to the BeyondFacts Lab (#1177)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-09 09:55:01 +01:00
1 parent e77645f44c
commit 79e0c80031
55 files changed
+3481 -72

No files matched your search

@@ -26,14 +26,30 @@ public partial class BeyondFactsLabAssistant : MSGComponentBase
[Inject]
private BeyondFactsLabStore Store { get; init; } = null!;
[Inject]
private BflConversationService ConversationService { get; init; } = null!;
[Inject]
private ILogger<BeyondFactsLabAssistant> Logger { get; init; } = null!;
[Inject]
private IJSRuntime JsRuntime { get; init; } = null!;
/// <summary>
/// Whether the person may open the lab, so that the page did not send them away.
/// </summary>
private bool mayOpen;
/// <summary>
/// The empty element right before the header of the preparation, which marks where the header sits in the flow.
/// </summary>
private ElementReference stickyHeaderAnchor;
/// <summary>
/// Whether the next render shows another step, which then starts at the top.
/// </summary>
private bool scrollToActiveStep;
/// <inheritdoc />
protected override async Task OnInitializedAsync()
{
@@ -53,6 +69,13 @@ public partial class BeyondFactsLabAssistant : MSGComponentBase
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await base.OnAfterRenderAsync(firstRender);
if (this.scrollToActiveStep)
{
// The person scrolled down in one step and chose another one; it starts right under the header:
this.scrollToActiveStep = false;
await this.stickyHeaderAnchor.ScrollToStickyHeaderAsync(this.JsRuntime);
}
if (firstRender && this.mayOpen)
await this.ShowNoticeIfNeededAsync();
}