feat: Add prop-types dependency, implement currency context, and enhance pricing display in components

- Added `prop-types` for better prop validation in components.
- Introduced `CurrencyProvider` to manage currency context and preload exchange rates.
- Updated pricing logic in various components to support new price structure and display currency.
- Refactored BOMSummary, MotorStep, and PowerSupplyStep to utilize new pricing methods and improve user experience.
- Enhanced export utilities to format prices correctly in markdown and Excel outputs.
- Updated hardware and component data structures to include detailed pricing information.
This commit is contained in:
MunchDev-oss
2026-01-10 03:04:28 -05:00
parent 86f0acc26b
commit aba0964a59
40 changed files with 3519 additions and 1843 deletions

View File

@@ -0,0 +1,40 @@
import PropTypes from 'prop-types';
/**
* Image component with error handling fallback
*/
export default function ImageWithFallback({
src,
alt,
className = '',
containerClassName = '',
onError
}) {
const handleError = (e) => {
e.target.style.display = 'none';
if (onError) {
onError(e);
}
};
if (!src) return null;
return (
<div className={containerClassName}>
<img
src={src}
alt={alt}
className={className}
onError={handleError}
/>
</div>
);
}
ImageWithFallback.propTypes = {
src: PropTypes.string,
alt: PropTypes.string.isRequired,
className: PropTypes.string,
containerClassName: PropTypes.string,
onError: PropTypes.func,
};