feat: Add GPSR safety info translation and remove pre-order cutting button functionality.

This commit is contained in:
sebseb7
2025-12-19 12:46:49 +01:00
parent dbd5df28f8
commit 0ccb00db32
3 changed files with 369 additions and 356 deletions

View File

@@ -190,8 +190,8 @@ class AddToCartButton extends Component {
},
}}
>
{this.props.steckling ?
(this.props.t ? this.props.t('cart.preorderCutting') : "Als Steckling vorbestellen") :
{/*this.props.steckling ?
(this.props.t ? this.props.t('cart.preorderCutting') : "Als Steckling vorbestellen") : */
(this.props.t ? this.props.t('cart.addToCart') : "In den Korb")}
</Button>
);
@@ -342,8 +342,8 @@ class AddToCartButton extends Component {
},
}}
>
{this.props.steckling ?
(this.props.t ? this.props.t('cart.preorderCutting') : "Als Steckling vorbestellen") :
{/*this.props.steckling ?
(this.props.t ? this.props.t('cart.preorderCutting') : "Als Steckling vorbestellen") :*/
(this.props.t ? this.props.t('cart.addToCart') : "In den Korb")}
</Button>
);

View File

@@ -71,11 +71,11 @@ class ProductDetailPage extends Component {
// Initialize komponenten from cached product data
const komponenten = [];
if(cachedData.product.komponenten) {
for(const komponent of cachedData.product.komponenten.split(",")) {
if (cachedData.product.komponenten) {
for (const komponent of cachedData.product.komponenten.split(",")) {
// Handle both "x" and "×" as separators
const [id, count] = komponent.split(/[x×]/);
komponenten.push({id: id.trim(), count: count.trim()});
komponenten.push({ id: id.trim(), count: count.trim() });
}
}
@@ -123,11 +123,11 @@ class ProductDetailPage extends Component {
// Initialize komponenten from partial product data if available
const komponenten = [];
if(partialProduct.komponenten) {
for(const komponent of partialProduct.komponenten.split(",")) {
if (partialProduct.komponenten) {
for (const komponent of partialProduct.komponenten.split(",")) {
// Handle both "x" and "×" as separators
const [id, count] = komponent.split(/[x×]/);
komponenten.push({id: id.trim(), count: count.trim()});
komponenten.push({ id: id.trim(), count: count.trim() });
}
}
@@ -222,7 +222,7 @@ class ProductDetailPage extends Component {
}
if (this.state.komponenten.length > 0 && !this.state.komponentenLoaded) {
for(const komponent of this.state.komponenten) {
for (const komponent of this.state.komponenten) {
this.loadKomponent(komponent.id, komponent.count);
}
}
@@ -403,7 +403,7 @@ class ProductDetailPage extends Component {
window.socketManager.emit(
"getProductView",
{ articleId: id, language: currentLanguage, requestTranslation: currentLanguage === "de" ? false : true},
{ articleId: id, language: currentLanguage, requestTranslation: currentLanguage === "de" ? false : true },
(res) => {
if (res.success) {
// Use translated product if available, otherwise use original product
@@ -592,7 +592,7 @@ class ProductDetailPage extends Component {
window.socketManager.emit(
"getProductView",
{ seoName: this.props.seoName, language: currentLanguage, requestTranslation: currentLanguage === "de" ? false : true},
{ seoName: this.props.seoName, language: currentLanguage, requestTranslation: currentLanguage === "de" ? false : true },
(res) => {
if (res.success) {
// Use translated product if available, otherwise use original product
@@ -618,11 +618,11 @@ class ProductDetailPage extends Component {
}
const komponenten = [];
if(productData.komponenten) {
for(const komponent of productData.komponenten.split(",")) {
if (productData.komponenten) {
for (const komponent of productData.komponenten.split(",")) {
// Handle both "x" and "×" as separators
const [id, count] = komponent.split(/[x×]/);
komponenten.push({id: id.trim(), count: count.trim()});
komponenten.push({ id: id.trim(), count: count.trim() });
}
}
this.setState({
@@ -647,8 +647,8 @@ class ProductDetailPage extends Component {
console.warn('ProductDetailPage: setCurrentProduct prop is missing after fetch');
}
if(komponenten.length > 0) {
for(const komponent of komponenten) {
if (komponenten.length > 0) {
for (const komponent of komponenten) {
this.loadKomponent(komponent.id, komponent.count);
}
}
@@ -1087,7 +1087,7 @@ class ProductDetailPage extends Component {
}
render() {
const { product, loading, upgrading, error, attributeImages, isSteckling, attributes, komponentenLoaded, komponentenData, komponentenImages, totalKomponentenPrice, totalSavings, shareAnchorEl, sharePopperOpen, snackbarOpen, snackbarMessage, snackbarSeverity } =
const { product, loading, upgrading, error, attributeImages, /*isSteckling,*/ attributes, komponentenLoaded, komponentenData, komponentenImages, totalKomponentenPrice, totalSavings, shareAnchorEl, sharePopperOpen, snackbarOpen, snackbarMessage, snackbarSeverity } =
this.state;
// Debug alerts removed
@@ -1305,7 +1305,7 @@ class ProductDetailPage extends Component {
.map((attribute) => {
const key = attribute.kMerkmalWert;
return (
<Box key={key} sx={{ mb: 1,border: "1px solid #e0e0e0", borderRadius: 1 }}>
<Box key={key} sx={{ mb: 1, border: "1px solid #e0e0e0", borderRadius: 1 }}>
<CardMedia
component="img"
style={{ width: "72px", height: "98px" }}
@@ -1444,7 +1444,7 @@ class ProductDetailPage extends Component {
<Typography variant="body2" color="text.secondary">
{this.props.t ? this.props.t('product.inclVat', { vat: product.vat }) : `inkl. ${product.vat}% MwSt.`}
{product.cGrundEinheit && product.fGrundPreis && (
<>; {new Intl.NumberFormat('de-DE', {style: 'currency', currency: 'EUR'}).format(product.fGrundPreis)}/{product.cGrundEinheit}</>
<>; {new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(product.fGrundPreis)}/{product.cGrundEinheit}</>
)}
</Typography>
@@ -1500,7 +1500,7 @@ class ProductDetailPage extends Component {
alignItems: "flex-start",
}}
>
{isSteckling && product.available == 1 && (
{/*isSteckling && product.available == 1 && (
<Box
sx={{
display: "flex",
@@ -1534,7 +1534,7 @@ class ProductDetailPage extends Component {
{this.props.t ? this.props.t('product.pickupPrice') : 'Abholpreis: 19,90 € pro Steckling.'}
</Typography>
</Box>
)}
)*/}
<Box
sx={{
display: "flex",
@@ -1663,6 +1663,18 @@ class ProductDetailPage extends Component {
</Box>
) : null}
</Box>
{/* GPSR Information */}
{product.gpsr && (
<Box sx={{ mt: 3, pt: 2, borderTop: "1px solid #eee" }}>
<Typography variant="subtitle2" sx={{ fontSize: "0.75rem", fontWeight: "bold", mb: 0.5 }}>
{this.props.t ? this.props.t("product.gpsrSafetyInfo") : "GPSR Informationen zur Produktsicherheit:"}
</Typography>
<Typography variant="caption" component="div" sx={{ whiteSpace: "pre-wrap", color: "text.secondary" }}>
{product.gpsr}
</Typography>
</Box>
)}
</Box>
)}

View File

@@ -24,6 +24,7 @@ export default {
"youSave": "Sie sparen: {{amount}}",
"cheaperThanIndividual": "Günstiger als Einzelkauf",
"pickupPrice": "Abholpreis: 19,90 € pro Steckling.",
"gpsrSafetyInfo": "GPSR Informationen zur Produktsicherheit:",
"consistsOf": "Bestehend aus:",
"loadingComponentDetails": "{{index}}. Lädt Komponent-Details...",
"loadingProduct": "Produkt wird geladen...",