Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* eslint-disable react/react-in-jsx-scope */
- import '../src/assets/styles/fontawesome.min.css';
- import '../src/assets/styles/main.scss';
- import '../src/assets/styles/animate.min.css';
- import '../src/assets/styles/nprogress.css';
- import '../src/assets/styles/demo/demo.css';
- import '../src/assets/styles/demo/nucleo-icons-page-styles.css';
- import 'react-toastify/dist/ReactToastify.css';
- import '../src/assets/styles/pages/home.scss';
- import { Provider } from 'react-redux';
- import App from 'next/app';
- import withRedux from 'next-redux-wrapper';
- import { DefaultSeo } from 'next-seo';
- import Router from 'next/router';
- import NProgress from 'nprogress';
- import { initStore } from '@reducers/store';
- import { appWithTranslation } from '@helpers/i18n';
- import { initGA, logPageView } from '@helpers/analytics';
- NProgress.configure({ showSpinner: true });
- Router.onRouteChangeStart = () => {
- NProgress.start();
- };
- Router.onRouteChangeComplete = () => {
- if (process.browser) {
- logPageView();
- }
- NProgress.done();
- };
- Router.onRouteChangeError = () => {
- NProgress.done();
- };
- class MyApp extends App {
- static async getInitialProps({ Component, ctx }) {
- const { originalUrl } = ctx.req || {};
- return {
- pageProps: Component.getInitialProps
- ? await Component.getInitialProps(ctx)
- : {},
- originalUrl
- };
- }
- constructor(props) {
- super(props);
- if (process.browser) {
- if (!process.env.NODE_ENV || process.env.NODE_ENV === 'development') {
- // for dev
- // without google analytic
- } else {
- // for prod
- // with google analytic
- if (!window.GA_INITIALIZED) {
- initGA();
- window.GA_INITIALIZED = true;
- }
- logPageView();
- }
- }
- }
- render() {
- const { Component, pageProps, store } = this.props;
- return (
- <>
- <DefaultSeo
- title="Kaptiva"
- description="kaptiva"
- openGraph={{
- type: 'website',
- locale: 'en_IE',
- url: '',
- site_name: ''
- }}
- />
- <Provider store={store}>
- <Component {...pageProps} />
- </Provider>
- </>
- );
- }
- }
- export default withRedux(initStore)(appWithTranslation(MyApp));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement