UNPKG

@devgateway/dvz-ui-react

Version:

A modular, embeddable React component library for data visualization and UI, built with TypeScript. Provides reusable components for charts, maps, dashboards, and more, with built-in support for internationalization and Redux integration.

2 lines (1 loc) 1.98 kB
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),o=require("react"),t=require("react-router"),m=require("../embeddable/index.js"),f=require("react-intl"),s=require("@devgateway/wp-react-lib"),g=require("react-redux");require("semantic-ui-react");require("../utils/AppMedia.js");require("./Footer.js");require("./Header.js");const p=require("./Customizer.js"),h=require("../conf/index.js"),x=require("../translations/en.json.js"),v=require("../translations/fr.json.js"),j=require("../translations/af.json.js"),C=require("../lib/react-intl-redux/index.js");require("immutable");const n=require("../redux/store.js");require("./Favicon.js");require("clsx");require("../utils/semanticUtils.js");require("./SearchControl.js");require("./ClassicHeader.js");require("./FloatingMenuHeader.js");const i={en:x,fr:v,am:j},w=()=>{const a=t.useParams(),l=t.useLocation(),u=h.Config.DEFAULT_LOCALE,[I,d]=o.useState(!1),e=a.lan,q=l.pathname;return o.useEffect(()=>{d(!0),process.env.NODE_ENV==="development"&&(console.log("----------.env-----------"),console.log(process.env),console.log("----------.env-----------")),typeof window<"u"&&window.setTimeout(()=>{if(window.location.hash){const c=document.getElementById(window.location.hash.substring(1));c&&c.scrollIntoView({behavior:"auto",block:"start"})}},2e3)},[]),o.useEffect(()=>{n.store.dispatch(C.updateIntl({locale:e,formats:{},messages:i[e??"en"]}))},[e]),e?Object.keys(i).includes(e)?r.jsx(g.Provider,{store:n.store,children:r.jsx(f.IntlProvider,{locale:e,messages:i[e],children:r.jsx(s.AppContextProvider,{getComponent:m.getComponentByNameIgnoreCase,store:n.store,locale:e,children:r.jsx(s.SettingProvider,{locale:e,changeUUID:null,children:r.jsxs(s.SettingsConsumer,{children:[r.jsx(p.CustomizerWrapper,{}),r.jsx(t.Outlet,{})]})})})},e)}):r.jsx(t.Navigate,{to:`/${u}${q}`,replace:!0}):r.jsx(t.Navigate,{to:u,replace:!0})};exports.default=w;