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

Function SensorInputText

app/src/components/EditAgent/SensorInputText.tsx:51–88  ·  view source on GitHub ↗
({
  value,
  onChange,
  textareaRef,
  className = '',
  placeholder = '',
  rows,
})

Source from the content-addressed store, hash-verified

49}
50
51const SensorInputText: React.FC<SensorInputTextProps> = ({
52 value,
53 onChange,
54 textareaRef,
55 className = '',
56 placeholder = '',
57 rows,
58}) => {
59 const overlayRef = React.useRef<HTMLDivElement>(null);
60
61 const handleScroll = (e: React.UIEvent<HTMLTextAreaElement>) => {
62 if (overlayRef.current) {
63 overlayRef.current.scrollTop = e.currentTarget.scrollTop;
64 overlayRef.current.scrollLeft = e.currentTarget.scrollLeft;
65 }
66 };
67
68 return (
69 <div className={`relative ${className}`}>
70 <div
71 ref={overlayRef}
72 className="absolute inset-0 p-4 font-mono text-sm text-transparent whitespace-pre-wrap pointer-events-none leading-relaxed overflow-hidden"
73 aria-hidden="true"
74 >
75 {highlightPrompt(value)}
76 </div>
77 <textarea
78 ref={textareaRef}
79 value={value}
80 onChange={(e) => onChange(e.target.value)}
81 onScroll={handleScroll}
82 rows={rows}
83 className="w-full h-full p-4 bg-transparent text-gray-900 caret-blue-500 border border-gray-300 rounded-lg font-mono text-sm resize-none focus:ring-2 focus:ring-blue-500 leading-relaxed"
84 placeholder={placeholder}
85 />
86 </div>
87 );
88};
89
90export default SensorInputText;

Callers

nothing calls this directly

Calls 1

highlightPromptFunction · 0.85

Tested by

no test coverage detected