output 8.3 KB

1
  1. import React,{Component}from"react";import Modularity from"modularity-front";import"./App.css";import"@trendmicro/react-sidenav/dist/react-sidenav.css";import logo from"./logo.svg";import{Bat}from"./components/bat";import{Form}from"./components/form";import{Soot}from"./components/footer";import{Paginator}from"./components/pagination";import{Row,Col,Pagination}from"react-materialize";import NavbarModule from"./Modules/NavbarModule";import Product from"./Modules/Product";import ProductList from"./Modules/ProductView";import ProductService from"./Services/ProductService";import FileUploader from"./Modules/FileUploader";import FormModule from"./Modules/Form";import CardModule from"./Modules/Card";import CarouselPanelModule from"./Modules/CarouselPanel";import CarouselModule from"./Modules/Carousel";import TableModule from"./Modules/Table";import PaginationModule from"./Modules/Pagination";import FooterModule from"./Modules/Footer";import SideNavModule from"./Modules/SideNav";import HorizontalContainer from"./Modules/HorizontalContainer";import ViewModule from"./Modules/View";import ListModule from"./HigherModules/ListModule";import TableData from"./HigherModules/TableData";import UserService from"./Services/UserService";import CrudService from"./Services/CrudService";import LoadedModulesService from"./Services/LoadedModulesService";import CrudListPackage from"./Packages/CrudListPackage";import UserPackage from"./Packages/UserPackage";import VerticalNavbarPackage from"./Packages/VerticalNavbarPackage";import MiniCartModule from"./Modules/mini-cart";import Vertical from"./Modules/VerticalNavbar";import ParallaxModule from"./Modules/parallax";import ModalModule from"./Modules/Modal";import SearchBarModule from"./Modules/searchbar.js";import CustomTable from"./Modules/CustomTable.js";import FullScreenContainer from"./Modules/FullScreenContainer.js";import PresentationModule from"./Packages/Tonersales/Presentation1";import ClientForm from"./Modules/ClientForm";import SearchBarPackage from"./Packages/Tonersales/SearchBarPackage";import CartPackage from"./Packages/Tonersales/CartPage";import FiltersPackage from"./Packages/FiltersPackage";import ChipModule from"./Modules/Chip";import HorizontalCard from"./Modules/HorizontalCard";import Import from"./Modules/Import";import ProductPresent from"./Modules/Product/Present";import GoogleMapModule from"./Modules/GoogleMap";import ProductPresentPackage from"./Packages/Tonersales/ProductPresentPackage";import PrinterPresentPackage from"./Packages/Tonersales/PrinterPresentPackage";import UserAccount from"./Packages/Tonersales/UserAccount";import OrderPackage from"./Packages/Tonersales/OrderPackage";import ContactPackage from"./Packages/Tonersales/ContactPackage";import FilterModule from"./Modules/FilterModule";import SiteScript from"./Environments/Frontend.js";import ViewOrder from"./HigherModules/ViewOrder";import TextEditor from"./Modules/TextEditor";let Core=Modularity.Systems.getCore();Modularity.Systems.addModule(ProductList),Modularity.Systems.addModule(Product),Modularity.Systems.addService(ProductService),Modularity.Systems.addService(LoadedModulesService),Modularity.Systems.addService(CrudService),Modularity.Systems.addService(UserService),Modularity.Systems.addModule(UserPackage),Modularity.Systems.addModule(FileUploader),Modularity.Systems.addModule(NavbarModule),Modularity.Systems.addModule(FormModule),Modularity.Systems.addModule(CardModule),Modularity.Systems.addModule(CarouselPanelModule),Modularity.Systems.addModule(CarouselModule),Modularity.Systems.addModule(TableModule),Modularity.Systems.addModule(PaginationModule),Modularity.Systems.addModule(FooterModule),Modularity.Systems.addModule(SideNavModule),Modularity.Systems.addModule(ListModule),Modularity.Systems.addModule(ViewModule),Modularity.Systems.addModule(Vertical),Modularity.Systems.addModule(VerticalNavbarPackage),Modularity.Systems.addModule(CrudListPackage),Modularity.Systems.addModule(ParallaxModule),Modularity.Systems.addModule(ModalModule),Modularity.Systems.addModule(SearchBarModule),Modularity.Systems.addModule(FilterModule),Modularity.Systems.addModule(HorizontalContainer),Modularity.Systems.addModule(HorizontalCard),Modularity.Systems.addModule(FullScreenContainer),Modularity.Systems.addModule(MiniCartModule),Modularity.Systems.addModule(PresentationModule),Modularity.Systems.addModule(SearchBarPackage),Modularity.Systems.addModule(FiltersPackage),Modularity.Systems.addModule(Import),Modularity.Systems.addModule(ChipModule),Modularity.Systems.addModule(CartPackage),Modularity.Systems.addModule(CustomTable),Modularity.Systems.addModule(ClientForm),Modularity.Systems.addModule(ProductPresent),Modularity.Systems.addModule(ProductPresentPackage),Modularity.Systems.addModule(PrinterPresentPackage),Modularity.Systems.addModule(UserAccount),Modularity.Systems.addModule(TableData),Modularity.Systems.addModule(OrderPackage),Modularity.Systems.addModule(ViewOrder),Modularity.Systems.addModule(TextEditor),Modularity.Systems.addModule(ContactPackage),Modularity.Systems.addModule(GoogleMapModule);class App extends Component{constructor(e){super(e),this.state={SiteMode:"true"==localStorage.getItem("SolidLoader"),script:{}},"production"!==process.env.NODE_ENV&&window.addEventListener("keypress",e=>{let o;window.event?o=e.keyCode:e.which&&(o=e.which),61===o&&(localStorage.setItem("AdminMode",this.state.SiteMode?"admin":""),localStorage.setItem("AdminVision",this.state.SiteMode?"admin":""),localStorage.setItem("SolidLoader",!this.state.SiteMode),this.setState({SiteMode:!this.state.SiteMode}))})}render(){return React.createElement("div",null,React.createElement("div",{className:"",key:"App"},"production"!==process.env.NODE_ENV?this.state.SiteMode?React.createElement(Modularity.ModuleLoader.SolidLoader,{script:SiteScript}):React.createElement(Modularity.ModuleLoader.MemoryLoader,null):React.createElement(Modularity.ModuleLoader.SolidLoader,{script:SiteScript})))}}export default App;import Modularity from"modularity-front";import Modules from"../Modules";import HigherModules from"../HigherModules";import Services from"../Services";import Packages from"../Packages";import helpers from"../helpers";Modularity.Systems.import({Modules:Modules,HigherModules:HigherModules,Services:Services,Packages:Packages,Helpers:helpers});export default Modularity;import React from"react";import ReactDOM from"react-dom";import"./index.css";import App from"./App";import*as serviceWorker from"./serviceWorker";ReactDOM.render(React.createElement(App,null),document.getElementById("root")),serviceWorker.register();const isLocalhost=Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));export function register(e){if("production"===process.env.NODE_ENV&&"serviceWorker"in navigator){if(new URL(process.env.PUBLIC_URL,window.location.href).origin!==window.location.origin)return;window.addEventListener("load",()=>{const o=`${process.env.PUBLIC_URL}/service-worker.js`;isLocalhost?(checkValidServiceWorker(o,e),navigator.serviceWorker.ready.then(()=>{console.log("This web app is being served cache-first by a service worker. To learn more, visit http://bit.ly/CRA-PWA")})):registerValidSW(o,e)})}}function registerValidSW(e,o){navigator.serviceWorker.register(e).then(e=>{e.onupdatefound=()=>{const r=e.installing;null!=r&&(r.onstatechange=()=>{"installed"===r.state&&(navigator.serviceWorker.controller?(console.log("New content is available and will be used when all tabs for this page are closed. See http://bit.ly/CRA-PWA."),o&&o.onUpdate&&o.onUpdate(e)):(console.log("Content is cached for offline use."),o&&o.onSuccess&&o.onSuccess(e)))})}}).catch(e=>{console.error("Error during service worker registration:",e)})}function checkValidServiceWorker(e,o){fetch(e).then(r=>{const t=r.headers.get("content-type");404===r.status||null!=t&&-1===t.indexOf("javascript")?navigator.serviceWorker.ready.then(e=>{e.unregister().then(()=>{window.location.reload()})}):registerValidSW(e,o)}).catch(()=>{console.log("No internet connection found. App is running in offline mode.")})}export function unregister(){"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(e=>{e.unregister()})}const proxy=require("http-proxy-middleware");module.exports=function(e){e.use(proxy("/api",{target:"http://localhost:3001/",pathRewrite:{"^/api":""}}))};