umami/pages/_app.js

53 lines
1.9 KiB
JavaScript
Raw Normal View History

import React from 'react';
import Head from 'next/head';
2021-03-05 01:23:47 +01:00
import { useRouter } from 'next/router';
2020-09-06 02:27:01 +02:00
import { IntlProvider } from 'react-intl';
2020-09-09 05:46:31 +02:00
import { Provider } from 'react-redux';
2020-08-05 07:45:05 +02:00
import { useStore } from 'redux/store';
2020-09-09 05:46:31 +02:00
import useLocale from 'hooks/useLocale';
2020-10-04 06:54:21 +02:00
import useForceSSL from 'hooks/useForceSSL';
2020-09-08 04:48:40 +02:00
import { messages } from 'lib/lang';
2020-08-06 04:04:02 +02:00
import 'styles/variables.css';
2020-07-17 10:03:38 +02:00
import 'styles/bootstrap-grid.css';
2020-08-02 06:20:52 +02:00
import 'styles/index.css';
import '@fontsource/inter/400.css';
import '@fontsource/inter/600.css';
2020-09-07 10:22:16 +02:00
const Intl = ({ children }) => {
const [locale] = useLocale();
2020-09-07 10:22:16 +02:00
2020-09-08 00:25:09 +02:00
const Wrapper = ({ children }) => <span className={locale}>{children}</span>;
2020-09-07 10:22:16 +02:00
return (
2020-09-08 00:25:09 +02:00
<IntlProvider locale={locale} messages={messages[locale]} textComponent={Wrapper}>
2020-09-07 10:22:16 +02:00
{children}
</IntlProvider>
);
};
2020-07-17 10:03:38 +02:00
export default function App({ Component, pageProps }) {
2020-10-04 06:54:21 +02:00
useForceSSL(process.env.FORCE_SSL);
2020-08-05 07:45:05 +02:00
const store = useStore();
2021-03-05 01:23:47 +01:00
const { basePath } = useRouter();
2020-08-05 07:45:05 +02:00
return (
2020-09-07 10:22:16 +02:00
<Provider store={store}>
<Head>
2021-03-27 05:50:53 +01:00
<link rel="icon" href={`${basePath}/favicon.ico`} />
2021-03-05 01:23:47 +01:00
<link rel="apple-touch-icon" sizes="180x180" href={`${basePath}/apple-touch-icon.png`} />
<link rel="icon" type="image/png" sizes="32x32" href={`${basePath}/favicon-32x32.png`} />
<link rel="icon" type="image/png" sizes="16x16" href={`${basePath}/favicon-16x16.png`} />
<link rel="manifest" href={`${basePath}/site.webmanifest`} />
<link rel="mask-icon" href={`${basePath}/safari-pinned-tab.svg`} color="#5bbad5" />
2021-03-13 07:53:56 +01:00
<link rel="preconnect" href="https://fonts.gstatic.com" />
<meta name="msapplication-TileColor" content="#da532c" />
<meta name="theme-color" content="#ffffff" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</Head>
2020-09-07 10:22:16 +02:00
<Intl>
2020-09-06 02:27:01 +02:00
<Component {...pageProps} />
2020-09-07 10:22:16 +02:00
</Intl>
</Provider>
2020-08-05 07:45:05 +02:00
);
2020-07-17 10:03:38 +02:00
}