Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(agent-quota): restore the quota progress bar fill lost in the StyleX migration (#22075)

AmAzing-1805e341d024
diff --git a/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaMenu.test.tsx b/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaMenu.test.tsx
index 543e61224c3..4e52f233457 100644
--- a/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaMenu.test.tsx
+++ b/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaMenu.test.tsx
@@ -439,6 +439,13 @@ describe('CodexQuotaMenu', () => {
).toBe('low');
expect(screen.getByText('heteroAgent.codexQuota.fiveHour')).toBeTruthy();
expect(screen.getByText('heteroAgent.quota.weekly')).toBeTruthy();
+ // each bar fill is styled (height + color), and a low window paints differently
+ const fills = [...document.querySelectorAll<HTMLElement>('div[data-quota-level]')];
+ expect(fills.map((fill) => fill.style.width)).toEqual(['81%', '12%']);
+ const [normalFill, lowFill] = fills;
+ expect(normalFill.className).not.toBe('');
+ expect(lowFill.className).not.toBe('');
+ expect(lowFill.className).not.toBe(normalFill.className);
// each row carries its reset as a bare short duration, not a resetsIn/resetAt sentence
expect(
screen.getAllByText((content) => content.startsWith('heteroAgent.quota.duration.')),
diff --git a/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaMenu.tsx b/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaMenu.tsx
index 38d5764b40c..6e8fdae6e5c 100644
--- a/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaMenu.tsx
+++ b/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaMenu.tsx
@@ -43,6 +43,13 @@ const styles = stylex.create({
borderBlockEndColor: cssVar.colorBorderSecondary,
},
popover: { width: '292px' },
+ progressFill: {
+ height: '100%',
+ borderRadius: 'inherit',
+ backgroundColor: cssVar.colorSuccess,
+ backgroundImage: 'none',
+ },
+ progressFillWarning: { backgroundColor: cssVar.colorWarning },
progressTrack: {
overflow: 'hidden',
flex: '1',
@@ -575,6 +582,9 @@ const QuotaMenu = <S extends QuotaSnapshotBase>({
<div
data-quota-level={lowQuota ? 'low' : 'normal'}
style={{ width: `${leftPercent}%` }}
+ className={
+ stylex.props(styles.progressFill, lowQuota && styles.progressFillWarning).className
+ }
/>
</div>
<Text