MCPcopy Create free account
hub / github.com/Roy3838/Observer / toggleTool

Function toggleTool

app/src/components/EditAgent/SimpleCreatorModal.tsx:413–447  ·  view source on GitHub ↗
(tool: SimpleTool)

Source from the content-addressed store, hash-verified

411
412 // --- MODIFIED: toggleTool now handles showing/hiding warnings ---
413 const toggleTool = (tool: SimpleTool) => {
414 // Show warnings on selection
415 if (tool === 'notification') setShowDesktopNotifWarning(true);
416 if (tool === 'sms') setShowSmsWarning(true);
417 if (tool === 'whatsapp') setShowWhatsappWarning(true);
418
419 // Hide warnings if the tool is being deselected
420 if (tool === 'notification' && selectedTools.has(tool)) setShowDesktopNotifWarning(false);
421 if (tool === 'sms' && selectedTools.has(tool)) setShowSmsWarning(false);
422 if (tool === 'whatsapp' && selectedTools.has(tool)) setShowWhatsappWarning(false);
423
424
425 setSelectedTools(prev => {
426 const newMap = new Map(prev);
427 if (newMap.has(tool)) {
428 newMap.delete(tool);
429 // If "Start Recording" is turned off, also turn off "Label Recording"
430 if (tool === 'start_clip') {
431 newMap.delete('mark_clip');
432 }
433 } else {
434 const initialData: ToolData =
435 tool === 'sms' ? { smsPhoneNumber } :
436 tool === 'whatsapp' ? { whatsappPhoneNumber } :
437 tool === 'call' ? { phoneNumber } :
438 tool === 'email' ? { emailAddress } :
439 tool === 'pushover' ? { pushoverUserKey } :
440 tool === 'discord' ? { discordWebhookUrl } :
441 tool === 'telegram' ? { telegramChatId } :
442 {};
443 newMap.set(tool, initialData);
444 }
445 return newMap;
446 });
447 };
448 // --- END MODIFICATION ---
449
450 const handleNext = () => {

Callers 2

toggleLockPhoneFunction · 0.85
SimpleCreatorModalFunction · 0.85

Calls 1

deleteMethod · 0.80

Tested by

no test coverage detected