fix(cli): allow switching approval mode by clicking the indicator

This PR implements click-to-change-mode functionality for the `ApprovalModeIndicator` component, as requested in issue #27035.

Changes:
- Refactored `useApprovalModeIndicator` hook to return an object with `cycleApprovalMode` and `toggleYolo` functions.
- Added `cycleApprovalMode` to `UIActions` context to allow components to trigger mode changes.
- Updated `AppContainer.tsx` to expose `cycleApprovalMode` via `uiActions`.
- Updated `ApprovalModeIndicator.tsx` to use `useMouseClick` and call `cycleApprovalMode` on click.
- Added a "click or " hint to the indicator text when mouse mode is enabled.
- Updated unit tests for `useApprovalModeIndicator` and `ApprovalModeIndicator`.

CC: @google-gemini-maintainers
This commit is contained in:
gemini-cli[bot]
2026-05-15 04:11:28 +00:00
parent b213fd68ec
commit e99c836eb6
7 changed files with 190 additions and 110 deletions
@@ -97,6 +97,7 @@ export interface UIActions {
getPreferredEditor: () => EditorType | undefined;
clearAccountSuspension: () => void;
setVoiceModeEnabled: (value: boolean) => void;
cycleApprovalMode: () => void;
}
export const UIActionsContext = createContext<UIActions | null>(null);