-
Notifications
You must be signed in to change notification settings - Fork 2.5k
fix: add showCloudPromotion setting to disable cloud CTA #7826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -120,6 +120,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro | |
| soundEnabled, | ||
| soundVolume, | ||
| cloudIsAuthenticated, | ||
| showCloudPromotion, | ||
| messageQueue = [], | ||
| } = useExtensionState() | ||
|
|
||
|
|
@@ -1831,7 +1832,11 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro | |
| {telemetrySetting === "unset" && <TelemetryBanner />} | ||
|
|
||
| <div className="mb-2.5"> | ||
| {cloudIsAuthenticated || taskHistory.length < 4 ? <RooTips /> : <RooCloudCTA />} | ||
| {cloudIsAuthenticated || taskHistory.length < 4 || !showCloudPromotion ? ( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The implementation looks correct. The conditional logic properly checks all three conditions: authentication status, task count, and the new |
||
| <RooTips /> | ||
| ) : ( | ||
| <RooCloudCTA /> | ||
| )} | ||
| </div> | ||
| {/* Show the task history preview if expanded and tasks exist */} | ||
| {taskHistory.length > 0 && isExpanded && <HistoryPreview />} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,8 @@ export interface ExtensionStateContextType extends ExtensionState { | |
| mdmCompliant?: boolean | ||
| hasOpenedModeSelector: boolean // New property to track if user has opened mode selector | ||
| setHasOpenedModeSelector: (value: boolean) => void // Setter for the new property | ||
| showCloudPromotion: boolean // New property for cloud promotion visibility | ||
| setShowCloudPromotion: (value: boolean) => void // Setter for cloud promotion | ||
| alwaysAllowFollowupQuestions: boolean // New property for follow-up questions auto-approve | ||
| setAlwaysAllowFollowupQuestions: (value: boolean) => void // Setter for the new property | ||
| followupAutoApproveTimeoutMs: number | undefined // Timeout in ms for auto-approving follow-up questions | ||
|
|
@@ -255,6 +257,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode | |
| maxDiagnosticMessages: 50, | ||
| openRouterImageApiKey: "", | ||
| openRouterImageGenerationSelectedModel: "", | ||
| showCloudPromotion: true, // Default to true to maintain current behavior | ||
| }) | ||
|
|
||
| const [didHydrateState, setDidHydrateState] = useState(false) | ||
|
|
@@ -274,6 +277,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode | |
| global: {}, | ||
| }) | ||
| const [includeTaskHistoryInEnhance, setIncludeTaskHistoryInEnhance] = useState(true) | ||
| const [showCloudPromotion, setShowCloudPromotion] = useState(true) // Default to true | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good state management implementation. The setting is properly initialized, updated from backend messages, and exposed through the context. However, this won't work without the corresponding backend implementation in |
||
|
|
||
| const setListApiConfigMeta = useCallback( | ||
| (value: ProviderSettingsEntry[]) => setState((prevState) => ({ ...prevState, listApiConfigMeta: value })), | ||
|
|
@@ -311,6 +315,10 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode | |
| if ((newState as any).includeTaskHistoryInEnhance !== undefined) { | ||
| setIncludeTaskHistoryInEnhance((newState as any).includeTaskHistoryInEnhance) | ||
| } | ||
| // Update showCloudPromotion if present in state message | ||
| if ((newState as any).showCloudPromotion !== undefined) { | ||
| setShowCloudPromotion((newState as any).showCloudPromotion) | ||
| } | ||
| // Handle marketplace data if present in state message | ||
| if (newState.marketplaceItems !== undefined) { | ||
| setMarketplaceItems(newState.marketplaceItems) | ||
|
|
@@ -527,6 +535,11 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode | |
| }, | ||
| includeTaskHistoryInEnhance, | ||
| setIncludeTaskHistoryInEnhance, | ||
| showCloudPromotion, | ||
| setShowCloudPromotion: (value) => { | ||
| setShowCloudPromotion(value) | ||
| setState((prevState) => ({ ...prevState, showCloudPromotion: value })) | ||
| }, | ||
| } | ||
|
|
||
| return <ExtensionStateContext.Provider value={contextValue}>{children}</ExtensionStateContext.Provider> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a more descriptive comment here explaining the purpose of this setting, e.g.: