feat(ui): left-panel alert stack — licence indicator pinned on top, events LIFO below

Creator design (2026-11-05). A stack of red rows at the top of the left panel, above both mode grids
so it shows while editing and while live, pushing the panel's content down.

- Row 1 is the **Steam licence indicator** and nothing displaces it. It reads as status, not a
  warning: "Entitlement 30 fps · Maximum 60 fps", both numbers derived from QualityOptions and
  HasProOutput. While higher tiers are unavailable it shows a **pin** (standing indicator, no close
  control); once ownership is verified the pin becomes a **close control** and the dismissal is
  persisted (`Steam.LicenceIndicatorDismissed`), permanent while ownership holds. Losing ownership
  restores it as pinned — a change of state, not a preference. Click → About.
- **Event rows stack beneath, newest first**, one row per episode (an episode advancing its state
  updates its own row rather than adding another). Each is dismissible. Click → the Logs tab opens
  with that event's sequence range painted red (`HighlightedLogFrom/To` + `LogInRangeConverter`; two
  numbers rather than a collection because the log list is virtualised and realised rows do not
  re-evaluate on membership changes).
- Replaces the old red panel under the quality picker, which is removed.
- The Steam diagnostic text loses "Contact the creator or support" for a neutral
  "Steam licensing is not configured in this build."

Tests: `AttentionAlertStackTests` — pinned first with the status text; owned → closable and the close
survives a reload but ownership loss restores it pinned; pinned cannot be dismissed; event rows LIFO
with in-place episode updates; clicking an event opens Logs and sets its range. AboutHub + Entitlement
tests updated for the removed panel and the new wording. FAST gate: 532 passed, 0 failed, 0 warnings.
This commit is contained in:
2026-11-05 11:41:59 -08:00
parent adf9883ae9
commit a80108dd96
15 changed files with 501 additions and 49 deletions
+138
View File
@@ -0,0 +1,138 @@
using System.Collections.ObjectModel;
using System.Linq;
using ytLive.Helpers;
using ytLive.Models;
namespace ytLive.ViewModels;
/// <summary>
/// The left panel's alert stack (creator design, 2026-11-05): standing state on top, transient events
/// beneath it, newest first, pushing the panel's content down. Only red rows belong here — the panel
/// is where "something needs you" lives, so it never fills with chatter.
/// <para><b>Row 1 is the Steam licence indicator</b> and nothing displaces it. It is pinned while
/// higher output tiers are unavailable, and becomes dismissible — permanently — once ownership is
/// verified. If ownership is later lost, it comes back as a pinned indicator, because that is a change
/// of state rather than a preference.</para>
/// </summary>
public partial class MainViewModel
{
private const string SteamLicenceAlertId = "steam-licence";
private readonly ObservableCollection<AttentionAlert> _attentionAlerts = new();
private bool _steamLicenceDismissed;
public ObservableCollection<AttentionAlert> AttentionAlerts => _attentionAlerts;
public bool HasAttentionAlerts => _attentionAlerts.Count > 0;
public RelayCommand<AttentionAlert> DismissAlertCommand => new(DismissAlert);
public RelayCommand<AttentionAlert> ActivateAlertCommand => new(ActivateAlert);
/// <summary>The licence indicator's text: what this build is entitled to, and the maximum.
/// A status readout — deliberately not a description of what is missing (creator ruling: the
/// resolution picker explains that).</summary>
private string SteamLicenceText()
{
if (QualityOptions.Length == 0) return "Entitlement 30 fps · Maximum 60 fps";
var max = QualityOptions.Max(option => option.Fps);
var entitled = QualityOptions
.Where(option => HasProOutput || !option.RequiresPro)
.Select(option => option.Fps)
.DefaultIfEmpty(max)
.Max();
return $"Entitlement {entitled} fps · Maximum {max} fps";
}
/// <summary>Recomputes row 1 in place. Called at startup and whenever ownership changes.</summary>
private void RefreshSteamLicenceAlert()
{
var existing = _attentionAlerts.FirstOrDefault(alert => alert.Id == SteamLicenceAlertId);
var hidden = IsAppOwned && _steamLicenceDismissed;
if (hidden)
{
if (existing != null) _attentionAlerts.Remove(existing);
RaiseAttentionChanged();
return;
}
var alert = new AttentionAlert(
SteamLicenceAlertId,
"STEAM LICENCE",
SteamLicenceText(),
IsPinned: !IsAppOwned,
AttentionAlertAction.About);
var index = existing == null ? -1 : _attentionAlerts.IndexOf(existing);
if (index < 0) _attentionAlerts.Insert(0, alert);
else _attentionAlerts[index] = alert; // same row, updated state
RaiseAttentionChanged();
}
/// <summary>Pushes an event alert. Newest sits directly under the licence indicator; older ones
/// stack beneath, so the newest is the one nearest the eye.</summary>
private AttentionAlert? PushAttentionAlert(string id, string label, string text, long logFrom, long logTo)
{
var alert = new AttentionAlert(id, label, text, IsPinned: false, AttentionAlertAction.Logs, logFrom, logTo);
var insertAt = _attentionAlerts.Count(alert => alert.Id == SteamLicenceAlertId);
var existing = _attentionAlerts.FirstOrDefault(candidate => candidate.Id == id);
if (existing != null)
{
// Same event advancing (reconnecting attempt 2 → 3): update the row, never duplicate it.
_attentionAlerts[_attentionAlerts.IndexOf(existing)] = alert;
}
else
{
_attentionAlerts.Insert(insertAt, alert);
}
RaiseAttentionChanged();
return alert;
}
/// <summary>Test seam: pushes an event row without a stream session behind it.</summary>
internal AttentionAlert? PushAttentionAlertForTest(string id, string label, string text, long logFrom, long logTo)
=> PushAttentionAlert(id, label, text, logFrom, logTo);
private void RemoveAttentionAlert(string id)
{
var existing = _attentionAlerts.FirstOrDefault(alert => alert.Id == id);
if (existing == null) return;
_attentionAlerts.Remove(existing);
RaiseAttentionChanged();
}
private void DismissAlert(AttentionAlert? alert)
{
if (alert == null || alert.IsPinned) return;
if (alert.Id == SteamLicenceAlertId)
{
// Permanent for this profile: the creator said "I have seen it". Only honoured while
// ownership holds — RefreshSteamLicenceAlert ignores it when Steam stops confirming.
_steamLicenceDismissed = true;
_layoutStore.SaveSteamLicenceIndicatorDismissed(true);
}
RemoveAttentionAlert(alert.Id);
}
private void ActivateAlert(AttentionAlert? alert)
{
if (alert == null) return;
if (alert.Action == AttentionAlertAction.About)
{
ShowAbout();
return;
}
// Event alert: open the log and paint this event's lines, so the alert is an entry point to
// the detail rather than a dead end.
HighlightLogRange(alert.LogFrom, alert.LogTo);
SelectLogsTab(true);
}
private void RaiseAttentionChanged() => OnPropertyChanged(nameof(HasAttentionAlerts));
}
+13
View File
@@ -16,6 +16,19 @@ public partial class MainViewModel
public ObservableCollection<AppLogEntry> CurrentLaunchLogEntries => _currentLaunchLogEntries;
public ObservableCollection<AppLogEntry> PinnedLogEntries => _pinnedLogEntries;
// The event range a clicked alert points at. A range rather than a collection: the log list is
// virtualised, and a membership change would not re-evaluate realised rows — two numbers do.
private long _highlightedLogFrom;
private long _highlightedLogTo;
public long HighlightedLogFrom => _highlightedLogFrom;
public long HighlightedLogTo => _highlightedLogTo;
private void HighlightLogRange(long from, long to)
{
SetProperty(ref _highlightedLogFrom, from, nameof(HighlightedLogFrom));
SetProperty(ref _highlightedLogTo, to, nameof(HighlightedLogTo));
}
public bool HasPinnedLogEntries => _pinnedLogEntries.Count > 0;
public RelayCommand<AppLogEntry> AcknowledgeLogEntryCommand => new(AcknowledgeLogEntry);
@@ -25,6 +25,7 @@ public partial class MainViewModel
EntitlementErrorMessage = _entitlement.ErrorMessage;
if (!changed) return;
OnPropertyChanged(nameof(HasProOutput));
RefreshSteamLicenceAlert();
if (!HasProOutput && _selectedQuality is { RequiresPro: true } && CanChangeQuality)
SelectedQuality = QualityOptions.Single(option => option.Display == OutputProfile.FreeFallbackName);
}
@@ -77,6 +78,7 @@ public partial class MainViewModel
if (!DevBuild.IsDevelopment) return;
if (!SetProperty(ref _developerMode, value)) return;
OnPropertyChanged(nameof(HasProOutput));
RefreshSteamLicenceAlert();
}
}
}
+2
View File
@@ -350,6 +350,8 @@ public partial class MainViewModel : ViewModelBase
AudioSyncOffsetMs = _layoutStore.LoadAudioSyncOffsetMs();
_zoomFollowsBox = _layoutStore.LoadZoomFollowBox();
_autoChromaScreen = _layoutStore.LoadAutoChromaScreen();
_steamLicenceDismissed = _layoutStore.LoadSteamLicenceIndicatorDismissed();
RefreshSteamLicenceAlert();
MonoOutput = _layoutStore.LoadMonoOutput(); // applied to the mixer by the setter
_musicPlayer.UserGain = (float)Helpers.GainDb.FromDb(TraxDefaultDb); // background by default
InitScoreboard();