asyncapi / website

AsyncAPI specification website
https://www.asyncapi.com
Apache License 2.0
494 stars 639 forks source link

Individual case study view has hardcodes that need to be refactored #1505

Closed derberg closed 1 year ago

derberg commented 1 year ago

Reason/Context

Case study example: https://www.asyncapi.com/casestudies/adeogroup Code responsible for rendering: https://github.com/asyncapi/website/blob/master/pages/casestudies/%5Bid%5D.js Structure it operates on: https://github.com/asyncapi/website/blob/master/config/casestudies/adeo.yml

Some structures are arrays like: https://github.com/asyncapi/website/blob/master/config/casestudies/adeo.yml#L10 In this example you see that in case study we can have an array of contact points. But in code it is hardcoded to read only the first contact:

<Link href={casestudy.company.contact[0].link}>
    <a className="text-secondary-500 underline hover:text-gray-800 font-medium transition ease-in-out duration-300" target="_blank">
        {casestudy.company.contact[0].name}
    </a>
</Link>

Description

Yeah just refactor the code to support rendering or all elements of the array wherever it is available.

If there is some repetition, feel free to extract some code to reusable components

reachaadrika commented 1 year ago

Hey @derberg Can I work on this.

derberg commented 1 year ago

@reachaadrika please 🙏

Ciggzy1312 commented 1 year ago

Hey @derberg I see no progress on this issue for 3 weeks Mind if I take it up?

derberg commented 1 year ago

@Ciggzy1312 please go ahead

Shurtu-gal commented 1 year ago

@derberg Instead of yaml can't we use markdown in case studies similar to blogs.

derberg commented 1 year ago

Hey, I picked YAML instead of MD to get data in a structured way that is very easy to read in the front end so we can build different UIs out of one data set. now we just list all items from the YAML file in a given case study. Idea is that long term when we have many case studies, we can have a UI where we for example render only highlight on how different companies do schema versioning, or for example what are their use cases for AsyncAPI. So extracting info is much easier and user friendly, rather than you know, clicking through every case study one by one

Shurtu-gal commented 1 year ago

@derberg I have further reduced the repeated codein the above PR. Do give me some suggestions if it can be improved further.