This commit is contained in:
sebseb7
2025-11-22 10:12:41 +01:00
parent 10d60d5827
commit a08c90a521
26 changed files with 356 additions and 143 deletions

View File

@@ -162,6 +162,30 @@ class GrowTentKonfigurator extends Component {
) {
this.saveStateToWindow();
}
// Check if language changed and reload category data
const currentLanguage = this.props.languageContext?.currentLanguage || this.props.i18n?.language;
const prevLanguage = prevProps.languageContext?.currentLanguage || prevProps.i18n?.language;
if (currentLanguage && prevLanguage && currentLanguage !== prevLanguage) {
console.log(`Language changed from ${prevLanguage} to ${currentLanguage} - reloading configurator data`);
// Reset category load status to trigger loading state UI
this.setState({
categoryLoadStatus: {
"Zelte": false,
"Lampen": false,
"Abluft-sets": false,
"Set-zubehoer": false
}
}, () => {
// Fetch data for all categories with new language
this.fetchCategoryData("Zelte");
this.fetchCategoryData("Lampen");
this.fetchCategoryData("Abluft-sets");
this.fetchCategoryData("Set-zubehoer");
});
}
}
componentWillUnmount() {
@@ -462,11 +486,12 @@ class GrowTentKonfigurator extends Component {
// Helper function to generate coverage descriptions
getCoverageDescription(width, depth) {
const { t } = this.props;
const area = width * depth;
if (area <= 3600) return '1-2 Pflanzen'; // 60x60
if (area <= 6400) return '2-4 Pflanzen'; // 80x80
if (area <= 10000) return '4-6 Pflanzen'; // 100x100
return '3-6 Pflanzen'; // 120x60 and larger
if (area <= 3600) return t ? t('kitConfig.plants1to2') : '1-2 Pflanzen'; // 60x60
if (area <= 6400) return t ? t('kitConfig.plants2to4') : '2-4 Pflanzen'; // 80x80
if (area <= 10000) return t ? t('kitConfig.plants4to6') : '4-6 Pflanzen'; // 100x100
return t ? t('kitConfig.plants3to6') : '3-6 Pflanzen'; // 120x60 and larger
}
// Render tent image using working code from Product component