+ {/* Overview Tab */}
+ {reportTab === 'overview' && (
+
+ {/* Health Score Card */}
+
+
+
Overall Health
+
+ {testStatus.smart_status === 'passed' ? (
+
+ ) : testStatus.smart_status === 'failed' ? (
+
+ ) : (
+
+ )}
+
+ {testStatus.smart_status || 'Unknown'}
+
+
+
+
+
+
Temperature
+
+
+
+ {disk.temperature > 0 ? `${disk.temperature}°C` : 'N/A'}
+
+
+
+
+
+
Power On Time
+
+
+
+ {disk.power_on_hours ? `${disk.power_on_hours.toLocaleString()}h` : 'N/A'}
+
+
+
+
+
+ {/* Executive Summary */}
+
+
+
+ Executive Summary
+
+
+
+ {testStatus.smart_status === 'passed' ? (
+ <>
+ This disk is operating within normal parameters. All SMART attributes are within acceptable thresholds,
+ indicating good health. The disk has been powered on for approximately{' '}
+
+ {disk.power_on_hours ? `${Math.round(disk.power_on_hours / 24)} days` : 'an unknown period'}
+ {' '}
+ and is currently operating at{' '}
+ {disk.temperature || 'N/A'}°C.
+ {disk.reallocated_sectors === 0 && disk.pending_sectors === 0
+ ? ' No bad sectors have been detected.'
+ : disk.reallocated_sectors && disk.reallocated_sectors > 0
+ ? ` ${disk.reallocated_sectors} sectors have been reallocated, which may indicate early signs of wear.`
+ : ''}
+ >
+ ) : testStatus.smart_status === 'failed' ? (
+ <>
+ Warning: This disk has failed SMART health assessment.{' '}
+ One or more critical SMART attributes have exceeded their failure threshold.
+ It is strongly recommended to backup all data immediately and consider replacing this disk.
+ {disk.reallocated_sectors && disk.reallocated_sectors > 0
+ ? ` The disk has ${disk.reallocated_sectors} reallocated sectors, indicating physical media degradation.`
+ : ''}
+ >
+ ) : (
+ <>
+ The disk health status could not be fully determined. Some SMART attributes may be showing warning signs.
+ It is recommended to run a full SMART self-test and monitor the disk closely.
+ >
+ )}
+
+
+
+
+ {/* Key Metrics */}
+
+
Key Metrics
+
+
+
Model
+
{disk.model || 'Unknown'}
+
+
+
Serial
+
{disk.serial?.replace(/\\x[0-9a-fA-F]{2}/g, '') || 'Unknown'}
+
+
+
Capacity
+
{disk.size_formatted || 'Unknown'}
+
+
+
Power Cycles
+
{disk.power_cycles?.toLocaleString() || 'N/A'}
+
+
+
Reallocated Sectors
+
0 ? 'text-yellow-500' : ''}`}>
+ {disk.reallocated_sectors ?? 0}
+
+
+
+
Pending Sectors
+
0 ? 'text-yellow-500' : ''}`}>
+ {disk.pending_sectors ?? 0}
+
+
+
+
CRC Errors
+
0 ? 'text-yellow-500' : ''}`}>
+ {disk.crc_errors ?? 0}
+
+
+
+
Disk Type
+
+ {disk.name.startsWith('nvme') ? 'NVMe' : !disk.rotation_rate || disk.rotation_rate === 0 ? 'SSD' : 'HDD'}
+
+
+
+
+
+ )}
+
+ {/* Attributes Tab */}
+ {reportTab === 'attributes' && (
+
+
+
Understanding SMART Attributes
+
+ SMART (Self-Monitoring, Analysis and Reporting Technology) attributes are sensors built into hard drives and SSDs.
+ Each attribute has a current value, a worst recorded value, and a threshold. When the current value drops below the threshold,
+ the attribute is considered failed. Values typically decrease from 100 (or 200/253 on some drives) as the attribute degrades.
+
+
+
+ {testStatus.smart_data?.attributes && testStatus.smart_data.attributes.length > 0 ? (
+
+
+
ID
+
Attribute Name
+
Value
+
Worst
+
Threshold
+
Status
+
+
+ {testStatus.smart_data.attributes.map((attr) => (
+
+
{attr.id}
+
+
{attr.name.replace(/_/g, ' ')}
+
Raw: {attr.raw_value}
+
+
{attr.value}
+
{attr.worst}
+
{attr.threshold}
+
+ {attr.status === 'ok' ? (
+
+ ) : attr.status === 'warning' ? (
+
+ ) : (
+
+ )}
+
+
+ ))}
+
+
+ ) : (
+
+
+
No SMART attribute data available.
+
Run a SMART test to collect attribute data.
+
+ )}
+
+ )}
+
+ {/* History Tab */}
+ {reportTab === 'history' && (
+
+ {testStatus.last_test ? (
+
+
+
+ {testStatus.last_test.status === 'passed' ? (
+
+ ) : (
+
+ )}
+ Last Test Result
+
+
+ {testStatus.last_test.status}
+
+
+
+
+
Test Type
+
{testStatus.last_test.type}
+
+
+
Completed
+
{testStatus.last_test.timestamp}
+
+
+
+ ) : (
+
+
+
No test history available.
+
Run a SMART self-test to see results here.
+
+ )}
+
+
+
About Self-Tests
+
+
+ Short Test (~2 minutes): Performs a quick check of the disk's
+ basic functionality including read/seek tests on a small portion of the disk surface.
+
+
+ Extended Test (hours): Performs a comprehensive surface scan
+ of the entire disk. Duration depends on disk size - typically 1-2 hours per TB.
+
+
+
+
+ )}
+
+ {/* Recommendations Tab */}
+ {reportTab === 'recommendations' && (
+
+ {/* Status-based recommendations */}
+ {testStatus.smart_status === 'passed' && (
+
+
+
+
+
Disk is Healthy
+
+ All SMART attributes are within normal ranges. Continue with regular monitoring.
+
+
+
+
+ )}
+
+ {testStatus.smart_status === 'failed' && (
+
+
+
+
+
Critical: Disk Replacement Recommended
+
+ This disk has failed SMART health assessment. Backup all data immediately and plan for disk replacement.
+
+
+
+
+ )}
+
+ {/* Conditional recommendations */}
+
+
Recommendations
+
+ {(disk.reallocated_sectors ?? 0) > 0 && (
+
+
+
+
+
Reallocated Sectors Detected
+
+ {disk.reallocated_sectors} sectors have been reallocated. This indicates the disk has found and
+ remapped bad sectors. Monitor this value - if it increases rapidly, consider replacing the disk.
+
+
+
+
+ )}
+
+ {(disk.pending_sectors ?? 0) > 0 && (
+
+
+
+
+
Pending Sectors Detected
+
+ {disk.pending_sectors} sectors are pending reallocation. These sectors may be unreadable.
+ Run an extended self-test to force reallocation attempts.
+
+
+
+
+ )}
+
+ {disk.temperature > 55 && (
+
+
+
+
+
Elevated Temperature
+
+ Current temperature ({disk.temperature}°C) is above optimal. Improve airflow or reduce disk activity.
+ Sustained high temperatures can reduce disk lifespan.
+
+
+
+
+ )}
+
+ {(disk.power_on_hours ?? 0) > 35000 && (
+
+
+
+
+
High Power-On Hours
+
+ This disk has been running for {Math.round((disk.power_on_hours ?? 0) / 8760)} years.
+ While still operational, consider planning for replacement as disks typically have a 3-5 year lifespan.
+
+
+
+
+ )}
+
+ {/* General best practices */}
+
+
Best Practices
+
+ -
+
+ Run a short SMART test monthly to catch early issues
+
+ -
+
+ Run an extended test quarterly for comprehensive verification
+
+ -
+
+ Maintain regular backups - SMART can detect some failures but not all
+
+ -
+
+ Keep disk temperatures below 50°C for optimal lifespan
+
+ -
+
+ Replace disks proactively after 4-5 years of heavy use
+
+
+
+
+
+ )}
+
+
+ {/* Report Footer */}
+