feat: implement kiosk mode functionality and update UI elements accordingly
This commit is contained in:
BIN
public/assets/images/cutlings2.avif
Normal file
BIN
public/assets/images/cutlings2.avif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
@@ -291,8 +291,22 @@ const MainPageLayout = () => {
|
|||||||
const currentPath = location.pathname;
|
const currentPath = location.pathname;
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [starHovered, setStarHovered] = React.useState(false);
|
const [starHovered, setStarHovered] = React.useState(false);
|
||||||
|
|
||||||
|
// State to track kiosk mode
|
||||||
|
const [isKiosk, setIsKiosk] = React.useState(() => window.growheadskiosk === true);
|
||||||
|
|
||||||
|
// Listen for the custom event
|
||||||
|
React.useEffect(() => {
|
||||||
|
const handleKioskChange = () => {
|
||||||
|
setIsKiosk(window.growheadskiosk === true);
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('growheadskiosk-change', handleKioskChange);
|
||||||
|
return () => window.removeEventListener('growheadskiosk-change', handleKioskChange);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const translatedContent = {
|
const translatedContent = {
|
||||||
buildYourSet: t('sections.buildYourSet'),
|
buildYourSet: isKiosk ? 'Schau in den Stecklingskatalog' : t('sections.buildYourSet'),
|
||||||
selectSeedRate: t('sections.selectSeedRate'),
|
selectSeedRate: t('sections.selectSeedRate'),
|
||||||
outdoorSeason: t('sections.outdoorSeason')
|
outdoorSeason: t('sections.outdoorSeason')
|
||||||
};
|
};
|
||||||
@@ -317,7 +331,7 @@ const MainPageLayout = () => {
|
|||||||
const allContentBoxes = {
|
const allContentBoxes = {
|
||||||
home: [
|
home: [
|
||||||
{ title: t('sections.seeds'), image: "/assets/images/seeds.avif", bgcolor: "#e1f0d3", link: "/Kategorie/Seeds" },
|
{ title: t('sections.seeds'), image: "/assets/images/seeds.avif", bgcolor: "#e1f0d3", link: "/Kategorie/Seeds" },
|
||||||
{ title: t('sections.konfigurator'), image: "/assets/images/konfigurator.avif", bgcolor: "#e8f5d6", link: "/Konfigurator" }
|
{ title: isKiosk ? 'Stecklingskatalog' : t('sections.konfigurator'), image: isKiosk ? "/assets/images/cutlings2.avif" : "/assets/images/konfigurator.avif", bgcolor: "#e8f5d6", link: isKiosk ? "https://cloneheads.de" : "/Konfigurator" }
|
||||||
],
|
],
|
||||||
aktionen: [
|
aktionen: [
|
||||||
{ title: t('sections.oilPress'), image: "/assets/images/presse.jpg", bgcolor: "#e1f0d3", link: "/Artikel/Graveda-10t-presse-tagesmiete-inkl-prepress-vorpressform" },
|
{ title: t('sections.oilPress'), image: "/assets/images/presse.jpg", bgcolor: "#e1f0d3", link: "/Artikel/Graveda-10t-presse-tagesmiete-inkl-prepress-vorpressform" },
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ class CategoryList extends Component {
|
|||||||
aria-label="Zur Startseite"
|
aria-label="Zur Startseite"
|
||||||
onClick={isMobile ? this.handleMobileCategoryClick : undefined}
|
onClick={isMobile ? this.handleMobileCategoryClick : undefined}
|
||||||
sx={{
|
sx={{
|
||||||
fontSize: "0.75rem",
|
fontSize: "0.85rem",
|
||||||
textTransform: "none",
|
textTransform: "none",
|
||||||
whiteSpace: "nowrap",
|
whiteSpace: "nowrap",
|
||||||
opacity: 0.9,
|
opacity: 0.9,
|
||||||
@@ -275,7 +275,7 @@ class CategoryList extends Component {
|
|||||||
aria-label="Neuheiten"
|
aria-label="Neuheiten"
|
||||||
onClick={isMobile ? this.handleMobileCategoryClick : undefined}
|
onClick={isMobile ? this.handleMobileCategoryClick : undefined}
|
||||||
sx={{
|
sx={{
|
||||||
fontSize: "0.75rem",
|
fontSize: "0.85rem",
|
||||||
textTransform: "none",
|
textTransform: "none",
|
||||||
whiteSpace: "nowrap",
|
whiteSpace: "nowrap",
|
||||||
opacity: 0.9,
|
opacity: 0.9,
|
||||||
@@ -353,7 +353,7 @@ class CategoryList extends Component {
|
|||||||
aria-label={this.props.t ? this.props.t('navigation.soon') : 'Demnächst'}
|
aria-label={this.props.t ? this.props.t('navigation.soon') : 'Demnächst'}
|
||||||
onClick={isMobile ? this.handleMobileCategoryClick : undefined}
|
onClick={isMobile ? this.handleMobileCategoryClick : undefined}
|
||||||
sx={{
|
sx={{
|
||||||
fontSize: "0.75rem",
|
fontSize: "0.85rem",
|
||||||
textTransform: "none",
|
textTransform: "none",
|
||||||
whiteSpace: "nowrap",
|
whiteSpace: "nowrap",
|
||||||
opacity: 0.9,
|
opacity: 0.9,
|
||||||
@@ -435,7 +435,7 @@ class CategoryList extends Component {
|
|||||||
size="small"
|
size="small"
|
||||||
onClick={isMobile ? this.handleMobileCategoryClick : undefined}
|
onClick={isMobile ? this.handleMobileCategoryClick : undefined}
|
||||||
sx={{
|
sx={{
|
||||||
fontSize: "0.75rem",
|
fontSize: "0.85rem",
|
||||||
textTransform: "none",
|
textTransform: "none",
|
||||||
whiteSpace: "nowrap",
|
whiteSpace: "nowrap",
|
||||||
opacity: 0.9,
|
opacity: 0.9,
|
||||||
@@ -506,7 +506,7 @@ class CategoryList extends Component {
|
|||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
height: "33px", // Match small button height
|
height: "33px", // Match small button height
|
||||||
px: 1,
|
px: 1,
|
||||||
fontSize: "0.75rem",
|
fontSize: "0.85rem",
|
||||||
opacity: 0.9,
|
opacity: 0.9,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -522,7 +522,7 @@ class CategoryList extends Component {
|
|||||||
aria-label={this.props.t ? this.props.t('navigation.konfiguratorAria') : 'Zum Konfigurator'}
|
aria-label={this.props.t ? this.props.t('navigation.konfiguratorAria') : 'Zum Konfigurator'}
|
||||||
onClick={isMobile ? this.handleMobileCategoryClick : undefined}
|
onClick={isMobile ? this.handleMobileCategoryClick : undefined}
|
||||||
sx={{
|
sx={{
|
||||||
fontSize: "0.75rem",
|
fontSize: "0.85rem",
|
||||||
textTransform: "none",
|
textTransform: "none",
|
||||||
whiteSpace: "nowrap",
|
whiteSpace: "nowrap",
|
||||||
opacity: 0.9,
|
opacity: 0.9,
|
||||||
|
|||||||
@@ -153,6 +153,12 @@ class SocketManager {
|
|||||||
auth: this._buildSocketAuth()
|
auth: this._buildSocketAuth()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this._socket.on('kiosk', () => {
|
||||||
|
window.growheadskiosk = true;
|
||||||
|
window.dispatchEvent(new Event('growheadskiosk-change'));
|
||||||
|
console.warn('Kiosk mode enabled via socket event');
|
||||||
|
});
|
||||||
|
|
||||||
// Always refresh auth data before reconnect attempts.
|
// Always refresh auth data before reconnect attempts.
|
||||||
if (this._socket.io && this._socket.io.on) {
|
if (this._socket.io && this._socket.io.on) {
|
||||||
this._socket.io.on('reconnect_attempt', () => {
|
this._socket.io.on('reconnect_attempt', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user