2021-02-18 10:30:25 +03:00
|
|
|
import App from "next/app";
|
|
|
|
import ThemeProvider from "~/components/system/ThemeProvider";
|
|
|
|
|
2020-04-09 00:29:13 +03:00
|
|
|
import * as React from "react";
|
|
|
|
|
2020-11-30 08:24:22 +03:00
|
|
|
import { Global } from "@emotion/react";
|
2021-10-08 19:32:01 +03:00
|
|
|
import {
|
|
|
|
injectGlobalStyles,
|
|
|
|
injectCodeBlockStyles,
|
|
|
|
injectIntercomStyles,
|
|
|
|
} from "~/common/styles/global";
|
|
|
|
import { IntercomProvider, useIntercom } from "react-use-intercom";
|
2021-07-15 01:08:09 +03:00
|
|
|
|
2021-10-08 19:32:01 +03:00
|
|
|
const INTERCOM_APP_ID = "jwgbampk";
|
|
|
|
|
|
|
|
const CustomIntercomConfig = () => {
|
|
|
|
const { boot } = useIntercom();
|
|
|
|
React.useLayoutEffect(() => {
|
2022-01-25 16:25:59 +03:00
|
|
|
//NOTE(amine): Don't initiate the intercom widget on the landing page
|
|
|
|
if (typeof window !== "undefined" && window.location.pathname === "/") return;
|
2021-10-08 19:32:01 +03:00
|
|
|
boot({
|
|
|
|
alignment: "left",
|
|
|
|
horizontalPadding: 23,
|
|
|
|
verticalPadding: 28,
|
|
|
|
});
|
|
|
|
}, [boot]);
|
|
|
|
|
|
|
|
return null;
|
|
|
|
};
|
2020-04-09 00:29:13 +03:00
|
|
|
|
|
|
|
// NOTE(wwwjim):
|
|
|
|
// https://nextjs.org/docs/advanced-features/custom-app
|
|
|
|
function MyApp({ Component, pageProps }) {
|
|
|
|
return (
|
2021-02-17 21:37:34 +03:00
|
|
|
<ThemeProvider>
|
|
|
|
<React.Fragment>
|
2021-07-07 23:50:57 +03:00
|
|
|
<script src="//cdn.iframe.ly/embed.js" async></script>
|
2021-02-17 21:37:34 +03:00
|
|
|
<Global styles={injectGlobalStyles()} />
|
2021-10-08 19:32:01 +03:00
|
|
|
<Global styles={injectIntercomStyles()} />
|
2021-02-17 21:37:34 +03:00
|
|
|
<Global styles={injectCodeBlockStyles()} />
|
2021-10-08 19:32:01 +03:00
|
|
|
<IntercomProvider appId={INTERCOM_APP_ID}>
|
|
|
|
<CustomIntercomConfig />
|
2021-07-15 01:08:09 +03:00
|
|
|
<Component {...pageProps} />
|
|
|
|
</IntercomProvider>
|
2021-02-17 21:37:34 +03:00
|
|
|
</React.Fragment>
|
|
|
|
</ThemeProvider>
|
2020-04-09 00:29:13 +03:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
MyApp.getInitialProps = async (appContext) => {
|
|
|
|
const appProps = await App.getInitialProps(appContext);
|
|
|
|
return { ...appProps };
|
|
|
|
};
|
|
|
|
|
|
|
|
export default MyApp;
|