mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
refactor(panel): unify settings and bridge contracts, prune dead code, and rename trajectory metrics
- Share settings normalization and window-bridge protocol contracts across frontend and backend - Encapsulate trajectory cache accessors inside config.mjs and validate bundle imports/syntax before writing - Remove dead selectors, unused symbols, duplicate re-export imports, and unmounted account tab instantiation - Rename speed-metrics.mjs to trajectory-metrics.mjs and audit-fixes.test.mjs to cross-module-regressions.test.mjs
This commit is contained in:
@@ -52,7 +52,7 @@ export const SettingsView = defineComponent({
|
||||
|
||||
const generalTab = SettingsGeneralTab({ onLayoutChange: refreshScroll });
|
||||
const structureTab = SettingsStructureTab({ onLayoutChange: refreshScroll });
|
||||
const accountTab = SettingsAccountTab({ onLayoutChange: refreshScroll });
|
||||
const accountTab = SHOW_ACCOUNT_TAB ? SettingsAccountTab({ onLayoutChange: refreshScroll }) : null;
|
||||
const otherTab = SettingsOtherTab({ onLayoutChange: refreshScroll });
|
||||
|
||||
let showingAccount = false;
|
||||
@@ -60,25 +60,27 @@ export const SettingsView = defineComponent({
|
||||
const target =
|
||||
subTab === 'structure' ||
|
||||
subTab === 'other' ||
|
||||
(SHOW_ACCOUNT_TAB && subTab === 'account')
|
||||
(accountTab && subTab === 'account')
|
||||
? subTab
|
||||
: 'general';
|
||||
subNavSwitch.setValue(target);
|
||||
patchAttr(generalTab.el, 'hidden', target !== 'general');
|
||||
patchAttr(structureTab.el, 'hidden', target !== 'structure');
|
||||
patchAttr(structureTab.refs.thirdNavBar, 'hidden', target !== 'structure');
|
||||
patchAttr(accountTab.el, 'hidden', !SHOW_ACCOUNT_TAB || target !== 'account');
|
||||
patchAttr(otherTab.el, 'hidden', target !== 'other');
|
||||
const nextShowingAccount = SHOW_ACCOUNT_TAB && target === 'account' && activeView === 'settings';
|
||||
if (nextShowingAccount && !showingAccount) void accountTab.refs.load();
|
||||
showingAccount = nextShowingAccount;
|
||||
if (accountTab) {
|
||||
patchAttr(accountTab.el, 'hidden', target !== 'account');
|
||||
const nextShowingAccount = target === 'account' && activeView === 'settings';
|
||||
if (nextShowingAccount && !showingAccount) void accountTab.refs.load();
|
||||
showingAccount = nextShowingAccount;
|
||||
}
|
||||
refreshScroll();
|
||||
}
|
||||
|
||||
const contentContainer = h(
|
||||
'div',
|
||||
{},
|
||||
SHOW_ACCOUNT_TAB
|
||||
accountTab
|
||||
? [generalTab.el, structureTab.el, accountTab.el, otherTab.el]
|
||||
: [generalTab.el, structureTab.el, otherTab.el]
|
||||
);
|
||||
@@ -105,7 +107,7 @@ export const SettingsView = defineComponent({
|
||||
if (settings) structureTab.refs.renderSettings(settings);
|
||||
} else if (settingsSubTab === 'other') {
|
||||
if (settings) otherTab.refs.renderSettings(settings, telemetry.contextWindowModels || []);
|
||||
} else if (SHOW_ACCOUNT_TAB && settingsSubTab === 'account') {
|
||||
} else if (accountTab && settingsSubTab === 'account') {
|
||||
accountTab.refs.renderAccount(telemetry?.account, telemetry?.quotas);
|
||||
} else {
|
||||
if (settings) generalTab.refs.renderSettings(settings);
|
||||
@@ -145,7 +147,7 @@ export const SettingsView = defineComponent({
|
||||
});
|
||||
generalTab.refs.refreshLabels();
|
||||
structureTab.refs.refreshLabels();
|
||||
accountTab.refs.refreshLabels();
|
||||
accountTab?.refs.refreshLabels();
|
||||
otherTab.refs.refreshLabels();
|
||||
refreshScroll();
|
||||
}
|
||||
@@ -158,7 +160,7 @@ export const SettingsView = defineComponent({
|
||||
subNavSwitch.destroy();
|
||||
generalTab.destroy();
|
||||
structureTab.destroy();
|
||||
accountTab.destroy();
|
||||
accountTab?.destroy();
|
||||
otherTab.destroy();
|
||||
viewScrollbar.destroy();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user