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

Function SimpleCreatorModal

app/src/components/EditAgent/SimpleCreatorModal.tsx:181–699  ·  view source on GitHub ↗
({ isOpen, onClose, onNext, isAuthenticated, hostingContext, userEmail, isProUser = false })

Source from the content-addressed store, hash-verified

179 isOpen: boolean; onClose: () => void; onNext: (config: any) => void; isAuthenticated: boolean; hostingContext?: 'official-web' | 'self-hosted'; userEmail?: string; isProUser?: boolean;
180}
181const SimpleCreatorModal: React.FC<SimpleCreatorModalProps> = ({ isOpen, onClose, onNext, isAuthenticated, hostingContext, userEmail, isProUser = false }) => {
182 const [step, setStep] = useState(1);
183 const [name, setName] = useState('');
184 const [agentId, setAgentId] = useState('');
185 const [model, setModel] = useState('');
186 const [systemPrompt, setSystemPrompt] = useState('');
187
188 const [selectedTools, setSelectedTools] = useState<Map<SimpleTool, ToolData>>(new Map());
189 const [smsPhoneNumber, setSmsPhoneNumber] = useState('');
190 const [whatsappPhoneNumber, setWhatsappPhoneNumber] = useState('');
191 const [phoneNumber, setPhoneNumber] = useState('');
192 const [emailAddress, setEmailAddress] = useState('');
193 const [pushoverUserKey, setPushoverUserKey] = useState('');
194 const [discordWebhookUrl, setDiscordWebhookUrl] = useState('');
195 const [telegramChatId, setTelegramChatId] = useState('');
196
197 const [conditionEnabled, setConditionEnabled] = useState(false);
198 const [conditionKeyword, setConditionKeyword] = useState('');
199
200 const [availableModels, setAvailableModels] = useState<Model[]>([]);
201 const [existingAgents, setExistingAgents] = useState<CompleteAgent[]>([]);
202 const [loadingModels, setLoadingModels] = useState(false);
203 const [visionValidationError, setVisionValidationError] = useState<string | null>(null);
204 const [showWhisperWarning, setShowWhisperWarning] = useState(false);
205
206 // --- NEW: State for contextual warnings ---
207 const [showDesktopNotifWarning, setShowDesktopNotifWarning] = useState(false);
208 const [showSmsWarning, setShowSmsWarning] = useState(false);
209 const [showWhatsappWarning, setShowWhatsappWarning] = useState(false);
210 // --- END NEW ---
211
212 const promptRef = useRef<HTMLTextAreaElement>(null);
213 const [showConfirmClose, setShowConfirmClose] = useState(false);
214 const [tutorialStep, setTutorialStep] = useState(0);
215 const tutorialDrivenPageChange = useRef(false);
216
217 const tutorialStepConfigs = [
218 { selector: '[data-tutorial="name-input"]', title: 'Name your agent', message: "We've suggested 'Person Watcher', change it if you like." },
219 { selector: '[data-tutorial="model-grid"]', title: 'Choose a model', message: 'Cloud models work out of the box. Pick any one to continue.' },
220 { selector: '[data-tutorial="prompt-area"]', title: 'Your prompt is ready', message: "It watches your camera and outputs PERSON_DETECTED when it sees someone." },
221 { selector: '[data-tutorial="keyword-area"]', title: 'Trigger on a keyword', message: "Actions only fire when the model says PERSON_DETECTED, already configured for you!" },
222 {
223 selector: isAuthenticated ? '[data-tutorial="email-tool"]' : '[data-tutorial="celebrate-tool"]',
224 title: isAuthenticated ? 'Get emailed on detection' : 'Celebrate on detection!',
225 message: isAuthenticated
226 ? `We've pre-selected your email${userEmail ? ` (${userEmail})` : ''} — you'll get alerted when someone is detected.`
227 : "Trigger a celebration animation whenever a person is detected... a fun way to test your agent!",
228 },
229 { selector: '[data-tutorial="finish-button"]', title: 'Ready to launch!', message: "Hit Finish & Create, your agent will be generated so you can view it!" },
230 ];
231
232 const handleTutorialNext = () => {
233 const next = tutorialStep + 1;
234 if (next > tutorialStepConfigs.length) {
235 localStorage.setItem('observer_creator_tutorial_seen', 'true');
236 setTutorialStep(0);
237 return;
238 }

Callers

nothing calls this directly

Calls 9

fetchModelsFunction · 0.90
listAgentsFunction · 0.90
insertSensorFunction · 0.85
toggleToolFunction · 0.85
getDetectedSensorDataFunction · 0.85
allMethod · 0.80
errorMethod · 0.80
isCloudModelFunction · 0.70
getProviderNameFunction · 0.70

Tested by

no test coverage detected