Skip to content

desktop/src/App.svelte

Comment 1, line 41

desktop/src/App.svelte:41

/** Today/two-calendar-day ranges use hourly data bounded by dates in the configured timezone. */

Comment 2, line 55

desktop/src/App.svelte:55

/** Separate today query (D8): summary first_day=last_day for the current-day section. */

Comment 3, line 66

desktop/src/App.svelte:66

// Theme: system/light/dark through data-theme and derived isDark for ECharts.

Comment 4, line 67

desktop/src/App.svelte:67

/** Track system dark-mode changes so system-theme charts update immediately. */

Comment 5, line 77

desktop/src/App.svelte:77

/** Explicit light/dark wins; other values, including unknown settings, use system. */

Comment 6, line 81

desktop/src/App.svelte:81

/** Effective dark mode supplied to ECharts: explicit dark or system with a dark preference. */

Comment 7, line 84

desktop/src/App.svelte:84

// For system theme, remove data-theme and let themes.css prefers-color-scheme apply.

Comment 8, line 91

desktop/src/App.svelte:91

// v6 users: header selection and creation.

Comment 9, line 100

desktop/src/App.svelte:100

/** Force child queries to reload after user switches/imports without a changed query. */

Comment 10, line 103

desktop/src/App.svelte:103

// E10/E11 panel order/visibility, persisted per page in localStorage.

Comment 11, line 158

desktop/src/App.svelte:158

/** Default panel column span in the six-column grid. */

Comment 12, line 189

desktop/src/App.svelte:189

/** Hide trend cost panels when estimates are disabled, without rewriting the saved layout. */

Comment 13, line 203

desktop/src/App.svelte:203

/** Prefer a resized edit-mode column span over the panel default. */

Comment 14, line 209

desktop/src/App.svelte:209

/** Panel height in pixels; unmodified panels size automatically. */

Comment 15, line 214

desktop/src/App.svelte:214

/** Persist span/height and layout when resize dragging ends. */

Comment 16, line 221

desktop/src/App.svelte:221

/** Reset current-page localStorage layout to default order, dimensions and visibility. */

Comment 17, line 236

desktop/src/App.svelte:236

/** Shared overview/trend edit mode enables dragging and visibility controls. */

Comment 18, line 242

desktop/src/App.svelte:242

/**
* Pointer-based panel dragging fixed on 2026-09-26. With default dragDropEnabled=true,
* Tauri WebView2 intercepted HTML5 dragstart/drop. Use panel pointerdown and window
* pointermove/pointerup/pointercancel instead. elementsFromPoint identifies the target
* data-panel-group/-index during movement; releasing swaps and persists panel order.
*/

Comment 19, line 259

desktop/src/App.svelte:259

// A target in another group/page falls back to this panel, leaving its order unchanged.

Comment 20, line 352

desktop/src/App.svelte:352

// One cost query feeds the summary, model rows and curve on the active page.

Comment 21, line 390

desktop/src/App.svelte:390

// Cost curves are daily when usage is hourly; include all visible hours of the day.

Comment 22, line 435

desktop/src/App.svelte:435

/** Overview history and trends share period selection; reselecting the same overview point clears it. */

Comment 23, line 448

desktop/src/App.svelte:448

// User options include a synthetic current entry when absent from the list, such as initial default.

Comment 24, line 457

desktop/src/App.svelte:457

// Today shares use total_tokens by model/Agent; group unknown names and exclude zero values.

Comment 25, line 474

desktop/src/App.svelte:474

// Trend shares use model/Agent total_tokens from the selected-range summary.

Comment 26, line 518

desktop/src/App.svelte:518

/** Date label for the today section. */

Comment 27, line 521

desktop/src/App.svelte:521

/**
* Selected-period cards mirror today: calls, input/cache/uncached, output, total tokens,
* cache ratio and sessions; week/month selections also show active days.
*/

Comment 28, line 581

desktop/src/App.svelte:581

/** Load the main and today queries together for one interaction/refresh.
* Preserve object references when query keys and data revisions are unchanged, avoiding
* idle chart redraws and flicker reported on 2026-09-26. */

Comment 29, line 634

desktop/src/App.svelte:634

/** Reload summary, heatmap and sources after a user switch/import without a changed query. */

Comment 30, line 643

desktop/src/App.svelte:643

// Open user creation while keeping the dropdown on the current user.

Comment 31, line 663

desktop/src/App.svelte:663

// Backend summary/heatmap follow the current user and must reload after switching.

Comment 32, line 696

desktop/src/App.svelte:696

// Collection-status polling and automatic data refresh.

Comment 33, line 697

desktop/src/App.svelte:697

/** Last observed completed-collection timestamp; a change requires data reload. */

Comment 34, line 699

desktop/src/App.svelte:699

/** Loaded summary query key and data revision, used to skip identical assignments. */

Comment 35, line 702

desktop/src/App.svelte:702

/**
* Reload data when collection finishes or its completion timestamp changes, including
* scheduled/headless collection. Idle polling updates status without rebuilding charts,
* preventing periodic overview flicker.
*/

Comment 36, line 708

desktop/src/App.svelte:708

// An accepted request may not have set the worker's running flag yet.

Comment 37, line 729

desktop/src/App.svelte:729

/* Retry a failed poll on the next interval. */

Comment 38, line 735

desktop/src/App.svelte:735

/**
* Poll every 500 ms during collection and every 10 seconds when idle.
* Idle status checks detect system/scheduler collection without redrawing charts.
*/

Comment 39, line 746

desktop/src/App.svelte:746

// Header query-refresh interval: localStorage persistence, default five minutes.

Comment 40, line 748

desktop/src/App.svelte:748

// The v2 key accompanies the default change from 60 to 300 seconds on 2026-09-26.

Comment 41, line 749

desktop/src/App.svelte:749

// Ignore the old stored default on first startup with this key.

Comment 42, line 767

desktop/src/App.svelte:767

/* Without storage access, keep the selection for this session only. */

Comment 43, line 808

desktop/src/App.svelte:808

// Today/two-calendar-day ranges select hourly data.

Comment 44, line 814

desktop/src/App.svelte:814

// Debounce changed queries by 200 ms and clear a selection whose period label may be stale.

Comment 45, line 833

desktop/src/App.svelte:833

// Timezone/week-start changes affect date ranges without changing the query key; force reload.

Comment 46, line 835

desktop/src/App.svelte:835

// F2: enabling pricing starts a background cost recomputation for retained details.

Comment 47, line 836

desktop/src/App.svelte:836

// Repeated recomputation is safe; skip when disabled, as collection does not backfill it.

Comment 48, line 854

desktop/src/App.svelte:854

// Collection ETA is empty when unavailable so the template hides it.

Comment 49, line 918

desktop/src/App.svelte:918

<!-- Query-refresh interval is independent of background collection; disabled means manual refresh. -->

Comment 50, line 1082

desktop/src/App.svelte:1082

<!-- Put range/granularity inside history because today uses an independent query. -->

Comment 51, line 1105

desktop/src/App.svelte:1105

<!-- Selecting a historical chart point shows period cards matching the today layout. -->

Comment 52, line 1132

desktop/src/App.svelte:1132

<!-- Model/Agent pies use chart_series with the same selected-period filters.
Match loading/chart heights and retain the old chart while replacing data to reduce movement. -->

Comment 53, line 1194

desktop/src/App.svelte:1194

<!-- Seven fixed range-summary cards above charts use summary.totals. -->

Comment 54, line 1345

desktop/src/App.svelte:1345

/* Highlight the panel-layout edit toggle when active. */

Comment 55, line 1380

desktop/src/App.svelte:1380

/* Header query-refresh selector shares a row with collection progress and refresh. */

Comment 56, line 1389

desktop/src/App.svelte:1389

/* Collection progress width follows its percentage, alongside percentage/ETA text. */

Comment 57, line 1467

desktop/src/App.svelte:1467

/* D8 today/history headings; history range/granularity filters affect that section only. */

Comment 58, line 1490

desktop/src/App.svelte:1490

/* History range/granularity controls sit beside its heading, separate from today. */

Comment 59, line 1504

desktop/src/App.svelte:1504

/* Selected-period heading and reused summary-cards grid inside history. */

Comment 60, line 1538

desktop/src/App.svelte:1538

/* Model/Agent pies use two columns, stacking on narrow screens. */

Comment 61, line 1551

desktop/src/App.svelte:1551

/* Match loading/empty-state height to reduce movement when changing selected periods. */

Comment 62, line 1559

desktop/src/App.svelte:1559

/* Match the SharePie loading placeholder to its 190px chart height. */

Comment 63, line 1565

desktop/src/App.svelte:1565

/* E10 six-column panel grid; Panel span classes set column widths. */

Comment 64, line 1573

desktop/src/App.svelte:1573

/* Keep metric rows compact; account quota has an independent full-width strip. */