@openeventkit/event-site 2.0.149 → 2.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gatsby-browser.js +4 -1
- package/gatsby-ssr.js +39 -5
- package/package.json +1 -1
- package/src/pages/a/[...].js +2 -2
- package/src/styles/theme.js +10 -0
- package/src/utils/createEmotionCache.js +12 -0
- package/src/utils/wrapThemeProvider.js +21 -0
package/gatsby-browser.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Sentry from "@sentry/gatsby";
|
|
2
2
|
import { RewriteFrames as RewriteFramesIntegration } from "@sentry/integrations";
|
|
3
3
|
import ReduxWrapper from "./src/state/ReduxWrapper";
|
|
4
|
+
import wrapThemeProvider from "./src/utils/wrapThemeProvider";
|
|
4
5
|
import CookieManager from "./src/utils/cookies/CookieManager";
|
|
5
6
|
import KlaroProvider from "./src/utils/cookies/providers/KlaroProvider";
|
|
6
7
|
import cookieServices from "./src/utils/cookies/services";
|
|
@@ -20,7 +21,9 @@ import "./src/utils/fontAwesome";
|
|
|
20
21
|
import colors from "data/colors.json";
|
|
21
22
|
import marketingSettings from "data/marketing-settings.json";
|
|
22
23
|
|
|
23
|
-
export const wrapRootElement =
|
|
24
|
+
export const wrapRootElement = ({ element }) => {
|
|
25
|
+
return wrapThemeProvider({ element: ReduxWrapper({ element }) });
|
|
26
|
+
};
|
|
24
27
|
|
|
25
28
|
export const onClientEntry = () => {
|
|
26
29
|
// smooth scroll polyfill needed for Safari
|
package/gatsby-ssr.js
CHANGED
|
@@ -1,20 +1,54 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as ReactDOMServer from "react-dom/server";
|
|
3
|
+
import createEmotionServer from "@emotion/server/create-instance";
|
|
4
|
+
import createEmotionCache from "./src/utils/createEmotionCache";
|
|
5
|
+
import {
|
|
3
6
|
HtmlAttributes,
|
|
4
7
|
HeadComponents,
|
|
5
8
|
PreBodyComponents
|
|
6
9
|
} from "./src/components/HeadComponents";
|
|
10
|
+
import ReduxWrapper from "./src/state/ReduxWrapper";
|
|
11
|
+
import wrapThemeProvider from "./src/utils/wrapThemeProvider";
|
|
7
12
|
|
|
8
|
-
// build
|
|
13
|
+
// Polyfills for build environment
|
|
9
14
|
import "./src/utils/buildPolyfills";
|
|
10
15
|
|
|
11
|
-
|
|
16
|
+
const renderToStringWithEmotion = (bodyComponent) => {
|
|
17
|
+
const cache = createEmotionCache();
|
|
18
|
+
const { extractCriticalToChunks, constructStyleTagsFromChunks } = createEmotionServer(cache);
|
|
19
|
+
|
|
20
|
+
const wrappedComponent = wrapThemeProvider({ element: ReduxWrapper({ element: bodyComponent }) });
|
|
21
|
+
|
|
22
|
+
const html = ReactDOMServer.renderToString(wrappedComponent);
|
|
23
|
+
const emotionChunks = extractCriticalToChunks(html);
|
|
24
|
+
const emotionCss = constructStyleTagsFromChunks(emotionChunks);
|
|
25
|
+
|
|
26
|
+
return { html, emotionCss };
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const replaceRenderer = ({
|
|
30
|
+
bodyComponent,
|
|
31
|
+
setHeadComponents,
|
|
32
|
+
replaceBodyHTMLString
|
|
33
|
+
}) => {
|
|
34
|
+
const { html, emotionCss } = renderToStringWithEmotion(bodyComponent);
|
|
35
|
+
|
|
36
|
+
const emotionStyleTags = (
|
|
37
|
+
<style
|
|
38
|
+
key="emotion-style"
|
|
39
|
+
dangerouslySetInnerHTML={{ __html: emotionCss }}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
setHeadComponents([emotionStyleTags]);
|
|
44
|
+
replaceBodyHTMLString(html);
|
|
45
|
+
};
|
|
12
46
|
|
|
13
47
|
export const onRenderBody = ({
|
|
14
48
|
setHtmlAttributes,
|
|
15
49
|
setHeadComponents,
|
|
16
50
|
setPreBodyComponents
|
|
17
|
-
}
|
|
51
|
+
}) => {
|
|
18
52
|
setHtmlAttributes(HtmlAttributes);
|
|
19
53
|
setHeadComponents(HeadComponents);
|
|
20
54
|
setPreBodyComponents(PreBodyComponents);
|
package/package.json
CHANGED
package/src/pages/a/[...].js
CHANGED
|
@@ -82,12 +82,12 @@ const App = ({ isLoggedUser, user, summitPhase, allowClick = true, data }) => {
|
|
|
82
82
|
<MyTicketsPage path="/my-tickets" isLoggedIn={isLoggedUser} user={user} location={location} />
|
|
83
83
|
<FullProfilePage path="/profile" summitPhase={summitPhase} isLoggedIn={isLoggedUser} user={user} location={location} />
|
|
84
84
|
<ExtraQuestionsPage path="/extra-questions" isLoggedIn={isLoggedUser} user={user} location={location} />
|
|
85
|
-
{ !mySchedulePageJson
|
|
85
|
+
{ !mySchedulePageJson?.needsTicketAuthz && mySchedulePage({location, summitPhase,isLoggedUser, user, allowClick, title: mySchedulePageJson?.title, key: mySchedulePageJson?.key }) }
|
|
86
86
|
<WithAuthzRoute path="/" summitPhase={summitPhase} isLoggedIn={isLoggedUser} user={user} location={location}>
|
|
87
87
|
<PostersPage path="/posters" trackGroupId={0} location={location} />
|
|
88
88
|
<PostersPage path="/posters/:trackGroupId" location={location} />
|
|
89
89
|
<PosterDetailPage path="/poster/:presentationId/" isLoggedIn={isLoggedUser} user={user} location={location} />
|
|
90
|
-
{ mySchedulePageJson
|
|
90
|
+
{ mySchedulePageJson?.needsTicketAuthz && mySchedulePage({location, summitPhase,isLoggedUser, user, allowClick, title: mySchedulePageJson?.title, key: mySchedulePageJson?.key }) }
|
|
91
91
|
<ShowOpenRoute path="/" summitPhase={summitPhase} isLoggedIn={isLoggedUser} user={user} location={location}>
|
|
92
92
|
<WithBadgeRoute path="/event/:eventId" summitPhase={summitPhase} isLoggedIn={isLoggedUser} user={user} location={location}>
|
|
93
93
|
<EventPage path="/" summitPhase={summitPhase} isLoggedIn={isLoggedUser} user={user} location={location} />
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import createCache from "@emotion/cache";
|
|
2
|
+
|
|
3
|
+
let cacheInstance;
|
|
4
|
+
|
|
5
|
+
const createEmotionCache = (options) => {
|
|
6
|
+
if (!cacheInstance) {
|
|
7
|
+
cacheInstance = createCache(options ?? { key: "css" });
|
|
8
|
+
}
|
|
9
|
+
return cacheInstance;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default createEmotionCache;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CacheProvider } from "@emotion/react";
|
|
3
|
+
import { ThemeProvider } from "@mui/material/styles";
|
|
4
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
5
|
+
|
|
6
|
+
import createEmotionCache from "./createEmotionCache";
|
|
7
|
+
|
|
8
|
+
import theme from "../styles/theme";
|
|
9
|
+
|
|
10
|
+
const cache = createEmotionCache();
|
|
11
|
+
|
|
12
|
+
const wrapThemeProvider = ({ element }) => (
|
|
13
|
+
<CacheProvider value={cache}>
|
|
14
|
+
<ThemeProvider theme={theme}>
|
|
15
|
+
<CssBaseline />
|
|
16
|
+
{element}
|
|
17
|
+
</ThemeProvider>
|
|
18
|
+
</CacheProvider>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export default wrapThemeProvider;
|