app: redesign the panel and add limit forecasts and daily week use (#6)

Redesign the stats panel after the developer's feedback on v1 and add
limit forecasts, daily week use and token-based estimates (D7, D8).

- Panel: a fixed header with range and provider controls, limit tiles
  with pace chips, meters and forecasts, week use per day, token KPIs
  and charts, one burn-up chart per limit window with past instances,
  and a sortable breakdown whose "Other" row expands. One tooltip
  component for every chart, tile and table.
- Core (D7): average and recent-rate forecasts, the reach date whenever
  use is over pace, days of a long window with even pace and daily
  budget, window instances derived from resets with a 15-minute
  tolerance, and estimates from price-weighted tokens where samples are
  missing. Forecasts start at 10 % of a window, or as soon as it is
  ahead, so a Codex week far ahead right after its reset warns too.
- Settings, popups and the version (1.1.0) follow the new design.

Closes #5
Closes #7
This commit was merged in pull request #6.
This commit is contained in:
2026-10-15 19:06:04 +02:00
parent f8afd11679
commit adb8f5b88d
31 changed files with 2461 additions and 246 deletions
+9 -3
View File
@@ -27,7 +27,7 @@ public sealed class DesktopApp : Application
private bool quitting;
private PluginInstallStatus pluginStatus = new(PluginInstallState.NoHostFound);
public IPluginInstaller PluginInstaller { get; set; } = FinalToken.Core.StreamDeck.PluginInstaller.CreateDefault();
public override void Initialize() => Styles.Add(new FluentTheme());
public override void Initialize() => Styles.Add(Ui.NeutralTheme());
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime lifetime)
@@ -53,6 +53,7 @@ public sealed class DesktopApp : Application
engine.PopupRequested += alert => Dispatcher.UIThread.Post(() => { if (!quitting) popups.Pace(alert); });
engine.ActivationRequested += () => Dispatcher.UIThread.Post(OpenPanel);
model.Snapshot = engine.CurrentSnapshot;
model.ProbeInterval = engine.Settings.ProbeInterval;
ageTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(30) };
ageTimer.Tick += (_, _) => { if (panel.IsVisible) model.Diagnostics = engine.RecentDiagnostics; };
ageTimer.Start();
@@ -88,7 +89,11 @@ public sealed class DesktopApp : Application
panel.Show(); panel.WindowState = WindowState.Normal; panel.Activate();
if (OperatingSystem.IsWindows()) WindowsActivation.Activate(panel);
}
private Task Refresh() => engine is null ? Task.CompletedTask : engine.RefreshNowAsync();
private async Task Refresh()
{
if (engine is null) return;
await model.RefreshAsync(() => engine.RefreshNowAsync());
}
private async Task LoadHistory()
{
if (engine is null || model.Snapshot is not { } snapshot || quitting) return;
@@ -100,7 +105,7 @@ public sealed class DesktopApp : Application
{
if (engine is null) return;
if (settingsWindow is not null) { settingsWindow.Activate(); return; }
settingsWindow = new SettingsWindow(engine.Settings, pluginStatus, value => settingsSave = SaveSettings(value));
settingsWindow = new SettingsWindow(engine.Settings, pluginStatus, value => settingsSave = SaveSettings(value), () => Run(Quit));
settingsWindow.Closed += (_, _) => settingsWindow = null;
settingsWindow.Show();
}
@@ -113,6 +118,7 @@ public sealed class DesktopApp : Application
try { await engine.UpdateSettingsAsync(value); }
catch { await OsStartup.ApplyAsync(previous.StartWithOs); throw; }
if (quitting) return;
model.ProbeInterval = value.ProbeInterval;
await CheckPlugin();
if (!quitting) await engine.RefreshNowAsync();
}