mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Add an account Summary tab to Analytics (#45769)
## What changed - Make Summary the initial Analytics tab, showing profile identity, token totals, streaks, activity insights, and most-used plugins and skills. - Move daily, weekly, and cumulative token activity charts into Summary. Replace the usage menu's separate views with “View analytics”; `/usage weekly` and the other explicit modes open Summary with the requested view, while reopening from the menu retains navigation. - Load account profiles independently of other reports, preserve missing values separately from zero, and reject responses when the active account changes. Refresh retries profile failures. - Adapt Summary to narrow terminals and compact large chart totals and axis labels. Show the account email without its ID in the Analytics header. - Flush queued transcript history before opening an overlay so startup output stays in the transcript. ## Testing Add profile decoding and account identity tests, Summary layout and navigation snapshots, refresh and cancellation coverage, and regression tests for retained navigation and transcript history when opening Analytics. GitOrigin-RevId: 6dbe6c4c98209000d8b4bc18a4e01b98fab5991a
This commit is contained in:
1 parent
8f0d2459ac
commit
9bd49c9dcc
122 files changed
+3685
-1980
No files matched your search
@@ -146,6 +146,27 @@ pub(super) fn amount(value: f64) -> String {
|
||||
grouped
|
||||
}
|
||||
|
||||
/// Compact headline and axis labels to one decimal, preserving small signed adjustments.
|
||||
pub(super) fn compact_amount(value: f64) -> String {
|
||||
if value.abs() < 1_000.0 || !value.is_finite() {
|
||||
return amount(value);
|
||||
}
|
||||
let units = ["K", "M", "B", "T"];
|
||||
let mut scaled = value / 1_000.0;
|
||||
let mut unit = 0;
|
||||
// Promote before rounding would produce a label such as 1000K.
|
||||
while scaled.abs() >= 999.95 && unit + 1 < units.len() {
|
||||
scaled /= 1_000.0;
|
||||
unit += 1;
|
||||
}
|
||||
let rounded = format!("{:.1}", (scaled * 10.0).round() / 10.0);
|
||||
format!(
|
||||
"{}{}",
|
||||
rounded.trim_end_matches('0').trim_end_matches('.'),
|
||||
units[unit]
|
||||
)
|
||||
}
|
||||
|
||||
/// Align ordinary credit amounts to two decimals without hiding tiny adjustments.
|
||||
pub(super) fn credit_amount(value: f64) -> String {
|
||||
let formatted = amount(value);
|
||||
|
||||
Reference in new issue
Block a user