PrestaShop / TopTranslators

Top translators tribute page
https://translators.prestashop-project.org/
0 stars 3 forks source link

Change front/ Vite dynamic app to front/ PHP static app #76

Closed matks closed 5 months ago

matks commented 5 months ago
Questions Answers
Description? See below
Type? new feature
Fixed ticket? Fixes https://github.com/PrestaShop/TopTranslators/issues/65
Sponsor company
How to test? CD should run

Description

Background

As discussed here, the website TopTranslators is currently a Vite application that consumes a statistics.json file and then uses it to render, in the browser, the ranking of translators.

It means if one thousand visitors open the webpage, then we generate one thousand times the same view in each of these thousand browsers. It's a waste of CPU πŸ˜„ .

I have asked @JingFerment to solve this problem by rewriting the front/ application into a static file generator.

New implementation

She rewrote the website from scratch, removing dependencies like Vue or Vite to simply build a static HTML page that uses jQuery, Bootstrap and a few custom CSS and JS. Then she used PHP to parse the statistics.json file and render the page, once for every visitor. The rendered HTML page is then deployed on GitHub page. If one thousand visitors open the webpage, they simply see the same HTML page, already rendered. No more waste of CPU.

This PR introduces the above HTML template and PHP rendering logic as well as the GitHub Action changes.

She also fixed the responsive behavior and some data issues like duplicates πŸ‘