From 43b7a7d463761cdd6b09f282148005eb09e943e9 Mon Sep 17 00:00:00 2001 From: Rohit Date: Wed, 30 Apr 2025 20:59:23 +0530 Subject: [PATCH] feat: rm view mode logic --- src/components/run/RunContent.tsx | 222 ++++-------------------------- 1 file changed, 26 insertions(+), 196 deletions(-) diff --git a/src/components/run/RunContent.tsx b/src/components/run/RunContent.tsx index ccd314dd..c3166720 100644 --- a/src/components/run/RunContent.tsx +++ b/src/components/run/RunContent.tsx @@ -59,8 +59,6 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe const [expandedView, setExpandedView] = useState(null); - const [viewMode, setViewMode] = useState<'horizontal' | 'vertical'>('vertical'); - const [legacyData, setLegacyData] = useState([]); const [legacyColumns, setLegacyColumns] = useState([]); const [isLegacyData, setIsLegacyData] = useState(false); @@ -754,93 +752,34 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe {hasData && ( {isLegacyData && ( - viewMode === 'vertical' ? ( - renderDataTable( - legacyData, - legacyColumns, - t('run_content.captured_data.title'), - 'data.csv', - 'data.json' - ) - ) : ( - - - {renderDataCard( - legacyData, - legacyColumns, - t('run_content.captured_data.title'), - 'legacy', - 'data.csv', - 'data.json' - )} - - + renderDataTable( + legacyData, + legacyColumns, + t('run_content.captured_data.title'), + 'data.csv', + 'data.json' ) )} {!isLegacyData && ( - viewMode === 'vertical' ? ( - <> - {renderDataTable( - schemaData, - schemaColumns, - t('run_content.captured_data.schema_title'), - 'schema_data.csv', - 'schema_data.json' - )} + <> + {renderDataTable( + schemaData, + schemaColumns, + t('run_content.captured_data.schema_title'), + 'schema_data.csv', + 'schema_data.json' + )} - {listData.length > 0 && renderDataTable( - [], - [], - t('run_content.captured_data.list_title'), - 'list_data.csv', - 'list_data.json', - true - )} - - ) : ( - - {(() => { - const dataCategoriesCount = [ - schemaData.length > 0, - listData.length > 0, - ].filter(Boolean).length; - - const columnWidth = dataCategoriesCount === 1 ? 12 : dataCategoriesCount === 2 ? 6 : 4; - - return ( - <> - {schemaData.length > 0 && ( - - {renderDataCard( - schemaData, - schemaColumns, - t('run_content.captured_data.schema_title'), - 'schema', - 'schema_data.csv', - 'schema_data.json' - )} - - )} - - {listData.length > 0 && ( - - {renderDataCard( - [], - [], - t('run_content.captured_data.list_title'), - 'list', - 'list_data.csv', - 'list_data.json', - true - )} - - )} - - ); - })()} - - ) + {listData.length > 0 && renderDataTable( + [], + [], + t('run_content.captured_data.list_title'), + 'list_data.csv', + 'list_data.json', + true + )} + )} {renderExpandedView('schema')} @@ -850,120 +789,11 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe )} - {hasScreenshots && ( + {/* {hasScreenshots && ( <> - {viewMode === 'vertical' ? ( - <> - {Object.keys(row.binaryOutput).map((key, index) => { - try { - const imageUrl = row.binaryOutput[key]; - return ( - - } - aria-controls={`screenshot-${key}-content`} - id={`screenshot-${key}-header`} - > - - - - Screenshot {index + 1} - - - - - - - - - - - {`Screenshot - - - - ); - } catch (e) { - console.log(e); - return ( - - {key}: {t('run_content.captured_screenshot.render_failed')} - - ); - } - })} - - ) : ( - - {Object.keys(row.binaryOutput).map((key) => { - try { - const imageUrl = row.binaryOutput[key]; - return ( - - - } - title={`Screenshot ${key}`} - action={ - - - - } - /> - - - {`Screenshot - - - - - ); - } catch (e) { - console.log(e); - return ( - - - {key}: {t('run_content.captured_screenshot.render_failed')} - - - ); - } - })} - - )} + {renderPaginatedScreenshots()} - )} + )} */}