(
{ isHidden, showAnnouncement, hideAnnouncement },
ref,
)
| 64 | const isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0 |
| 65 | |
| 66 | const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewProps> = ( |
| 67 | { isHidden, showAnnouncement, hideAnnouncement }, |
| 68 | ref, |
| 69 | ) => { |
| 70 | const [audioBaseUri] = useState(() => { |
| 71 | return (window as unknown as { AUDIO_BASE_URI?: string }).AUDIO_BASE_URI || "" |
| 72 | }) |
| 73 | |
| 74 | const { t } = useAppTranslation() |
| 75 | const modeShortcutText = `${isMac ? "⌘" : "Ctrl"} + . ${t("chat:forNextMode")}, ${isMac ? "⌘" : "Ctrl"} + Shift + . ${t("chat:forPreviousMode")}` |
| 76 | |
| 77 | const { |
| 78 | clineMessages: messages, |
| 79 | currentTaskItem, |
| 80 | currentTaskTodos, |
| 81 | taskHistory, |
| 82 | apiConfiguration, |
| 83 | organizationAllowList, |
| 84 | mode, |
| 85 | setMode, |
| 86 | alwaysAllowModeSwitch, |
| 87 | customModes, |
| 88 | soundEnabled, |
| 89 | soundVolume, |
| 90 | messageQueue = [], |
| 91 | showWorktreesInHomeScreen, |
| 92 | telemetrySetting, |
| 93 | } = useExtensionState() |
| 94 | |
| 95 | // Show a WarningRow when the user sends a message with a retired provider. |
| 96 | const [showRetiredProviderWarning, setShowRetiredProviderWarning] = useState(false) |
| 97 | |
| 98 | // When the provider changes, clear the retired-provider warning. |
| 99 | const providerName = apiConfiguration?.apiProvider |
| 100 | useEffect(() => { |
| 101 | setShowRetiredProviderWarning(false) |
| 102 | }, [providerName]) |
| 103 | |
| 104 | const messagesRef = useRef(messages) |
| 105 | |
| 106 | useEffect(() => { |
| 107 | messagesRef.current = messages |
| 108 | }, [messages]) |
| 109 | |
| 110 | // Leaving this less safe version here since if the first message is not a |
| 111 | // task, then the extension is in a bad state and needs to be debugged (see |
| 112 | // Cline.abort). |
| 113 | const task = useMemo(() => messages.at(0), [messages]) |
| 114 | |
| 115 | const latestTodos = useMemo(() => { |
| 116 | // First check if we have initial todos from the state (for new subtasks) |
| 117 | if (currentTaskTodos && currentTaskTodos.length > 0) { |
| 118 | // Check if there are any todo updates in messages |
| 119 | const messageBasedTodos = getLatestTodo(messages) |
| 120 | // If there are message-based todos, they take precedence (user has updated them) |
| 121 | if (messageBasedTodos && messageBasedTodos.length > 0) { |
| 122 | return messageBasedTodos |
| 123 | } |
nothing calls this directly
no test coverage detected