@using DeepDrftPublic.Client.Common @using DeepDrftPublic.Client.Controls.Settings @using DeepDrftPublic.Client.Services @* The public-site Settings menu (Phase 18 wave 18.6, ยง4a). An app-bar trigger opening a MudMenu that renders a settings-item list โ€” NOT a hard-coded control stack. Each entry is a SettingsItem (label + a control fragment bound to a persisted preference), so a future tenant (dark mode) plugs in as a new list entry, not a menu rewire. Today the list holds one item: the streaming-quality toggle. The MudMenu items carry OnClick="@(() => {})" + OnTouch so a click inside a control row does not dismiss the menu (MudMenu auto-closes on item activation otherwise), keeping the radio group usable. *@
Settings
@foreach (var item in _items) {
@item.Label
@item.Control
}
@code { // The active player, cascaded by AudioPlayerProvider. SettingsMenu sits in the app bar inside the // provider, so it receives the cascade here โ€” but the MudMenu PANEL content below is portaled to // (outside the provider), so a cascade cannot reach it. We thread the player into // the setting as an explicit parameter instead: an explicit value captured in the item fragment flows // into portaled content fine, where a [CascadingParameter] would land null. [CascadingParameter] public IStreamingPlayerService? Player { get; set; } // The settings-item list. Built once; adding a preference is appending one SettingsItem with its control // fragment โ€” the menu body above renders whatever is here without knowing what each item is. The item // fragment reads Player at render time (when the menu opens), so it picks up the cascaded instance even // though the list itself is initialized before the cascade is set. private readonly List _items; public SettingsMenu() { _items = [ new SettingsItem("Streaming quality", @) ]; } }