mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-19 02:20:42 -07:00
25 lines
676 B
TypeScript
25 lines
676 B
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { createContext, useContext } from 'react';
|
|
import { LoadedSettings } from '../../config/settings.js';
|
|
|
|
export interface SettingsContextType {
|
|
settings: LoadedSettings;
|
|
recomputeSettings: () => void;
|
|
}
|
|
|
|
// This context is initialized in gemini.tsx with the loaded settings.
|
|
export const SettingsContext = createContext<SettingsContextType | null>(null);
|
|
|
|
export function useSettings(): LoadedSettings {
|
|
const context = useContext(SettingsContext);
|
|
if (!context) {
|
|
throw new Error('useSettings must be used within a SettingsProvider');
|
|
}
|
|
return context.settings;
|
|
}
|