mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 22:35:51 +00:00
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { useEffect, useRef } from 'react';
|
|
import { useNotifications } from 'src/context/notifications.js';
|
|
import { getModelDeprecationWarning } from 'src/utils/model/deprecation.js';
|
|
import { getIsRemoteMode } from '../../bootstrap/state.js';
|
|
|
|
export function useDeprecationWarningNotification(model: string): void {
|
|
const { addNotification } = useNotifications();
|
|
const lastWarningRef = useRef<string | null>(null);
|
|
|
|
useEffect(() => {
|
|
if (getIsRemoteMode()) return;
|
|
const deprecationWarning = getModelDeprecationWarning(model);
|
|
|
|
// Show warning if model is deprecated and we haven't shown this exact warning yet
|
|
if (deprecationWarning && deprecationWarning !== lastWarningRef.current) {
|
|
lastWarningRef.current = deprecationWarning;
|
|
addNotification({
|
|
key: 'model-deprecation-warning',
|
|
text: deprecationWarning,
|
|
color: 'warning',
|
|
priority: 'high',
|
|
});
|
|
}
|
|
|
|
// Reset tracking if model changes to non-deprecated
|
|
if (!deprecationWarning) {
|
|
lastWarningRef.current = null;
|
|
}
|
|
}, [model, addNotification]);
|
|
}
|