@openeventkit/event-site 2.0.107 → 2.0.108-beta.10
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} +49 -14
- package/gatsby-node.js +39 -68
- package/package.json +16 -10
- package/src/cms/cms-utils.js +15 -8
- package/src/cms/cms.js +1 -1
- package/src/cms/config/collections/contentPagesCollection/typeDefs.js +8 -1
- package/src/cms/preview-templates/ContentPagePreview.js +41 -13
- package/src/cms/widgets/IdentityProviderParamControl.js +1 -1
- 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
- package/static/admin/admin.css +0 -3
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
import path, { dirname } from "path";
|
|
2
|
+
import dotenv from "dotenv";
|
|
3
|
+
import { createRequire } from "module";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
import webpack from "webpack";
|
|
6
|
+
import remarkGfm from "remark-gfm";
|
|
2
7
|
|
|
3
|
-
require(
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
9
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
|
|
11
|
+
dotenv.config({
|
|
4
12
|
path: `.env.${process.env.NODE_ENV}`
|
|
5
13
|
});
|
|
6
14
|
|
|
7
15
|
const {
|
|
8
16
|
STATIC_CONTENT_DIR_PATH,
|
|
17
|
+
PAGES_DIR_PATH,
|
|
9
18
|
CONTENT_PAGES_DIR_PATH,
|
|
19
|
+
CONTENT_PAGES_PATH_NAME,
|
|
10
20
|
SITE_SETTINGS_FILE_PATH,
|
|
11
21
|
SITE_SETTINGS_DIR_PATH,
|
|
12
22
|
MARKETING_SETTINGS_FILE_PATH
|
|
@@ -117,28 +127,42 @@ const plugins = [
|
|
|
117
127
|
name: "marketingSettings"
|
|
118
128
|
}
|
|
119
129
|
},
|
|
130
|
+
{
|
|
131
|
+
resolve: "gatsby-plugin-page-creator",
|
|
132
|
+
options: {
|
|
133
|
+
path: path.resolve(PAGES_DIR_PATH),
|
|
134
|
+
ignore: [`**/${CONTENT_PAGES_PATH_NAME}/**`],
|
|
135
|
+
}
|
|
136
|
+
},
|
|
120
137
|
"gatsby-plugin-image",
|
|
121
138
|
"gatsby-plugin-sharp",
|
|
122
139
|
"gatsby-transformer-sharp",
|
|
123
140
|
"gatsby-transformer-json",
|
|
124
141
|
{
|
|
125
|
-
resolve: "gatsby-
|
|
142
|
+
resolve: "gatsby-plugin-mdx",
|
|
126
143
|
options: {
|
|
127
|
-
|
|
144
|
+
extensions: [".mdx", ".md"],
|
|
145
|
+
gatsbyRemarkPlugins: [
|
|
128
146
|
{
|
|
129
147
|
resolve: "gatsby-remark-images",
|
|
130
148
|
options: {
|
|
131
|
-
// It
|
|
149
|
+
// It's important to specify the maxWidth (in pixels) of
|
|
132
150
|
// the content container as this plugin uses this as the
|
|
133
151
|
// base for generating different widths of each image.
|
|
134
152
|
maxWidth: 2048
|
|
135
153
|
}
|
|
136
154
|
}
|
|
137
|
-
]
|
|
155
|
+
],
|
|
156
|
+
mdxOptions: {
|
|
157
|
+
remarkPlugins: [
|
|
158
|
+
// Add GitHub Flavored Markdown (GFM) support
|
|
159
|
+
remarkGfm
|
|
160
|
+
]
|
|
161
|
+
}
|
|
138
162
|
}
|
|
139
163
|
},
|
|
140
164
|
{
|
|
141
|
-
resolve: "gatsby-plugin-
|
|
165
|
+
resolve: "gatsby-plugin-decap-cms",
|
|
142
166
|
options: {
|
|
143
167
|
modulePath: `${__dirname}/src/cms/cms.js`,
|
|
144
168
|
manualInit: true,
|
|
@@ -181,9 +205,21 @@ const plugins = [
|
|
|
181
205
|
...config.resolve,
|
|
182
206
|
fallback: {
|
|
183
207
|
...config.resolve.fallback,
|
|
184
|
-
|
|
208
|
+
fs: false,
|
|
209
|
+
path: require.resolve("path-browserify"),
|
|
210
|
+
assert: require.resolve("assert"),
|
|
211
|
+
"object.assign/polyfill": require.resolve("object.assign/polyfill")
|
|
185
212
|
}
|
|
186
213
|
};
|
|
214
|
+
config.plugins = [
|
|
215
|
+
...config.plugins,
|
|
216
|
+
new webpack.ProvidePlugin({
|
|
217
|
+
process: "process/browser"
|
|
218
|
+
}),
|
|
219
|
+
new webpack.ProvidePlugin({
|
|
220
|
+
Buffer: ["buffer", "Buffer"]
|
|
221
|
+
})
|
|
222
|
+
];
|
|
187
223
|
}
|
|
188
224
|
}
|
|
189
225
|
},
|
|
@@ -191,10 +227,9 @@ const plugins = [
|
|
|
191
227
|
"gatsby-plugin-netlify", // make sure to keep it last in the array
|
|
192
228
|
];
|
|
193
229
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
description
|
|
198
|
-
},
|
|
199
|
-
plugins
|
|
230
|
+
const siteMetadata = {
|
|
231
|
+
title,
|
|
232
|
+
description
|
|
200
233
|
};
|
|
234
|
+
|
|
235
|
+
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,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openeventkit/event-site",
|
|
3
3
|
"description": "Event Site",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.108-beta.10",
|
|
5
5
|
"author": "Tipit LLC",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@
|
|
7
|
+
"@mdx-js/react": "^3.0.1",
|
|
8
|
+
"@mdx-js/runtime": "^1.6.22",
|
|
9
|
+
"@mui/base": "^5.0.0-beta.40",
|
|
8
10
|
"@mux/mux-player-react": "^1.14.1",
|
|
9
11
|
"@ncwidgets/file-relation": "^0.8.0",
|
|
10
12
|
"@ncwidgets/id": "^0.8.1",
|
|
@@ -22,6 +24,7 @@
|
|
|
22
24
|
"@types/react": "^16.9.42",
|
|
23
25
|
"@vimeo/player": "^2.16.3",
|
|
24
26
|
"ably": "^1.2.34",
|
|
27
|
+
"assert": "^2.1.0",
|
|
25
28
|
"attendee-to-attendee-widget": "3.0.6",
|
|
26
29
|
"awesome-bootstrap-checkbox": "^1.0.1",
|
|
27
30
|
"axios": "^0.19.2",
|
|
@@ -36,6 +39,8 @@
|
|
|
36
39
|
"core-js": "^2.6.11",
|
|
37
40
|
"cross-env": "^7.0.3",
|
|
38
41
|
"crypto-js": "^4.1.1",
|
|
42
|
+
"decap-cms-app": "^3.1.10",
|
|
43
|
+
"decap-cms-lib-widgets": "^3.0.2",
|
|
39
44
|
"disqus-react": "1.0.10",
|
|
40
45
|
"dotenv": "^8.2.0",
|
|
41
46
|
"dropzone": "^5.7.2",
|
|
@@ -44,19 +49,21 @@
|
|
|
44
49
|
"font-awesome": "^4.7.0",
|
|
45
50
|
"formik": "^2.2.9",
|
|
46
51
|
"full-schedule-widget": "3.0.5",
|
|
47
|
-
"gatsby": "^5.
|
|
52
|
+
"gatsby": "^5.9.1",
|
|
48
53
|
"gatsby-alias-imports": "^1.0.6",
|
|
54
|
+
"gatsby-plugin-decap-cms": "^4.0.4",
|
|
49
55
|
"gatsby-plugin-google-tagmanager": "^5.13.1",
|
|
50
56
|
"gatsby-plugin-image": "^3.8.0",
|
|
51
57
|
"gatsby-plugin-manifest": "^5.12.3",
|
|
58
|
+
"gatsby-plugin-mdx": "^5.12.3",
|
|
52
59
|
"gatsby-plugin-netlify": "^5.1.0",
|
|
53
60
|
"gatsby-plugin-netlify-cms": "^7.8.0",
|
|
61
|
+
"gatsby-plugin-page-creator": "^5.13.1",
|
|
54
62
|
"gatsby-plugin-sass": "^6.8.0",
|
|
55
63
|
"gatsby-plugin-sharp": "^5.12.3",
|
|
56
64
|
"gatsby-remark-images": "^7.8.0",
|
|
57
|
-
"gatsby-source-filesystem": "^5.
|
|
58
|
-
"gatsby-transformer-json": "^5.
|
|
59
|
-
"gatsby-transformer-remark": "^6.8.0",
|
|
65
|
+
"gatsby-source-filesystem": "^5.12.3",
|
|
66
|
+
"gatsby-transformer-json": "^5.12.3",
|
|
60
67
|
"gatsby-transformer-sharp": "^5.12.3",
|
|
61
68
|
"history": "^4.10.1",
|
|
62
69
|
"i18n-react": "^0.6.4",
|
|
@@ -76,8 +83,7 @@
|
|
|
76
83
|
"markdown-to-jsx": "^7.3.2",
|
|
77
84
|
"moment": "^2.27.0",
|
|
78
85
|
"moment-timezone": "^0.5.31",
|
|
79
|
-
"
|
|
80
|
-
"netlify-cms-lib-widgets": "^1.8.0",
|
|
86
|
+
"object.assign": "^4.1.5",
|
|
81
87
|
"openstack-uicore-foundation": "4.1.76",
|
|
82
88
|
"path-browserify": "^1.0.1",
|
|
83
89
|
"prop-types": "^15.6.0",
|
|
@@ -110,7 +116,7 @@
|
|
|
110
116
|
"redux": "^4.1.2",
|
|
111
117
|
"redux-persist": "^6.0.0",
|
|
112
118
|
"redux-thunk": "^2.4.1",
|
|
113
|
-
"
|
|
119
|
+
"remark-gfm": "^4.0.0",
|
|
114
120
|
"sass": "^1.49.9",
|
|
115
121
|
"schedule-filter-widget": "3.0.1",
|
|
116
122
|
"simple-chat-widget": "^1.0.31",
|
|
@@ -122,7 +128,7 @@
|
|
|
122
128
|
"stream-browserify": "^3.0.0",
|
|
123
129
|
"stream-chat": "^2.7.2",
|
|
124
130
|
"stream-chat-react": "3.1.7",
|
|
125
|
-
"summit-registration-lite": "5.0.
|
|
131
|
+
"summit-registration-lite": "5.0.30",
|
|
126
132
|
"superagent": "8.0.9",
|
|
127
133
|
"sweetalert2": "^9.17.0",
|
|
128
134
|
"upcoming-events-widget": "3.0.5",
|
package/src/cms/cms-utils.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
/*
|
|
2
|
+
Workaround for text editor
|
|
3
|
+
@see https://github.com/decaporg/decap-cms/issues/5092
|
|
4
|
+
*/
|
|
5
|
+
const injectCustomStyle = () => {
|
|
6
|
+
const style = document.createElement("style");
|
|
7
|
+
style.innerHTML = `
|
|
8
|
+
div[data-slate-editor] {
|
|
9
|
+
-webkit-user-modify: read-write !important;
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
document.head.appendChild(style);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
injectCustomStyle();
|
package/src/cms/cms.js
CHANGED
|
@@ -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,49 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import MDX from "@mdx-js/runtime";
|
|
4
|
+
import ContentPageTemplate from "../../templates/content-page/template";
|
|
5
|
+
import shortcodes from "../../templates/content-page/shortcodes";
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
// function to transform content by replacing relative image URLs with absolute ones
|
|
8
|
+
const transformContent = (mdx, getAsset) => {
|
|
9
|
+
// regex to identify Markdown image tags 
|
|
10
|
+
const imageRegex = /!\[([^\]]*)\]\(([^)]+)\)/g;
|
|
11
|
+
|
|
12
|
+
return mdx.replace(imageRegex, (match, alt, url) => {
|
|
13
|
+
// check if the URL is relative (does not start with http:// or https://)
|
|
14
|
+
if (!url.startsWith("http://") && !url.startsWith("https://")) {
|
|
15
|
+
const asset = getAsset(url);
|
|
16
|
+
if (asset && asset.url) {
|
|
17
|
+
return ``;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return match; // return the original match if it's already an absolute URL
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// function to render transformed content with MDX
|
|
25
|
+
const renderContent = (mdx, getAsset) => (
|
|
26
|
+
<MDX components={shortcodes}>
|
|
27
|
+
{transformContent(mdx, getAsset)}
|
|
28
|
+
</MDX>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const ContentPagePreview = ({ entry, getAsset }) => {
|
|
32
|
+
const title = entry.getIn(["data", "title"]);
|
|
33
|
+
const body = entry.getIn(["data", "body"]);
|
|
6
34
|
return (
|
|
7
35
|
<ContentPageTemplate
|
|
8
|
-
title={
|
|
9
|
-
content={
|
|
36
|
+
title={title}
|
|
37
|
+
content={renderContent(body, getAsset)}
|
|
10
38
|
/>
|
|
11
|
-
)
|
|
12
|
-
}
|
|
39
|
+
);
|
|
40
|
+
};
|
|
13
41
|
|
|
14
42
|
ContentPagePreview.propTypes = {
|
|
15
43
|
entry: PropTypes.shape({
|
|
16
|
-
getIn: PropTypes.func
|
|
17
|
-
}),
|
|
18
|
-
getAsset: PropTypes.func
|
|
19
|
-
}
|
|
44
|
+
getIn: PropTypes.func.isRequired
|
|
45
|
+
}).isRequired,
|
|
46
|
+
getAsset: PropTypes.func.isRequired
|
|
47
|
+
};
|
|
20
48
|
|
|
21
|
-
export default ContentPagePreview
|
|
49
|
+
export default ContentPagePreview;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useState, useEffect } from "react";
|
|
2
|
-
import CMS from "netlify-cms-app";
|
|
3
2
|
import PropTypes from "prop-types";
|
|
4
3
|
import ImmutablePropTypes from "react-immutable-proptypes";
|
|
5
4
|
import { List } from "immutable";
|
|
5
|
+
import CMS from "decap-cms-app";
|
|
6
6
|
|
|
7
7
|
const StringControl = CMS.getWidget("string").control;
|
|
8
8
|
const SelectControl = CMS.getWidget("select").control;
|
|
@@ -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;
|
package/static/admin/admin.css
DELETED