Skip to content

Commit

Permalink
fix: move it to staticHelpers
Browse files Browse the repository at this point in the history
  • Loading branch information
Shurtu-gal committed Oct 1, 2023
1 parent ebe5629 commit e1dc71c
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 107 deletions.
106 changes: 106 additions & 0 deletions lib/staticHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,109 @@ export function getEvents(events, size) {

return meetingsWithDates;
}

export const generateCaseStudyContent = (data) => {
const { challenges, solution, usecase, architecture, testing, codegen, schemaStorage, registry, versioning, validation, asyncapiStorage, asyncapiEditing, asyncapiExtensions, asyncapiDocumentation, asyncapiBindings, asyncapiTools, additionalResources, casestudy } = data;
const languages= casestudy.technical.languages
const frameworks=casestudy.technical.frameworks
const protocols=casestudy.technical.protocols
const versions=casestudy.asyncapi.versions

return [
{
title: "Challenges",
content: challenges,
},
{
title: "Solution",
content: solution,
},
{
title: "Use Case",
content: usecase,
},
{
title: "More Details",
items: [
`Languages: ${languages.join(", ")}`,
`Frameworks: ${frameworks.join(", ")}`,
`Protocols: ${protocols.join(", ")}`,
],
children: [
{
title: "Testing strategy",
content: testing,
},
{
title: "Approach to code generation",
content: codegen,
},
{
title: "Architecture",
content: architecture,
},
{
title: "More Details about AsyncAPI",
items: [
`Version: ${versions.join(", ")}`,
`Who maintains documents: ${casestudy.asyncapi.maintainers}}`,
`Internal users: ${casestudy.asyncapi.audience.internal.toString()}`,
`External users: ${casestudy.asyncapi.audience.external.toString()}`,
],
children: [
{
title: "How AsyncAPI documents are stored",
content: asyncapiStorage,
},
{
title: "Where maintainers edit AsyncAPI documents",
content: asyncapiEditing,
},
{
title: "What extensions are used",
content: asyncapiExtensions,
},
{
title: "How documentation is generated",
content: asyncapiDocumentation,
},
{
title: "What bindings are used",
content: asyncapiBindings,
},
{
title: "What tools are used",
content: asyncapiTools,
},
],
},
{
title: "Schemas",
items: [`Spec: ${casestudy.schemas.description}`],
children: [
{
title: "Storage strategy",
content: schemaStorage,
},
{
title: "Schema Registry",
content: registry,
},
{
title: "Versioning of schemas",
content: versioning,
},
{
title: "Validation of message schemas",
content: validation,
},
{
title: "Additional Resources",
content: additionalResources,
},
],
},
],
},
];
}
4 changes: 2 additions & 2 deletions pages/casestudies/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getMDXComponents } from "../../components/MDX.js";
import { serialize } from "next-mdx-remote/serialize";
import GenericLayout from "../../components/layout/GenericLayout";
import CaseTOC from "../../components/CaseTOC";
import Container from "../../components/layout/Container";
import { generateCaseStudyContent } from "../../lib/staticHelpers";

const renderContent = (content, allComponents, level) => {
const typeStyle =
Expand Down Expand Up @@ -113,7 +113,7 @@ function Index({
const allComponents = getMDXComponents();
const contacts = casestudy.company.contact;

const content = generateContent({
const content = generateCaseStudyContent({
challenges,
solution,
usecase,
Expand Down
105 changes: 0 additions & 105 deletions pages/casestudies/utils.js

This file was deleted.

0 comments on commit e1dc71c

Please sign in to comment.