feat: Add new virtual categories 'bald' and 'neu', update category handling in renderApp, and enhance translations across multiple locales
This commit is contained in:
@@ -542,14 +542,23 @@ const renderApp = async (categoryData, socket) => {
|
|||||||
let categoryPagesRendered = 0;
|
let categoryPagesRendered = 0;
|
||||||
let categoriesWithProducts = 0;
|
let categoriesWithProducts = 0;
|
||||||
|
|
||||||
const allCategoriesPlusNeu = [...allCategories, {
|
const allCategoriesWithVirtual = [
|
||||||
id: "neu",
|
...allCategories,
|
||||||
name: "Neuheiten",
|
{
|
||||||
seoName: "neu",
|
id: "neu",
|
||||||
parentId: 209
|
name: "Neuheiten",
|
||||||
}];
|
seoName: "neu",
|
||||||
|
parentId: 209,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "bald",
|
||||||
|
name: "Demnächst",
|
||||||
|
seoName: "bald",
|
||||||
|
parentId: 209,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
for (const category of allCategoriesPlusNeu) {
|
for (const category of allCategoriesWithVirtual) {
|
||||||
// Skip categories without seoName
|
// Skip categories without seoName
|
||||||
if (!category.seoName) {
|
if (!category.seoName) {
|
||||||
console.log(
|
console.log(
|
||||||
|
|||||||
@@ -42,7 +42,10 @@ const fetchCategoryProducts = (socket, categoryId) => {
|
|||||||
"getCategoryProducts",
|
"getCategoryProducts",
|
||||||
{
|
{
|
||||||
full: true,
|
full: true,
|
||||||
categoryId: categoryId === "neu" ? "neu" : parseInt(categoryId),
|
categoryId:
|
||||||
|
categoryId === "neu" || categoryId === "bald"
|
||||||
|
? categoryId
|
||||||
|
: parseInt(categoryId),
|
||||||
language: 'de',
|
language: 'de',
|
||||||
requestTranslation: false
|
requestTranslation: false
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import AddIcon from "@mui/icons-material/Add";
|
|||||||
import RemoveIcon from "@mui/icons-material/Remove";
|
import RemoveIcon from "@mui/icons-material/Remove";
|
||||||
import ShoppingCartIcon from "@mui/icons-material/ShoppingCart";
|
import ShoppingCartIcon from "@mui/icons-material/ShoppingCart";
|
||||||
import DeleteIcon from "@mui/icons-material/Delete";
|
import DeleteIcon from "@mui/icons-material/Delete";
|
||||||
|
import NotificationsIcon from "@mui/icons-material/Notifications";
|
||||||
import { withI18n } from "../i18n/withTranslation.js";
|
import { withI18n } from "../i18n/withTranslation.js";
|
||||||
|
|
||||||
if (!Array.isArray(window.cart)) window.cart = [];
|
if (!Array.isArray(window.cart)) window.cart = [];
|
||||||
@@ -144,11 +145,18 @@ class AddToCartButton extends Component {
|
|||||||
fullWidth
|
fullWidth
|
||||||
variant="contained"
|
variant="contained"
|
||||||
size={size || "medium"}
|
size={size || "medium"}
|
||||||
|
startIcon={<NotificationsIcon />}
|
||||||
sx={{
|
sx={{
|
||||||
borderRadius: 2,
|
borderRadius: 2,
|
||||||
fontWeight: "bold",
|
fontWeight: "bold",
|
||||||
backgroundColor: "#ffeb3b",
|
backgroundColor: "#ffeb3b",
|
||||||
color: "#000000",
|
color: "#000000",
|
||||||
|
whiteSpace: "nowrap",
|
||||||
|
flexWrap: "nowrap",
|
||||||
|
"& .MuiButton-label": {
|
||||||
|
whiteSpace: "nowrap",
|
||||||
|
flexWrap: "nowrap",
|
||||||
|
},
|
||||||
"&:hover": {
|
"&:hover": {
|
||||||
backgroundColor: "#fdd835",
|
backgroundColor: "#fdd835",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -341,6 +341,9 @@ class Content extends Component {
|
|||||||
|
|
||||||
|
|
||||||
fetchCategoryData(categoryId) {
|
fetchCategoryData(categoryId) {
|
||||||
|
if (categoryId === 'bald') {
|
||||||
|
sessionStorage.setItem('filter_availability', '1');
|
||||||
|
}
|
||||||
const currentLanguage = this.props.languageContext?.currentLanguage || this.props.i18n?.language || 'de';
|
const currentLanguage = this.props.languageContext?.currentLanguage || this.props.i18n?.language || 'de';
|
||||||
const cachedData = getCachedCategoryData(categoryId, currentLanguage);
|
const cachedData = getCachedCategoryData(categoryId, currentLanguage);
|
||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
@@ -431,6 +434,18 @@ class Content extends Component {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error finding category name in tree:', err);
|
console.error('Error finding category name in tree:', err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!enhancedResponse.categoryName && !enhancedResponse.name) {
|
||||||
|
if (categoryId === 'neu') {
|
||||||
|
enhancedResponse.categoryName = this.props.t
|
||||||
|
? this.props.t('navigation.new')
|
||||||
|
: 'Neuheiten';
|
||||||
|
} else if (categoryId === 'bald') {
|
||||||
|
enhancedResponse.categoryName = this.props.t
|
||||||
|
? this.props.t('navigation.soon')
|
||||||
|
: 'Demnächst';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.processData(enhancedResponse);
|
this.processData(enhancedResponse);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import Collapse from "@mui/material/Collapse";
|
|||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import HomeIcon from "@mui/icons-material/Home";
|
import HomeIcon from "@mui/icons-material/Home";
|
||||||
import FiberNewIcon from '@mui/icons-material/FiberNew';
|
import FiberNewIcon from '@mui/icons-material/FiberNew';
|
||||||
|
import LocalShippingIcon from "@mui/icons-material/LocalShipping";
|
||||||
import SettingsIcon from "@mui/icons-material/Settings";
|
import SettingsIcon from "@mui/icons-material/Settings";
|
||||||
import MenuIcon from "@mui/icons-material/Menu";
|
import MenuIcon from "@mui/icons-material/Menu";
|
||||||
import CloseIcon from "@mui/icons-material/Close";
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
@@ -309,6 +310,62 @@ class CategoryList extends Component {
|
|||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
component={Link}
|
||||||
|
to="/Kategorie/bald"
|
||||||
|
color="inherit"
|
||||||
|
size="small"
|
||||||
|
aria-label={this.props.t ? this.props.t('navigation.soon') : 'Demnächst'}
|
||||||
|
onClick={isMobile ? this.handleMobileCategoryClick : undefined}
|
||||||
|
sx={{
|
||||||
|
fontSize: "0.75rem",
|
||||||
|
textTransform: "none",
|
||||||
|
whiteSpace: "nowrap",
|
||||||
|
opacity: 0.9,
|
||||||
|
mx: isMobile ? 0 : 0.5,
|
||||||
|
my: 0.25,
|
||||||
|
minWidth: isMobile ? "100%" : "auto",
|
||||||
|
borderRadius: 1,
|
||||||
|
justifyContent: isMobile ? "flex-start" : "center",
|
||||||
|
transition: "all 0.2s ease",
|
||||||
|
textShadow: "0 1px 2px rgba(0,0,0,0.3)",
|
||||||
|
position: "relative"
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<LocalShippingIcon sx={{
|
||||||
|
fontSize: "1rem",
|
||||||
|
mr: isMobile ? 1 : 0
|
||||||
|
}} />
|
||||||
|
{isMobile && (
|
||||||
|
<Box sx={{ position: "relative", display: "inline-block" }}>
|
||||||
|
<Box
|
||||||
|
className="bold-text"
|
||||||
|
sx={{
|
||||||
|
fontWeight: "bold",
|
||||||
|
color: "transparent",
|
||||||
|
position: "relative",
|
||||||
|
zIndex: 2,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{this.props.t ? this.props.t('navigation.soon') : 'Demnächst'}
|
||||||
|
</Box>
|
||||||
|
<Box
|
||||||
|
className="thin-text"
|
||||||
|
sx={{
|
||||||
|
fontWeight: "400",
|
||||||
|
color: "inherit",
|
||||||
|
position: "absolute",
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
zIndex: 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{this.props.t ? this.props.t('navigation.soon') : 'Demnächst'}
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
|
||||||
{categories.length > 0 ? (
|
{categories.length > 0 ? (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "جديد",
|
||||||
|
"soon": "قريباً",
|
||||||
"home": "الرئيسية",
|
"home": "الرئيسية",
|
||||||
"aktionen": "العروض",
|
"aktionen": "العروض",
|
||||||
"filiale": "الفرع",
|
"filiale": "الفرع",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "Нови",
|
||||||
|
"soon": "Очаквайте скоро",
|
||||||
"home": "Начало",
|
"home": "Начало",
|
||||||
"aktionen": "Промоции",
|
"aktionen": "Промоции",
|
||||||
"filiale": "Клон",
|
"filiale": "Клон",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "Novinky",
|
||||||
|
"soon": "Již brzy",
|
||||||
"home": "Domů",
|
"home": "Domů",
|
||||||
"aktionen": "Akce",
|
"aktionen": "Akce",
|
||||||
"filiale": "Pobočka",
|
"filiale": "Pobočka",
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
export default {
|
export default {
|
||||||
"home": "Startseite",
|
"home": "Startseite",
|
||||||
|
"new": "Neuheiten",
|
||||||
|
"soon": "Demnächst",
|
||||||
"aktionen": "Aktionen",
|
"aktionen": "Aktionen",
|
||||||
"filiale": "Filiale",
|
"filiale": "Filiale",
|
||||||
"categories": "Kategorien",
|
"categories": "Kategorien",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "Νέα",
|
||||||
|
"soon": "Σύντομα",
|
||||||
"home": "Αρχική",
|
"home": "Αρχική",
|
||||||
"aktionen": "Προσφορές",
|
"aktionen": "Προσφορές",
|
||||||
"filiale": "Κατάστημα",
|
"filiale": "Κατάστημα",
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
export default {
|
export default {
|
||||||
"home": "Home", // Startseite
|
"home": "Home", // Startseite
|
||||||
|
"new": "New arrivals", // Neuheiten
|
||||||
|
"soon": "Coming soon", // Demnächst
|
||||||
"aktionen": "Promotions", // Aktionen
|
"aktionen": "Promotions", // Aktionen
|
||||||
"filiale": "Branch", // Filiale
|
"filiale": "Branch", // Filiale
|
||||||
"categories": "Categories", // Kategorien
|
"categories": "Categories", // Kategorien
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "Novedades",
|
||||||
|
"soon": "Próximamente",
|
||||||
"home": "Inicio",
|
"home": "Inicio",
|
||||||
"aktionen": "Promociones",
|
"aktionen": "Promociones",
|
||||||
"filiale": "Sucursal",
|
"filiale": "Sucursal",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "Nouveautés",
|
||||||
|
"soon": "Bientôt",
|
||||||
"home": "Accueil",
|
"home": "Accueil",
|
||||||
"aktionen": "Promotions",
|
"aktionen": "Promotions",
|
||||||
"filiale": "Agence",
|
"filiale": "Agence",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "Novi",
|
||||||
|
"soon": "Uskoro",
|
||||||
"home": "Početna",
|
"home": "Početna",
|
||||||
"aktionen": "Promocije",
|
"aktionen": "Promocije",
|
||||||
"filiale": "Podružnica",
|
"filiale": "Podružnica",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "Újdonságok",
|
||||||
|
"soon": "Hamarosan",
|
||||||
"home": "Kezdőlap",
|
"home": "Kezdőlap",
|
||||||
"aktionen": "Akciók",
|
"aktionen": "Akciók",
|
||||||
"filiale": "Fiók",
|
"filiale": "Fiók",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "Novità",
|
||||||
|
"soon": "In arrivo",
|
||||||
"home": "Home",
|
"home": "Home",
|
||||||
"aktionen": "Promozioni",
|
"aktionen": "Promozioni",
|
||||||
"filiale": "Filiale",
|
"filiale": "Filiale",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "Nowości",
|
||||||
|
"soon": "Wkrótce",
|
||||||
"home": "Strona główna",
|
"home": "Strona główna",
|
||||||
"aktionen": "Promocje",
|
"aktionen": "Promocje",
|
||||||
"filiale": "Oddział",
|
"filiale": "Oddział",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "Noutăți",
|
||||||
|
"soon": "În curând",
|
||||||
"home": "Acasă",
|
"home": "Acasă",
|
||||||
"aktionen": "Promoții",
|
"aktionen": "Promoții",
|
||||||
"filiale": "Sucursală",
|
"filiale": "Sucursală",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "Новинки",
|
||||||
|
"soon": "Скоро",
|
||||||
"home": "Главная",
|
"home": "Главная",
|
||||||
"aktionen": "Акции",
|
"aktionen": "Акции",
|
||||||
"filiale": "Филиал",
|
"filiale": "Филиал",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "Novinky",
|
||||||
|
"soon": "Čoskoro",
|
||||||
"home": "Domov",
|
"home": "Domov",
|
||||||
"aktionen": "Akcie",
|
"aktionen": "Akcie",
|
||||||
"filiale": "Pobočka",
|
"filiale": "Pobočka",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "Novosti",
|
||||||
|
"soon": "Kmalu",
|
||||||
"home": "Domov",
|
"home": "Domov",
|
||||||
"aktionen": "Promocije",
|
"aktionen": "Promocije",
|
||||||
"filiale": "Poslovalnica",
|
"filiale": "Poslovalnica",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "Të reja",
|
||||||
|
"soon": "Së shpejti",
|
||||||
"home": "Kreu",
|
"home": "Kreu",
|
||||||
"aktionen": "Promocione",
|
"aktionen": "Promocione",
|
||||||
"filiale": "Degë",
|
"filiale": "Degë",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "Нови",
|
||||||
|
"soon": "Ускоро",
|
||||||
"home": "Početna",
|
"home": "Početna",
|
||||||
"aktionen": "Promocije",
|
"aktionen": "Promocije",
|
||||||
"filiale": "Filijala",
|
"filiale": "Filijala",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "Nyheter",
|
||||||
|
"soon": "Snart",
|
||||||
"home": "Hem",
|
"home": "Hem",
|
||||||
"aktionen": "Kampanjer",
|
"aktionen": "Kampanjer",
|
||||||
"filiale": "Filial",
|
"filiale": "Filial",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "Yeniler",
|
||||||
|
"soon": "Yakında",
|
||||||
"home": "Ana Sayfa",
|
"home": "Ana Sayfa",
|
||||||
"aktionen": "Promosyonlar",
|
"aktionen": "Promosyonlar",
|
||||||
"filiale": "Şube",
|
"filiale": "Şube",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "Новинки",
|
||||||
|
"soon": "Незабаром",
|
||||||
"home": "Головна",
|
"home": "Головна",
|
||||||
"aktionen": "Акції",
|
"aktionen": "Акції",
|
||||||
"filiale": "Філія",
|
"filiale": "Філія",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
"new": "新品",
|
||||||
|
"soon": "即将上架",
|
||||||
"home": "首页",
|
"home": "首页",
|
||||||
"aktionen": "促销活动",
|
"aktionen": "促销活动",
|
||||||
"filiale": "分店",
|
"filiale": "分店",
|
||||||
|
|||||||
Reference in New Issue
Block a user