fraudTech commited on
Commit
ebe166a
·
1 Parent(s): 5bfc410

reverse animation

Browse files
Files changed (2) hide show
  1. web/src/App.css +0 -59
  2. web/src/App.tsx +6 -93
web/src/App.css CHANGED
@@ -598,65 +598,6 @@ details.tool-call summary::-webkit-details-marker {
598
  font-size: 1rem;
599
  }
600
 
601
- /* Tool status indicators */
602
- .tool-status {
603
- display: inline-flex;
604
- align-items: center;
605
- gap: 0.5rem;
606
- font-size: 0.85rem;
607
- font-weight: 500;
608
- }
609
-
610
- .tool-status.generating {
611
- color: #64b5f6;
612
- }
613
-
614
- .tool-status.executing {
615
- color: #ba68c8;
616
- }
617
-
618
- .tool-status.completed {
619
- color: #7d9d7a;
620
- }
621
-
622
- .status-text {
623
- opacity: 0.9;
624
- }
625
-
626
- /* Loading dots animation */
627
- .loading-dots {
628
- display: inline-flex;
629
- gap: 0.25rem;
630
- align-items: center;
631
- }
632
-
633
- .loading-dots .dot {
634
- width: 6px;
635
- height: 6px;
636
- border-radius: 50%;
637
- background-color: currentColor;
638
- animation: dot-bounce 1.4s infinite ease-in-out both;
639
- }
640
-
641
- .loading-dots .dot:nth-child(1) {
642
- animation-delay: -0.32s;
643
- }
644
-
645
- .loading-dots .dot:nth-child(2) {
646
- animation-delay: -0.16s;
647
- }
648
-
649
- @keyframes dot-bounce {
650
- 0%, 80%, 100% {
651
- transform: scale(0.8) translateY(0);
652
- opacity: 0.7;
653
- }
654
- 40% {
655
- transform: scale(1) translateY(-8px);
656
- opacity: 1;
657
- }
658
- }
659
-
660
  /* Content area (hidden when closed) */
661
  .tool-call-content {
662
  padding: 0 1rem 1rem 1rem;
 
598
  font-size: 1rem;
599
  }
600
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
601
  /* Content area (hidden when closed) */
602
  .tool-call-content {
603
  padding: 0 1rem 1rem 1rem;
web/src/App.tsx CHANGED
@@ -211,8 +211,6 @@ interface ToolCall {
211
  name: string;
212
  input: string;
213
  output: string;
214
- isGenerating?: boolean; // AI is writing the code
215
- isExecuting?: boolean; // Code is running in sandbox
216
  }
217
 
218
  interface User {
@@ -235,8 +233,6 @@ function App() {
235
  const [showSettings, setShowSettings] = useState(false);
236
  const messagesEndRef = useRef<HTMLDivElement>(null);
237
  const messagesContainerRef = useRef<HTMLDivElement>(null);
238
- const textareaRef = useRef<HTMLTextAreaElement>(null);
239
- const isWindowFocusedRef = useRef(true);
240
 
241
  // Select a random logic saying on component mount
242
  const randomSaying = useMemo(
@@ -278,49 +274,6 @@ function App() {
278
  messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
279
  }, [messages]);
280
 
281
- // Track window focus to prevent auto-scroll on refocus
282
- useEffect(() => {
283
- const handleFocus = () => {
284
- isWindowFocusedRef.current = true;
285
- };
286
-
287
- const handleBlur = () => {
288
- isWindowFocusedRef.current = false;
289
- };
290
-
291
- window.addEventListener('focus', handleFocus);
292
- window.addEventListener('blur', handleBlur);
293
-
294
- return () => {
295
- window.removeEventListener('focus', handleFocus);
296
- window.removeEventListener('blur', handleBlur);
297
- };
298
- }, []);
299
-
300
- // Prevent textarea from scrolling into view on window refocus
301
- useEffect(() => {
302
- const textarea = textareaRef.current;
303
- if (!textarea) return;
304
-
305
- const handleFocus = (e: FocusEvent) => {
306
- // If window just regained focus, prevent scroll behavior
307
- if (!isWindowFocusedRef.current) {
308
- e.preventDefault();
309
- // Blur and refocus without scrolling
310
- textarea.blur();
311
- setTimeout(() => {
312
- textarea.focus({ preventScroll: true });
313
- }, 0);
314
- }
315
- };
316
-
317
- textarea.addEventListener('focus', handleFocus);
318
-
319
- return () => {
320
- textarea.removeEventListener('focus', handleFocus);
321
- };
322
- }, []);
323
-
324
  const handleSendMessage = async () => {
325
  if (!input.trim() || isLoading) return;
326
 
@@ -413,7 +366,7 @@ function App() {
413
  )
414
  );
415
  } else if (event === 'tool_start') {
416
- // Add tool call with generating state
417
  setMessages((prev) =>
418
  prev.map((msg) =>
419
  msg.id === assistantId
@@ -425,8 +378,6 @@ function App() {
425
  name: data.name,
426
  input: data.input,
427
  output: '',
428
- isGenerating: true,
429
- isExecuting: false,
430
  },
431
  ],
432
  }
@@ -434,23 +385,10 @@ function App() {
434
  )
435
  );
436
  } else if (event === 'tool_executing') {
437
- // Update to executing state
438
- setMessages((prev) =>
439
- prev.map((msg) =>
440
- msg.id === assistantId
441
- ? {
442
- ...msg,
443
- toolCalls: (msg.toolCalls || []).map((tc) =>
444
- tc.name === data.name && !tc.output
445
- ? { ...tc, isGenerating: false, isExecuting: true }
446
- : tc
447
- ),
448
- }
449
- : msg
450
- )
451
- );
452
  } else if (event === 'tool_complete') {
453
- // Update tool call with result and remove loading states
454
  setMessages((prev) =>
455
  prev.map((msg) =>
456
  msg.id === assistantId
@@ -458,7 +396,7 @@ function App() {
458
  ...msg,
459
  toolCalls: (msg.toolCalls || []).map((tc) =>
460
  tc.name === data.name && !tc.output
461
- ? { ...tc, output: data.output, isGenerating: false, isExecuting: false }
462
  : tc
463
  ),
464
  }
@@ -647,31 +585,7 @@ function App() {
647
  <details key={idx} className="tool-call">
648
  <summary className="tool-call-header">
649
  <span className="tool-name">{tool.name}</span>
650
- {tool.isGenerating && (
651
- <span className="tool-status generating">
652
- <span className="loading-dots">
653
- <span className="dot"></span>
654
- <span className="dot"></span>
655
- <span className="dot"></span>
656
- </span>
657
- <span className="status-text">Generating code...</span>
658
- </span>
659
- )}
660
- {tool.isExecuting && (
661
- <span className="tool-status executing">
662
- <span className="loading-dots">
663
- <span className="dot"></span>
664
- <span className="dot"></span>
665
- <span className="dot"></span>
666
- </span>
667
- <span className="status-text">Executing...</span>
668
- </span>
669
- )}
670
- {tool.output && !tool.isGenerating && !tool.isExecuting && (
671
- <span className="tool-status completed">
672
- <span className="status-text">Completed</span>
673
- </span>
674
- )}
675
  </summary>
676
  <div className="tool-call-content">
677
  <details className="tool-section">
@@ -707,7 +621,6 @@ function App() {
707
 
708
  <div className="input-container">
709
  <textarea
710
- ref={textareaRef}
711
  value={input}
712
  onChange={(e) => setInput(e.target.value)}
713
  onKeyPress={handleKeyPress}
 
211
  name: string;
212
  input: string;
213
  output: string;
 
 
214
  }
215
 
216
  interface User {
 
233
  const [showSettings, setShowSettings] = useState(false);
234
  const messagesEndRef = useRef<HTMLDivElement>(null);
235
  const messagesContainerRef = useRef<HTMLDivElement>(null);
 
 
236
 
237
  // Select a random logic saying on component mount
238
  const randomSaying = useMemo(
 
274
  messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
275
  }, [messages]);
276
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  const handleSendMessage = async () => {
278
  if (!input.trim() || isLoading) return;
279
 
 
366
  )
367
  );
368
  } else if (event === 'tool_start') {
369
+ // Add tool call placeholder
370
  setMessages((prev) =>
371
  prev.map((msg) =>
372
  msg.id === assistantId
 
378
  name: data.name,
379
  input: data.input,
380
  output: '',
 
 
381
  },
382
  ],
383
  }
 
385
  )
386
  );
387
  } else if (event === 'tool_executing') {
388
+ // Tool is now executing
389
+ setStatusMessage('Executing tool...');
 
 
 
 
 
 
 
 
 
 
 
 
 
390
  } else if (event === 'tool_complete') {
391
+ // Update tool call with result
392
  setMessages((prev) =>
393
  prev.map((msg) =>
394
  msg.id === assistantId
 
396
  ...msg,
397
  toolCalls: (msg.toolCalls || []).map((tc) =>
398
  tc.name === data.name && !tc.output
399
+ ? { ...tc, output: data.output }
400
  : tc
401
  ),
402
  }
 
585
  <details key={idx} className="tool-call">
586
  <summary className="tool-call-header">
587
  <span className="tool-name">{tool.name}</span>
588
+ {tool.output && <span className="checkmark">✓</span>}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
589
  </summary>
590
  <div className="tool-call-content">
591
  <details className="tool-section">
 
621
 
622
  <div className="input-container">
623
  <textarea
 
624
  value={input}
625
  onChange={(e) => setInput(e.target.value)}
626
  onKeyPress={handleKeyPress}