Skip to content

Commit e2acece

Browse files
authored
website: Display 2025 survey results on the website (#8258)
* Add survey data * Add survey results pages with recharts for plots Some simple cross year comparisons have been added too where data was available for the inspection of trends. Signed-off-by: Charlie Egan <charlie_egan@apple.com>
1 parent 0fed5e8 commit e2acece

144 files changed

Lines changed: 3799 additions & 8 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/docusaurus.config.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const path = require("path");
77

88
import { loadPages } from "./src/lib/ecosystem/loadPages.js";
99
import { loadRules } from "./src/lib/projects/regal/loadRules.js";
10+
import { loadSurveyEventData, loadSurveyQuestions, loadSurveyEventMetadata } from "./src/lib/surveys/loadSurveyData.js";
1011

1112
const baseUrl = "/";
1213

@@ -132,6 +133,7 @@ const baseUrl = "/";
132133
{ to: "/security", label: "Security" },
133134
{ to: "/support", label: "Support" },
134135
{ to: "/community", label: "Community" },
136+
{ to: "/survey", label: "Survey" },
135137
{ href: "https://blog.openpolicyagent.org/", label: "Blog" },
136138
],
137139
},
@@ -536,6 +538,50 @@ The Linux Foundation has registered trademarks and uses trademarks. For a list o
536538
},
537539
};
538540
},
541+
542+
async function surveyData(context, options) {
543+
return {
544+
name: "survey-data",
545+
546+
async loadContent() {
547+
const eventData = await loadSurveyEventData(
548+
path.join(context.siteDir, "src/data/surveys/events/**/**/data.json")
549+
);
550+
const questions = await loadSurveyQuestions(
551+
path.join(context.siteDir, "src/data/surveys/questions/**/data.json")
552+
);
553+
const eventMetadata = await loadSurveyEventMetadata(
554+
path.join(context.siteDir, "src/data/surveys/events/**/metadata.json")
555+
);
556+
557+
return { eventData, questions, eventMetadata };
558+
},
559+
560+
async contentLoaded({ content, actions }) {
561+
const { createData, addRoute } = actions;
562+
const { eventData, questions, eventMetadata } = content;
563+
564+
await createData("survey-event-data.json", JSON.stringify(eventData, null, 2));
565+
await createData("survey-questions.json", JSON.stringify(questions, null, 2));
566+
await createData("survey-event-metadata.json", JSON.stringify(eventMetadata, null, 2));
567+
568+
// Create a page for each event
569+
const eventSlugs = Object.keys(eventData);
570+
await Promise.all(
571+
eventSlugs.map(async (eventSlug) => {
572+
const routePath = path.join(baseUrl, `/survey/${eventSlug}`);
573+
return addRoute({
574+
path: routePath,
575+
component: require.resolve("./src/SurveyEvent/index.js"),
576+
exact: true,
577+
modules: {},
578+
customData: { eventSlug },
579+
});
580+
}),
581+
);
582+
},
583+
};
584+
},
539585
],
540586
clientModules: [
541587
require.resolve("./src/lib/playground.js"),

0 commit comments

Comments
 (0)