Skip to content

Commit 0b03586

Browse files
authored
enhance(ai-help): disable top banner if quota banner is visible (#10532)
* refactor(ai-help): move AiHelpBanner into AIHelpInner * enhance(ai-help): change top banner if quota banner is visible 1. Change the background-color. 2. Hide the "Upgrade Now" button. 3. Add a margin equivalent to the height of the button to avoid layout shift.
1 parent aa34dab commit 0b03586

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

Diff for: client/src/plus/ai-help/banners.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ import { useUserData } from "../../user-context";
66
import { PlusLoginBanner } from "../common/login-banner";
77
import { isPlusSubscriber } from "../../utils";
88

9-
export function AiHelpBanner() {
9+
export function AiHelpBanner({
10+
isDisabled = false,
11+
}: { isDisabled?: boolean } = {}) {
1012
const user = useUserData();
1113

1214
const isSubscriber = useMemo(() => isPlusSubscriber(user), [user]);
1315

1416
return (
15-
<div className="ai-help-banner">
17+
<div className={`ai-help-banner ${isDisabled ? "disabled" : ""}`}>
1618
<p>
1719
<Icon name="bell-ring" />
1820
<strong>

Diff for: client/src/plus/ai-help/index.scss

+10
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,16 @@
152152
.auth-container {
153153
margin-top: 1rem;
154154
}
155+
156+
&.disabled {
157+
background-color: var(--background-secondary);
158+
159+
margin-bottom: 2.25rem;
160+
161+
.button {
162+
display: none;
163+
}
164+
}
155165
}
156166

157167
.ai-help-inner {

Diff for: client/src/plus/ai-help/index.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,6 @@ function AIHelpAuthenticated() {
124124
</a>
125125
</p>
126126
</Container>
127-
<Container>
128-
<AiHelpBanner />
129-
</Container>
130127
<AIHelpInner />
131128
</div>
132129
);
@@ -635,6 +632,7 @@ export function AIHelpInner() {
635632
messageId={messages.length === 2 ? messages[0]?.messageId : undefined}
636633
/>
637634
<Container>
635+
<AiHelpBanner isDisabled={isQuotaExceeded(quota)} />
638636
{isQuotaLoading || isHistoryLoading ? (
639637
<Loading />
640638
) : (

0 commit comments

Comments
 (0)