|
|
@@ -1,10 +1,10 @@ |
|
|
|
import React, {useEffect, useState, useContext} from 'react';
|
|
|
|
import intl from 'react-intl-universal';
|
|
|
|
import React, { useEffect, useState, useContext } from "react";
|
|
|
|
import intl from "react-intl-universal";
|
|
|
|
import locales from "./locales/locales";
|
|
|
|
import './App.css';
|
|
|
|
import {useAppSelector} from "./store/hooks";
|
|
|
|
import {selectChangeLangAndCss} from "./store/ChangeLangAndCss";
|
|
|
|
import {createBrowserRouter, RouterProvider,} from "react-router-dom";
|
|
|
|
import "./App.css";
|
|
|
|
import { useAppSelector } from "./store/hooks";
|
|
|
|
import { selectChangeLangAndCss } from "./store/ChangeLangAndCss";
|
|
|
|
import { createBrowserRouter, RouterProvider } from "react-router-dom";
|
|
|
|
|
|
|
|
import ErrorPage from "./page/ErrorPage";
|
|
|
|
import MainP from "./page/MainP/MainP";
|
|
|
@@ -12,12 +12,12 @@ import MainE from "./page/MainE/MainE"; |
|
|
|
import MainQ from "./page/MainQ/MainQ";
|
|
|
|
import SwitchAll from "./page/AutoSwitch/SwitchAll";
|
|
|
|
import SwitchLine from "./page/AutoSwitch/SwitchLine";
|
|
|
|
import {MyObservable} from "./context/MyObservable";
|
|
|
|
import {Observable} from "@babylonjs/core";
|
|
|
|
import {selectGlassStatus} from "./store/ProductionMonitoringEntity";
|
|
|
|
import { MyObservable } from "./context/MyObservable";
|
|
|
|
import { Observable } from "@babylonjs/core";
|
|
|
|
import { selectGlassStatus } from "./store/ProductionMonitoringEntity";
|
|
|
|
import TestPage from "./page/TestPage";
|
|
|
|
import LDPage from "./page/LDPage"
|
|
|
|
import LinePage from './page/LinePage';
|
|
|
|
import LDPage from "./page/LDPage";
|
|
|
|
import LinePage from "./page/LinePage";
|
|
|
|
|
|
|
|
// const LOCALES_LIST = [
|
|
|
|
// {
|
|
|
@@ -33,70 +33,72 @@ import LinePage from './page/LinePage'; |
|
|
|
const onGlassObservable = new Observable();
|
|
|
|
|
|
|
|
function App() {
|
|
|
|
const thisLineGlassStatus = useAppSelector(selectGlassStatus)
|
|
|
|
onGlassObservable.notifyObservers(thisLineGlassStatus)
|
|
|
|
const thisLineGlassStatus = useAppSelector(selectGlassStatus);
|
|
|
|
onGlassObservable.notifyObservers(thisLineGlassStatus);
|
|
|
|
|
|
|
|
const Locale = useAppSelector(selectChangeLangAndCss).Locale;
|
|
|
|
|
|
|
|
const setCurrentLocale = (currentLocale: string) => {
|
|
|
|
intl.init({
|
|
|
|
currentLocale,
|
|
|
|
locales: locales,
|
|
|
|
}).then(() => {
|
|
|
|
console.log('Language Changed to ' + currentLocale);
|
|
|
|
});
|
|
|
|
intl
|
|
|
|
.init({
|
|
|
|
currentLocale,
|
|
|
|
locales: locales,
|
|
|
|
})
|
|
|
|
.then(() => {
|
|
|
|
console.log("Language Changed to " + currentLocale);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
setCurrentLocale(Locale);
|
|
|
|
|
|
|
|
const router = createBrowserRouter([
|
|
|
|
{
|
|
|
|
path: "/",
|
|
|
|
element: <MainP/>,
|
|
|
|
errorElement: <ErrorPage/>
|
|
|
|
path: "/:LineID?",
|
|
|
|
element: <LinePage />,
|
|
|
|
errorElement: <ErrorPage />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/P",
|
|
|
|
element: <MainP/>,
|
|
|
|
errorElement: <ErrorPage/>
|
|
|
|
element: <MainP />,
|
|
|
|
errorElement: <ErrorPage />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/Q",
|
|
|
|
element: <MainQ/>,
|
|
|
|
errorElement: <ErrorPage/>
|
|
|
|
element: <MainQ />,
|
|
|
|
errorElement: <ErrorPage />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/E/:LineID?",
|
|
|
|
element: <MainE/>,
|
|
|
|
errorElement: <ErrorPage/>
|
|
|
|
element: <MainE />,
|
|
|
|
errorElement: <ErrorPage />,
|
|
|
|
},
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
{
|
|
|
|
path: "/SA",
|
|
|
|
element: <SwitchAll/>,
|
|
|
|
errorElement: <ErrorPage/>
|
|
|
|
element: <SwitchAll />,
|
|
|
|
errorElement: <ErrorPage />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/SL/:LineID?",
|
|
|
|
element: <SwitchLine/>,
|
|
|
|
errorElement: <ErrorPage/>
|
|
|
|
element: <SwitchLine />,
|
|
|
|
errorElement: <ErrorPage />,
|
|
|
|
},
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
{
|
|
|
|
path: "/TP/:LineID?",
|
|
|
|
element: <TestPage/>,
|
|
|
|
errorElement: <ErrorPage/>
|
|
|
|
element: <TestPage />,
|
|
|
|
errorElement: <ErrorPage />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/LD",
|
|
|
|
element: <LDPage/>,
|
|
|
|
errorElement: <ErrorPage/>
|
|
|
|
element: <LDPage />,
|
|
|
|
errorElement: <ErrorPage />,
|
|
|
|
},
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
{
|
|
|
|
path: "/LP/:LineID?",
|
|
|
|
element: <LinePage/>,
|
|
|
|
errorElement: <ErrorPage/>
|
|
|
|
element: <LinePage />,
|
|
|
|
errorElement: <ErrorPage />,
|
|
|
|
},
|
|
|
|
// {
|
|
|
|
// path: "/TP/:LineID?",
|
|
|
@@ -104,11 +106,20 @@ function App() { |
|
|
|
// errorElement: <ErrorPage/>
|
|
|
|
// },
|
|
|
|
]);
|
|
|
|
useEffect(() => {
|
|
|
|
const timerId = setInterval(() => {
|
|
|
|
window.location.reload();
|
|
|
|
}, 43200000);
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
clearInterval(timerId);
|
|
|
|
};
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<MyObservable.Provider value={onGlassObservable}>
|
|
|
|
<div className="background">
|
|
|
|
<RouterProvider router={router}/>
|
|
|
|
<RouterProvider router={router} />
|
|
|
|
</div>
|
|
|
|
</MyObservable.Provider>
|
|
|
|
);
|
|
|
|