5a23783e07
- Add missing modal CSS (.modal-overlay/.modal-dialog/.modal-header): the "Connect to Microsoft" auth modal was rendering unstyled inline at the bottom of the page. Now a centered dialog with backdrop. - Surface OAuth connect errors in the modal instead of silently reopening it with no explanation. - MainLayout: implement IDisposable so event handlers are actually unsubscribed (Dispose existed but was never invoked). - Wire up the Settings theme selector (was a dead control): drop the unsupported Dark option, call sptb.setTheme on save and on load, resolve System via prefers-color-scheme. - Add branded 404 page via UseStatusCodePagesWithReExecute + Routes <NotFound> (blank white page before). - Add .progress-fill.indeterminate animation and .progress-panel. - Home: replace inline JS hover handlers with a .feature-card CSS class. - Define missing --surface-2 variable referenced by MainLayout. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
62 lines
2.0 KiB
Plaintext
62 lines
2.0 KiB
Plaintext
@page "/settings"
|
|
@attribute [Authorize]
|
|
@inject IUserSessionService Session
|
|
@inject IJSRuntime JS
|
|
@rendermode InteractiveServer
|
|
@using Microsoft.JSInterop
|
|
|
|
<h1 class="page-title">Settings</h1>
|
|
|
|
<div class="card">
|
|
<div class="card-title">Display</div>
|
|
<div class="form-group">
|
|
<label class="form-label">Language</label>
|
|
<select class="form-select" style="width:160px" @bind="_lang" @bind:after="Save">
|
|
<option value="en">English</option>
|
|
<option value="fr">Français</option>
|
|
</select>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="form-label">Theme</label>
|
|
<select class="form-select" style="width:160px" @bind="_theme" @bind:after="Save">
|
|
<option value="System">System</option>
|
|
<option value="Light">Light</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-title">Behavior</div>
|
|
<div class="form-group">
|
|
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
|
|
<input type="checkbox" @bind="_autoTakeOwnership" @bind:after="Save" />
|
|
Auto-elevate ownership when permission scan is denied
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
@if (_saved) { <div class="alert alert-success">Settings saved.</div> }
|
|
|
|
@code {
|
|
private string _lang = "en", _theme = "System";
|
|
private bool _autoTakeOwnership, _saved;
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
var s = Session.Settings;
|
|
_lang = s.Lang;
|
|
_theme = s.Theme is "System" or "Light" ? s.Theme : "System";
|
|
_autoTakeOwnership = s.AutoTakeOwnership;
|
|
}
|
|
|
|
private async Task Save()
|
|
{
|
|
Session.UpdateSettings(new AppSettings { Lang = _lang, Theme = _theme, AutoTakeOwnership = _autoTakeOwnership });
|
|
SharepointToolbox.Web.Localization.TranslationSource.Instance.SetCulture(_lang);
|
|
await JS.InvokeVoidAsync("sptb.setTheme", _theme);
|
|
_saved = true;
|
|
StateHasChanged();
|
|
_ = Task.Delay(2000).ContinueWith(_ => { _saved = false; InvokeAsync(StateHasChanged); });
|
|
}
|
|
}
|