feat: interpretation log

This commit is contained in:
karishmas6
2024-09-27 23:39:30 +05:30
parent 5be7fe6bad
commit 2d886a8259

View File

@@ -25,7 +25,7 @@ interface InterpretationLogProps {
setIsOpen: (isOpen: boolean) => void; setIsOpen: (isOpen: boolean) => void;
} }
export const InterpretationLog: React.FC<InterpretationLogProps> = ({ isOpen, setIsOpen }) => { export const InterpretationLog: React.FC<InterpretationLogProps> = ({ isOpen, setIsOpen }) => {
const [log, setLog] = useState<string>(''); const [log, setLog] = useState<string>('');
const [selectedOption, setSelectedOption] = useState<string>('10'); const [selectedOption, setSelectedOption] = useState<string>('10');
const [customValue, setCustomValue] = useState(''); const [customValue, setCustomValue] = useState('');
@@ -66,12 +66,12 @@ export const InterpretationLog: React.FC<InterpretationLogProps> = ({ isOpen, se
setLog((prevState) => setLog((prevState) =>
prevState + '\n' + '---------- Serializable output data received ----------' + '\n' prevState + '\n' + '---------- Serializable output data received ----------' + '\n'
+ JSON.stringify(data, null, 2) + '\n' + '--------------------------------------------------'); + JSON.stringify(data, null, 2) + '\n' + '--------------------------------------------------');
// Set table data // Set table data
if (Array.isArray(data)) { if (Array.isArray(data)) {
setTableData(data); setTableData(data);
} }
scrollLogToBottom(); scrollLogToBottom();
}, [log, scrollLogToBottom]); }, [log, scrollLogToBottom]);
@@ -104,7 +104,7 @@ export const InterpretationLog: React.FC<InterpretationLogProps> = ({ isOpen, se
// Extract columns dynamically from the first item of tableData // Extract columns dynamically from the first item of tableData
const columns = tableData.length > 0 ? Object.keys(tableData[0]) : []; const columns = tableData.length > 0 ? Object.keys(tableData[0]) : [];
return ( return (
<div> <div>
<button <button