@openeventkit/event-site 2.0.107 → 2.0.108-beta.9
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-config.js → gatsby-config.mjs} +34 -12
- package/gatsby-node.js +39 -68
- package/package.json +10 -8
- package/src/cms/config/collections/contentPagesCollection/typeDefs.js +8 -1
- package/src/cms/preview-templates/ContentPagePreview.js +12 -15
- package/src/content/site-settings/index.json +1 -50
- package/src/templates/content-page/index.js +74 -0
- package/src/templates/content-page/shortcodes.js +15 -0
- package/src/templates/content-page/template.js +21 -0
- package/src/utils/filePath.js +16 -14
- package/src/components/Content.js +0 -42
- package/src/content/maintenance.json +0 -5
- package/src/pages/maintenance.md +0 -3
- package/src/templates/content-page.js +0 -92
- package/src/templates/maintenance-page.js +0 -40
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
import path, { dirname } from "path";
|
|
2
|
+
import dotenv from "dotenv";
|
|
3
|
+
import { createRequire } from "module";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
import remarkGfm from "remark-gfm";
|
|
2
6
|
|
|
3
|
-
require(
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
|
|
10
|
+
dotenv.config({
|
|
4
11
|
path: `.env.${process.env.NODE_ENV}`
|
|
5
12
|
});
|
|
6
13
|
|
|
7
14
|
const {
|
|
8
15
|
STATIC_CONTENT_DIR_PATH,
|
|
16
|
+
PAGES_DIR_PATH,
|
|
9
17
|
CONTENT_PAGES_DIR_PATH,
|
|
18
|
+
CONTENT_PAGES_PATH_NAME,
|
|
10
19
|
SITE_SETTINGS_FILE_PATH,
|
|
11
20
|
SITE_SETTINGS_DIR_PATH,
|
|
12
21
|
MARKETING_SETTINGS_FILE_PATH
|
|
@@ -117,24 +126,38 @@ const plugins = [
|
|
|
117
126
|
name: "marketingSettings"
|
|
118
127
|
}
|
|
119
128
|
},
|
|
129
|
+
{
|
|
130
|
+
resolve: "gatsby-plugin-page-creator",
|
|
131
|
+
options: {
|
|
132
|
+
path: path.resolve(PAGES_DIR_PATH),
|
|
133
|
+
ignore: [`**/${CONTENT_PAGES_PATH_NAME}/**`],
|
|
134
|
+
}
|
|
135
|
+
},
|
|
120
136
|
"gatsby-plugin-image",
|
|
121
137
|
"gatsby-plugin-sharp",
|
|
122
138
|
"gatsby-transformer-sharp",
|
|
123
139
|
"gatsby-transformer-json",
|
|
124
140
|
{
|
|
125
|
-
resolve: "gatsby-
|
|
141
|
+
resolve: "gatsby-plugin-mdx",
|
|
126
142
|
options: {
|
|
127
|
-
|
|
143
|
+
extensions: [".mdx", ".md"],
|
|
144
|
+
gatsbyRemarkPlugins: [
|
|
128
145
|
{
|
|
129
146
|
resolve: "gatsby-remark-images",
|
|
130
147
|
options: {
|
|
131
|
-
// It
|
|
148
|
+
// It's important to specify the maxWidth (in pixels) of
|
|
132
149
|
// the content container as this plugin uses this as the
|
|
133
150
|
// base for generating different widths of each image.
|
|
134
151
|
maxWidth: 2048
|
|
135
152
|
}
|
|
136
153
|
}
|
|
137
|
-
]
|
|
154
|
+
],
|
|
155
|
+
mdxOptions: {
|
|
156
|
+
remarkPlugins: [
|
|
157
|
+
// Add GitHub Flavored Markdown (GFM) support
|
|
158
|
+
remarkGfm
|
|
159
|
+
]
|
|
160
|
+
}
|
|
138
161
|
}
|
|
139
162
|
},
|
|
140
163
|
{
|
|
@@ -191,10 +214,9 @@ const plugins = [
|
|
|
191
214
|
"gatsby-plugin-netlify", // make sure to keep it last in the array
|
|
192
215
|
];
|
|
193
216
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
description
|
|
198
|
-
},
|
|
199
|
-
plugins
|
|
217
|
+
const siteMetadata = {
|
|
218
|
+
title,
|
|
219
|
+
description
|
|
200
220
|
};
|
|
221
|
+
|
|
222
|
+
export { siteMetadata, plugins };
|
package/gatsby-node.js
CHANGED
|
@@ -22,7 +22,7 @@ const {
|
|
|
22
22
|
SPEAKERS_IDX_FILE_PATH,
|
|
23
23
|
VOTEABLE_PRESENTATIONS_FILE_PATH,
|
|
24
24
|
MARKETING_SETTINGS_FILE_PATH,
|
|
25
|
-
|
|
25
|
+
CONTENT_PAGES_PATH_NAME,
|
|
26
26
|
SPONSORS_FILE_PATH,
|
|
27
27
|
FONTS_SCSS_FILE_PATH
|
|
28
28
|
} = require("./src/utils/filePath");
|
|
@@ -226,7 +226,7 @@ exports.onPreBootstrap = async () => {
|
|
|
226
226
|
const summitApiBaseUrl = process.env.GATSBY_SUMMIT_API_BASE_URL;
|
|
227
227
|
let marketingSettings = await SSR_getMarketingSettings(process.env.GATSBY_MARKETING_API_BASE_URL, summitId);
|
|
228
228
|
const colorSettings = fs.existsSync(COLORS_FILE_PATH) ? JSON.parse(fs.readFileSync(COLORS_FILE_PATH)) : require(`./${DEFAULT_COLORS_FILE_PATH}`);
|
|
229
|
-
const
|
|
229
|
+
const siteSettings = fs.existsSync(SITE_SETTINGS_FILE_PATH) ? JSON.parse(fs.readFileSync(SITE_SETTINGS_FILE_PATH)) : {};
|
|
230
230
|
|
|
231
231
|
const config = {
|
|
232
232
|
client: {
|
|
@@ -328,13 +328,13 @@ exports.onPreBootstrap = async () => {
|
|
|
328
328
|
fs.writeFileSync(VOTEABLE_PRESENTATIONS_FILE_PATH, JSON.stringify(allVoteablePresentations), "utf8");
|
|
329
329
|
|
|
330
330
|
// setting build times
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
siteSettings.staticJsonFilesBuildTime = fileBuildTimes;
|
|
332
|
+
siteSettings.lastBuild = Date.now();
|
|
333
333
|
|
|
334
|
-
fs.writeFileSync(SITE_SETTINGS_FILE_PATH, JSON.stringify(
|
|
334
|
+
fs.writeFileSync(SITE_SETTINGS_FILE_PATH, JSON.stringify(siteSettings), "utf8");
|
|
335
335
|
|
|
336
336
|
// Read fonts from site settings
|
|
337
|
-
const siteFonts =
|
|
337
|
+
const siteFonts = siteSettings.siteFont;
|
|
338
338
|
|
|
339
339
|
if(siteFonts && Object.keys(siteFonts).length > 0) {
|
|
340
340
|
// Generate the SCSS file
|
|
@@ -360,85 +360,56 @@ exports.createSchemaCustomization = ({ actions }) => {
|
|
|
360
360
|
|
|
361
361
|
exports.onCreateNode = ({ node, actions, getNode }) => {
|
|
362
362
|
const { createNodeField } = actions;
|
|
363
|
-
if (node.internal.type === "
|
|
363
|
+
if (node.internal.type === "Mdx") {
|
|
364
364
|
const value = createFilePath({ node, getNode });
|
|
365
365
|
createNodeField({
|
|
366
366
|
name: "slug",
|
|
367
367
|
node,
|
|
368
|
-
value
|
|
368
|
+
value
|
|
369
369
|
})
|
|
370
370
|
}
|
|
371
371
|
};
|
|
372
372
|
|
|
373
|
-
exports.createPages = ({ actions, graphql }) => {
|
|
373
|
+
exports.createPages = async ({ actions, graphql }) => {
|
|
374
374
|
const { createPage, createRedirect } = actions;
|
|
375
375
|
|
|
376
|
-
const
|
|
377
|
-
JSON.parse(fs.readFileSync(MAINTENANCE_FILE_PATH)) : { enabled: false };
|
|
378
|
-
|
|
379
|
-
// create a catch all redirect
|
|
380
|
-
if (maintenanceMode.enabled) {
|
|
381
|
-
createRedirect({
|
|
382
|
-
fromPath: "/*",
|
|
383
|
-
toPath: "/maintenance/"
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
return graphql(`
|
|
376
|
+
const result = await graphql(`
|
|
388
377
|
{
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
378
|
+
allMdx {
|
|
379
|
+
nodes {
|
|
380
|
+
id
|
|
381
|
+
fields {
|
|
382
|
+
slug
|
|
383
|
+
}
|
|
384
|
+
frontmatter {
|
|
385
|
+
templateKey
|
|
386
|
+
}
|
|
387
|
+
internal {
|
|
388
|
+
contentFilePath
|
|
399
389
|
}
|
|
400
390
|
}
|
|
401
391
|
}
|
|
402
392
|
}
|
|
403
|
-
`)
|
|
404
|
-
const {
|
|
405
|
-
errors,
|
|
406
|
-
data: {
|
|
407
|
-
allMarkdownRemark: {
|
|
408
|
-
edges
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
} = result;
|
|
412
|
-
|
|
413
|
-
if (errors) {
|
|
414
|
-
errors.forEach((e) => console.error(e.toString()));
|
|
415
|
-
return Promise.reject(errors);
|
|
416
|
-
}
|
|
393
|
+
`);
|
|
417
394
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
if (slug.match(/content-pages/)) {
|
|
423
|
-
slug = slug.replace("/content-pages/", "/");
|
|
424
|
-
}
|
|
395
|
+
if (result.errors) {
|
|
396
|
+
result.errors.forEach((e) => console.error(e.toString()));
|
|
397
|
+
return Promise.reject(result.errors);
|
|
398
|
+
}
|
|
425
399
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
createPage(page);
|
|
441
|
-
});
|
|
400
|
+
const nodes = result.data.allMdx.nodes;
|
|
401
|
+
|
|
402
|
+
nodes.forEach((node) => {
|
|
403
|
+
const { id, fields: { slug }, frontmatter: { templateKey }, internal: { contentFilePath } } = node;
|
|
404
|
+
const template = require.resolve(`./src/templates/${String(templateKey)}`);
|
|
405
|
+
// remove content pages namespace from path
|
|
406
|
+
const path = slug.replace(`${CONTENT_PAGES_PATH_NAME}`, "/");
|
|
407
|
+
const page = {
|
|
408
|
+
path: path,
|
|
409
|
+
component: `${template}?__contentFilePath=${contentFilePath}`,
|
|
410
|
+
context: { id }
|
|
411
|
+
};
|
|
412
|
+
createPage(page);
|
|
442
413
|
});
|
|
443
414
|
};
|
|
444
415
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openeventkit/event-site",
|
|
3
3
|
"description": "Event Site",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.108-beta.9",
|
|
5
5
|
"author": "Tipit LLC",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@
|
|
7
|
+
"@mdx-js/react": "^3.0.1",
|
|
8
|
+
"@mui/base": "^5.0.0-beta.40",
|
|
8
9
|
"@mux/mux-player-react": "^1.14.1",
|
|
9
10
|
"@ncwidgets/file-relation": "^0.8.0",
|
|
10
11
|
"@ncwidgets/id": "^0.8.1",
|
|
@@ -44,19 +45,20 @@
|
|
|
44
45
|
"font-awesome": "^4.7.0",
|
|
45
46
|
"formik": "^2.2.9",
|
|
46
47
|
"full-schedule-widget": "3.0.5",
|
|
47
|
-
"gatsby": "^5.
|
|
48
|
+
"gatsby": "^5.9.1",
|
|
48
49
|
"gatsby-alias-imports": "^1.0.6",
|
|
49
50
|
"gatsby-plugin-google-tagmanager": "^5.13.1",
|
|
50
51
|
"gatsby-plugin-image": "^3.8.0",
|
|
51
52
|
"gatsby-plugin-manifest": "^5.12.3",
|
|
53
|
+
"gatsby-plugin-mdx": "^5.12.3",
|
|
52
54
|
"gatsby-plugin-netlify": "^5.1.0",
|
|
53
55
|
"gatsby-plugin-netlify-cms": "^7.8.0",
|
|
56
|
+
"gatsby-plugin-page-creator": "^5.13.1",
|
|
54
57
|
"gatsby-plugin-sass": "^6.8.0",
|
|
55
58
|
"gatsby-plugin-sharp": "^5.12.3",
|
|
56
59
|
"gatsby-remark-images": "^7.8.0",
|
|
57
|
-
"gatsby-source-filesystem": "^5.
|
|
58
|
-
"gatsby-transformer-json": "^5.
|
|
59
|
-
"gatsby-transformer-remark": "^6.8.0",
|
|
60
|
+
"gatsby-source-filesystem": "^5.12.3",
|
|
61
|
+
"gatsby-transformer-json": "^5.12.3",
|
|
60
62
|
"gatsby-transformer-sharp": "^5.12.3",
|
|
61
63
|
"history": "^4.10.1",
|
|
62
64
|
"i18n-react": "^0.6.4",
|
|
@@ -110,7 +112,7 @@
|
|
|
110
112
|
"redux": "^4.1.2",
|
|
111
113
|
"redux-persist": "^6.0.0",
|
|
112
114
|
"redux-thunk": "^2.4.1",
|
|
113
|
-
"
|
|
115
|
+
"remark-gfm": "^4.0.0",
|
|
114
116
|
"sass": "^1.49.9",
|
|
115
117
|
"schedule-filter-widget": "3.0.1",
|
|
116
118
|
"simple-chat-widget": "^1.0.31",
|
|
@@ -122,7 +124,7 @@
|
|
|
122
124
|
"stream-browserify": "^3.0.0",
|
|
123
125
|
"stream-chat": "^2.7.2",
|
|
124
126
|
"stream-chat-react": "3.1.7",
|
|
125
|
-
"summit-registration-lite": "5.0.
|
|
127
|
+
"summit-registration-lite": "5.0.30",
|
|
126
128
|
"superagent": "8.0.9",
|
|
127
129
|
"sweetalert2": "^9.17.0",
|
|
128
130
|
"upcoming-events-widget": "3.0.5",
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
module.exports = `
|
|
3
|
-
type
|
|
3
|
+
type MdxFields {
|
|
4
|
+
slug: String
|
|
5
|
+
}
|
|
6
|
+
type MdxFrontmatter {
|
|
4
7
|
templateKey: String
|
|
5
8
|
title: String
|
|
6
9
|
userRequirement: String
|
|
7
10
|
}
|
|
11
|
+
type Mdx {
|
|
12
|
+
frontmatter: MdxFrontmatter
|
|
13
|
+
fields: MdxFields
|
|
14
|
+
}
|
|
8
15
|
`;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import ContentPageTemplate from "../../templates/content-page/template";
|
|
4
4
|
|
|
5
|
-
const ContentPagePreview = ({ entry,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/>
|
|
11
|
-
)
|
|
12
|
-
}
|
|
5
|
+
const ContentPagePreview = ({ entry, widgetFor }) =>
|
|
6
|
+
<ContentPageTemplate
|
|
7
|
+
title={entry.getIn(["data", "title"])}
|
|
8
|
+
content={widgetFor("body")}
|
|
9
|
+
/>;
|
|
13
10
|
|
|
14
11
|
ContentPagePreview.propTypes = {
|
|
15
12
|
entry: PropTypes.shape({
|
|
16
|
-
getIn: PropTypes.func
|
|
13
|
+
getIn: PropTypes.func
|
|
17
14
|
}),
|
|
18
|
-
|
|
19
|
-
}
|
|
15
|
+
widgetFor: PropTypes.func
|
|
16
|
+
};
|
|
20
17
|
|
|
21
|
-
export default ContentPagePreview
|
|
18
|
+
export default ContentPagePreview;
|
|
@@ -1,50 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"widgets": {
|
|
3
|
-
"chat": {
|
|
4
|
-
"enabled": true,
|
|
5
|
-
"showQA": false,
|
|
6
|
-
"showHelp": false,
|
|
7
|
-
"defaultScope": "page"
|
|
8
|
-
},
|
|
9
|
-
"schedule": {
|
|
10
|
-
"allowClick": true
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
"favicon": {
|
|
14
|
-
"asset": "icon.png"
|
|
15
|
-
},
|
|
16
|
-
"idpLogo": {
|
|
17
|
-
"idpLogoDark": "",
|
|
18
|
-
"idpLogoLight": "",
|
|
19
|
-
"idpLogoAlt": ""
|
|
20
|
-
},
|
|
21
|
-
"identityProviderButtons": [
|
|
22
|
-
{
|
|
23
|
-
"buttonColor": "#082238",
|
|
24
|
-
"providerLabel": "Continue with FNid",
|
|
25
|
-
"providerLogo": "logo_fn.svg",
|
|
26
|
-
"providerLogoSize": 27
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"buttonColor": "#0A66C2",
|
|
30
|
-
"providerLabel": "Sign in with LinkedIn",
|
|
31
|
-
"providerParam": "linkedin",
|
|
32
|
-
"providerLogo": "logo_linkedin.svg",
|
|
33
|
-
"providerLogoSize": 18
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"buttonColor": "#000000",
|
|
37
|
-
"providerLabel": "Sign in with Apple",
|
|
38
|
-
"providerParam": "apple",
|
|
39
|
-
"providerLogoSize": 17,
|
|
40
|
-
"providerLogo": "logo_apple.svg"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"buttonColor": "#1877F2",
|
|
44
|
-
"providerLabel": "Login with Facebook",
|
|
45
|
-
"providerParam": "facebook",
|
|
46
|
-
"providerLogo": "logo_facebook.svg",
|
|
47
|
-
"providerLogoSize": 20
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
}
|
|
1
|
+
{"widgets":{"chat":{"enabled":true,"showQA":false,"showHelp":false,"defaultScope":"page"},"schedule":{"allowClick":true}},"favicon":{"asset":"icon.png"},"idpLogo":{"idpLogoDark":"","idpLogoLight":"","idpLogoAlt":""},"identityProviderButtons":[{"buttonColor":"#082238","providerLabel":"Continue with FNid","providerLogo":"logo_fn.svg","providerLogoSize":27},{"buttonColor":"#0A66C2","providerLabel":"Sign in with LinkedIn","providerParam":"linkedin","providerLogo":"logo_linkedin.svg","providerLogoSize":18},{"buttonColor":"#000000","providerLabel":"Sign in with Apple","providerParam":"apple","providerLogoSize":17,"providerLogo":"logo_apple.svg"},{"buttonColor":"#1877F2","providerLabel":"Login with Facebook","providerParam":"facebook","providerLogo":"logo_facebook.svg","providerLogoSize":20}],"staticJsonFilesBuildTime":[{"file":"src/data/summit.json","build_time":1715959223162},{"file":"src/data/events.json","build_time":1715959234014},{"file":"src/data/events.idx.json","build_time":1715959234024},{"file":"src/data/speakers.json","build_time":1715959236830},{"file":"src/data/speakers.idx.json","build_time":1715959236832},{"file":"src/content/sponsors.json","build_time":1715959237223},{"file":"src/data/voteable-presentations.json","build_time":1715959237604}],"lastBuild":1715959237604}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { connect } from "react-redux";
|
|
4
|
+
import { graphql } from "gatsby";
|
|
5
|
+
import { Redirect } from "@gatsbyjs/reach-router";
|
|
6
|
+
import { MDXProvider } from "@mdx-js/react";
|
|
7
|
+
import ContentPageTemplate from "./template";
|
|
8
|
+
import Layout from "../../components/Layout";
|
|
9
|
+
import Seo from "../../components/Seo";
|
|
10
|
+
import { titleFromPathname } from "../../utils/urlFormating";
|
|
11
|
+
|
|
12
|
+
import { USER_REQUIREMENTS } from "../../cms/config/collections/contentPagesCollection";
|
|
13
|
+
|
|
14
|
+
const ContentPage = ({
|
|
15
|
+
data,
|
|
16
|
+
isAuthorized,
|
|
17
|
+
isLoggedUser,
|
|
18
|
+
hasTicket,
|
|
19
|
+
children
|
|
20
|
+
}) => {
|
|
21
|
+
const { frontmatter: { title, userRequirement } } = data.mdx;
|
|
22
|
+
if (!isAuthorized && (
|
|
23
|
+
(userRequirement === USER_REQUIREMENTS.loggedIn && !isLoggedUser) ||
|
|
24
|
+
(userRequirement === USER_REQUIREMENTS.hasTicket && !hasTicket)
|
|
25
|
+
)) {
|
|
26
|
+
return <Redirect to="/" noThrow />;
|
|
27
|
+
}
|
|
28
|
+
return (
|
|
29
|
+
<Layout>
|
|
30
|
+
<ContentPageTemplate
|
|
31
|
+
title={title}
|
|
32
|
+
content={children}
|
|
33
|
+
/>
|
|
34
|
+
</Layout>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
ContentPage.propTypes = {
|
|
39
|
+
data: PropTypes.object.isRequired,
|
|
40
|
+
isAuthorized: PropTypes.bool.isRequired,
|
|
41
|
+
isLoggedUser: PropTypes.bool.isRequired,
|
|
42
|
+
hasTicket: PropTypes.bool.isRequired,
|
|
43
|
+
children: PropTypes.node.isRequired
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const mapStateToProps = ({ loggedUserState, userState }) => ({
|
|
47
|
+
isLoggedUser: loggedUserState.isLoggedUser,
|
|
48
|
+
hasTicket: userState.hasTicket,
|
|
49
|
+
isAuthorized: userState.isAuthorized
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const StoreConnectedContentPage = connect(mapStateToProps)(ContentPage);
|
|
53
|
+
|
|
54
|
+
export default StoreConnectedContentPage;
|
|
55
|
+
|
|
56
|
+
export const query = graphql`
|
|
57
|
+
query($id: String!) {
|
|
58
|
+
mdx(id: { eq: $id }) {
|
|
59
|
+
frontmatter {
|
|
60
|
+
title
|
|
61
|
+
userRequirement
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
export const Head = ({
|
|
68
|
+
location
|
|
69
|
+
}) => (
|
|
70
|
+
<Seo
|
|
71
|
+
title={titleFromPathname(location.pathname)}
|
|
72
|
+
location={location}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// This file is intended to allow for theme extension with component shadowing.
|
|
2
|
+
// You can add your component imports and map them here to be used as shortcodes in MDX content.
|
|
3
|
+
|
|
4
|
+
// Import components here when needed
|
|
5
|
+
// import Grid from "../../../../components/Grid";
|
|
6
|
+
// import SpeakerCard from "../../../../components/SpeakerCard";
|
|
7
|
+
|
|
8
|
+
const shortcodes = {
|
|
9
|
+
// Map your components here
|
|
10
|
+
// Example:
|
|
11
|
+
// Grid,
|
|
12
|
+
// SpeakerCard
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default shortcodes;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { MDXProvider } from "@mdx-js/react";
|
|
4
|
+
|
|
5
|
+
import shortcodes from "./shortcodes";
|
|
6
|
+
|
|
7
|
+
const ContentPageTemplate = ({ title, content }) => (
|
|
8
|
+
<div className="content">
|
|
9
|
+
<h1>{title}</h1>
|
|
10
|
+
<MDXProvider components={shortcodes}>
|
|
11
|
+
{content}
|
|
12
|
+
</MDXProvider>
|
|
13
|
+
</div>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export default ContentPageTemplate;
|
|
17
|
+
|
|
18
|
+
ContentPageTemplate.propTypes = {
|
|
19
|
+
title: PropTypes.string.isRequired,
|
|
20
|
+
content: PropTypes.node.isRequired
|
|
21
|
+
};
|
package/src/utils/filePath.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
const DATA_DIR_PATH = "src/data";
|
|
2
2
|
const STATIC_CONTENT_DIR_PATH = "src/content";
|
|
3
3
|
const DEFAULTS_DIR_PATH = "src/defaults";
|
|
4
|
-
const
|
|
4
|
+
const PAGES_DIR_PATH = "src/pages";
|
|
5
|
+
const CONTENT_PAGES_PATH_NAME = `content-pages`;
|
|
6
|
+
const CONTENT_PAGES_DIR_PATH = `${PAGES_DIR_PATH}/${CONTENT_PAGES_PATH_NAME}`;
|
|
5
7
|
const STYLES_DIR_PATH = "src/styles";
|
|
6
8
|
const DEFAULT_COLORS_FILE_PATH = `${DEFAULTS_DIR_PATH}/colors.json`;
|
|
7
9
|
const COLORS_FILE_PATH = `${DATA_DIR_PATH}/colors.json`;
|
|
@@ -33,7 +35,6 @@ const VOTEABLE_PRESENTATIONS_FILE_NAME = "voteable-presentations.json";
|
|
|
33
35
|
const VOTEABLE_PRESENTATIONS_FILE_PATH = `${DATA_DIR_PATH}/${VOTEABLE_PRESENTATIONS_FILE_NAME}`;
|
|
34
36
|
const POSTERS_PAGES_FILE_PATH = `${STATIC_CONTENT_DIR_PATH}/posters-pages.json`;
|
|
35
37
|
const MARKETING_SETTINGS_FILE_PATH = `${DATA_DIR_PATH}/marketing-settings.json`;
|
|
36
|
-
const MAINTENANCE_FILE_PATH = `${STATIC_CONTENT_DIR_PATH}/maintenance.json`;
|
|
37
38
|
const EXPO_HALL_PAGE_FILE_PATH = `${STATIC_CONTENT_DIR_PATH}/expo-hall-page/index.json`;
|
|
38
39
|
const INVITATIONS_REJECT_PAGE_FILE_PATH = `${STATIC_CONTENT_DIR_PATH}/invitations-reject-page/index.json`;
|
|
39
40
|
const SPONSORS_FILE_NAME = "sponsors.json";
|
|
@@ -44,25 +45,27 @@ const APPLE_PAY_DOMAIN_FILE_PATH = `/static/.well-known/`
|
|
|
44
45
|
const APPLE_PAY_DOMAIN_FILE_NAME = `apple-developer-merchantid-domain-association`;
|
|
45
46
|
|
|
46
47
|
exports.REQUIRED_DIR_PATHS = [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
DATA_DIR_PATH,
|
|
49
|
+
STATIC_CONTENT_DIR_PATH,
|
|
50
|
+
CONTENT_PAGES_DIR_PATH,
|
|
51
|
+
STYLES_DIR_PATH,
|
|
52
|
+
SITE_SETTINGS_DIR_PATH,
|
|
53
|
+
MARKETING_PAGE_DIR_PATH,
|
|
54
|
+
LOBBY_PAGE_DIR_PATH,
|
|
55
|
+
INVITATIONS_REJECT_PAGE_FILE_PATH,
|
|
56
|
+
NAVBAR_DIR_PATH,
|
|
57
|
+
FOOTER_DIR_PATH
|
|
57
58
|
];
|
|
58
59
|
exports.STATIC_CONTENT_DIR_PATH = STATIC_CONTENT_DIR_PATH;
|
|
60
|
+
exports.PAGES_DIR_PATH = PAGES_DIR_PATH;
|
|
61
|
+
exports.CONTENT_PAGES_PATH_NAME = CONTENT_PAGES_PATH_NAME;
|
|
62
|
+
exports.CONTENT_PAGES_DIR_PATH = CONTENT_PAGES_DIR_PATH;
|
|
59
63
|
exports.DEFAULT_COLORS_FILE_PATH = DEFAULT_COLORS_FILE_PATH;
|
|
60
64
|
exports.COLORS_FILE_PATH = COLORS_FILE_PATH;
|
|
61
65
|
exports.COLORS_SASS_FILE_PATH = COLORS_SASS_FILE_PATH;
|
|
62
66
|
exports.FONTS_SCSS_FILE_PATH = FONTS_SCSS_FILE_PATH;
|
|
63
67
|
exports.SITE_SETTINGS_DIR_PATH = SITE_SETTINGS_DIR_PATH;
|
|
64
68
|
exports.SITE_SETTINGS_FILE_PATH = SITE_SETTINGS_FILE_PATH;
|
|
65
|
-
exports.CONTENT_PAGES_DIR_PATH = CONTENT_PAGES_DIR_PATH;
|
|
66
69
|
exports.MARKETING_PAGE_FILE_PATH = MARKETING_PAGE_FILE_PATH;
|
|
67
70
|
exports.LOBBY_PAGE_FILE_PATH = LOBBY_PAGE_FILE_PATH;
|
|
68
71
|
exports.ADS_FILE_PATH = ADS_FILE_PATH;
|
|
@@ -83,7 +86,6 @@ exports.VOTEABLE_PRESENTATIONS_FILE_NAME = VOTEABLE_PRESENTATIONS_FILE_NAME;
|
|
|
83
86
|
exports.VOTEABLE_PRESENTATIONS_FILE_PATH = VOTEABLE_PRESENTATIONS_FILE_PATH;
|
|
84
87
|
exports.POSTERS_PAGES_FILE_PATH = POSTERS_PAGES_FILE_PATH;
|
|
85
88
|
exports.MARKETING_SETTINGS_FILE_PATH = MARKETING_SETTINGS_FILE_PATH;
|
|
86
|
-
exports.MAINTENANCE_FILE_PATH = MAINTENANCE_FILE_PATH;
|
|
87
89
|
exports.EXPO_HALL_PAGE_FILE_PATH = EXPO_HALL_PAGE_FILE_PATH;
|
|
88
90
|
exports.INVITATIONS_REJECT_PAGE_FILE_PATH = INVITATIONS_REJECT_PAGE_FILE_PATH;
|
|
89
91
|
exports.SPONSORS_FILE_PATH = SPONSORS_FILE_PATH;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import sanitizeHtml from 'sanitize-html';
|
|
4
|
-
|
|
5
|
-
export const HTMLContent = ({ content, className }) => {
|
|
6
|
-
const [cleanHTML, setCleanHTML] = useState(content);
|
|
7
|
-
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
const clean = sanitizeHtml(content, {
|
|
10
|
-
// adds custom settings to default settings (https://www.npmjs.com/package/sanitize-html#default-options)
|
|
11
|
-
allowedTags: sanitizeHtml.defaults.allowedTags.concat(['iframe', 'img']),
|
|
12
|
-
allowedAttributes: {
|
|
13
|
-
...sanitizeHtml.defaults.allowedAttributes,
|
|
14
|
-
'iframe': ['src', 'width', 'height', 'frameborder', 'allow', 'allowfullscreen'],
|
|
15
|
-
'a': ['target'],
|
|
16
|
-
'*': ['href', 'class']
|
|
17
|
-
},
|
|
18
|
-
exclusiveFilter: (frame) => {
|
|
19
|
-
// removing a and p tags with no text or media childrens
|
|
20
|
-
return (frame.tag === 'a' || frame.tag === 'p') && !frame.text.trim() && !frame.mediaChildren;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
setCleanHTML(clean);
|
|
24
|
-
}, [content])
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<div className={className} dangerouslySetInnerHTML={{ __html: cleanHTML }} />
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const Content = ({ content, className }) => (
|
|
32
|
-
<div className={className}>{content}</div>
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
Content.propTypes = {
|
|
36
|
-
content: PropTypes.node,
|
|
37
|
-
className: PropTypes.string,
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
HTMLContent.propTypes = Content.propTypes
|
|
41
|
-
|
|
42
|
-
export default Content
|
package/src/pages/maintenance.md
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import { connect } from "react-redux";
|
|
4
|
-
import { graphql } from "gatsby";
|
|
5
|
-
import { Redirect } from "@gatsbyjs/reach-router";
|
|
6
|
-
import Seo from "../components/Seo";
|
|
7
|
-
import Layout from "../components/Layout";
|
|
8
|
-
import Content, { HTMLContent } from "../components/Content";
|
|
9
|
-
import { titleFromPathname } from "../utils/urlFormating";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import { USER_REQUIREMENTS } from "../cms/config/collections/contentPagesCollection"
|
|
13
|
-
|
|
14
|
-
export const ContentPageTemplate = ({
|
|
15
|
-
title,
|
|
16
|
-
content,
|
|
17
|
-
contentComponent
|
|
18
|
-
}) => {
|
|
19
|
-
const PageContent = contentComponent || Content
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<div className="content">
|
|
23
|
-
<h1>{title}</h1>
|
|
24
|
-
<PageContent content={content} />
|
|
25
|
-
</div>
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
ContentPageTemplate.propTypes = {
|
|
30
|
-
title: PropTypes.string,
|
|
31
|
-
content: PropTypes.string,
|
|
32
|
-
contentComponent: PropTypes.func,
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const ContentPage = ({ data, isLoggedUser, hasTicket, isAuthorized }) => {
|
|
36
|
-
const { frontmatter: {title, userRequirement}, html } = data.markdownRemark
|
|
37
|
-
// if isAuthorized byoass the AUTHZ check
|
|
38
|
-
if (!isAuthorized && (
|
|
39
|
-
(userRequirement === USER_REQUIREMENTS.loggedIn && !isLoggedUser) || (userRequirement === USER_REQUIREMENTS.hasTicket && !hasTicket)
|
|
40
|
-
)) {
|
|
41
|
-
return <Redirect to='/' noThrow />
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<Layout>
|
|
46
|
-
<ContentPageTemplate
|
|
47
|
-
contentComponent={HTMLContent}
|
|
48
|
-
title={title}
|
|
49
|
-
content={html}
|
|
50
|
-
/>
|
|
51
|
-
</Layout>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
ContentPage.propTypes = {
|
|
56
|
-
data: PropTypes.shape({
|
|
57
|
-
markdownRemark: PropTypes.shape({
|
|
58
|
-
frontmatter: PropTypes.object,
|
|
59
|
-
}),
|
|
60
|
-
}),
|
|
61
|
-
isLoggedUser: PropTypes.bool,
|
|
62
|
-
hasTicket: PropTypes.bool
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const mapStateToProps = ({ loggedUserState, userState }) => ({
|
|
66
|
-
isLoggedUser: loggedUserState.isLoggedUser,
|
|
67
|
-
hasTicket: userState.hasTicket,
|
|
68
|
-
isAuthorized: userState.isAuthorized
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
export default connect(mapStateToProps, null)(ContentPage);
|
|
72
|
-
|
|
73
|
-
export const contentPageQuery = graphql`
|
|
74
|
-
query ($id: String!) {
|
|
75
|
-
markdownRemark(id: { eq: $id }) {
|
|
76
|
-
html
|
|
77
|
-
frontmatter {
|
|
78
|
-
title
|
|
79
|
-
userRequirement
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
`;
|
|
84
|
-
|
|
85
|
-
export const Head = ({
|
|
86
|
-
location
|
|
87
|
-
}) => (
|
|
88
|
-
<Seo
|
|
89
|
-
title={titleFromPathname(location.pathname)}
|
|
90
|
-
location={location}
|
|
91
|
-
/>
|
|
92
|
-
);
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import maintenanceMode from "content/maintenance.json";
|
|
4
|
-
|
|
5
|
-
import HeroComponent from "../components/HeroComponent";
|
|
6
|
-
|
|
7
|
-
import "../styles/bulma.scss";
|
|
8
|
-
|
|
9
|
-
const MaintenancePageTemplate = ({
|
|
10
|
-
title,
|
|
11
|
-
subtitle
|
|
12
|
-
}) => {
|
|
13
|
-
return (
|
|
14
|
-
<HeroComponent
|
|
15
|
-
title={title}
|
|
16
|
-
subtitle={subtitle}
|
|
17
|
-
/>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
MaintenancePageTemplate.propTypes = {
|
|
22
|
-
title: PropTypes.string,
|
|
23
|
-
subtitle: PropTypes.string,
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const MaintenancePage = () => {
|
|
27
|
-
const {
|
|
28
|
-
title,
|
|
29
|
-
subtitle
|
|
30
|
-
} = maintenanceMode;
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<MaintenancePageTemplate
|
|
34
|
-
title={title}
|
|
35
|
-
subtitle={subtitle}
|
|
36
|
-
/>
|
|
37
|
-
)
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export default MaintenancePage;
|