_app.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*!
  2. *
  3. * Angle - Bootstrap Admin Template
  4. *
  5. * Version: 4.8
  6. * Author: @themicon_co
  7. * Website: http://themicon.co
  8. * License: https://wrapbootstrap.com/help/licenses
  9. *
  10. */
  11. // Polyfills
  12. // ======================
  13. import '../polyfills.js';
  14. // App
  15. // ======================
  16. import App from 'next/app';
  17. import React from 'react';
  18. // Redux support
  19. import { Provider } from 'react-redux';
  20. import withReduxStore from '../store/with-redux-store';
  21. // Translation support
  22. import * as Translate from '@/components/Common/Translate';
  23. // Base Layout
  24. import Base from '@/components/Layout/Base';
  25. // import BaseHorizontal from '@/components/Layout/BaseHorizontal';
  26. // Global Vendor
  27. // ======================
  28. // Whirl
  29. import 'whirl/dist/whirl.css';
  30. // Font Awesome
  31. import '@fortawesome/fontawesome-free/css/brands.css';
  32. import '@fortawesome/fontawesome-free/css/regular.css';
  33. import '@fortawesome/fontawesome-free/css/solid.css';
  34. import '@fortawesome/fontawesome-free/css/fontawesome.css';
  35. // Animate.CSS
  36. import 'animate.css/animate.min.css';
  37. // Simple line icons
  38. import 'simple-line-icons/css/simple-line-icons.css';
  39. // Weather Icons
  40. import 'weather-icons/css/weather-icons.min.css';
  41. import 'weather-icons/css/weather-icons-wind.min.css';
  42. // App Styes
  43. // ======================
  44. import '../styles/bootstrap.scss';
  45. import '../styles/app.scss';
  46. // https://nextjs.org/docs/#custom-app
  47. class MyApp extends App {
  48. static async getInitialProps({ Component, ctx }) {
  49. let pageProps = {};
  50. if (Component.getInitialProps) {
  51. pageProps = await Component.getInitialProps(ctx);
  52. }
  53. // Require the initial dictionary.
  54. // Use require to avoid 'fs' module
  55. Translate.setDict('en', require('@/public/static/locales/en/translations.json'));
  56. // The store has been updated in previous call,
  57. // pass it down as initial prop so client can use it.
  58. return { pageProps, store: Translate.store };
  59. }
  60. render() {
  61. const { Component, pageProps, reduxStore, store } = this.props;
  62. const Layout = Component.Layout ? Component.Layout : Base;
  63. const ComponentWithTranslation = Translate.withTranslation(Component);
  64. return (
  65. <Provider store={reduxStore}>
  66. <Translate.Provider store={store}>
  67. <Layout>
  68. <ComponentWithTranslation {...pageProps} />
  69. </Layout>
  70. </Translate.Provider>
  71. </Provider>
  72. );
  73. }
  74. }
  75. export default withReduxStore(MyApp);