From 62e85e4a3edd17eb0d95e8fe8ee979261ce19474 Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Fri, 6 Feb 2026 17:58:18 -0500 Subject: [PATCH 1/4] feat: add social likes facet to package trends charts Generalize the download analytics chart into a trends chart that supports both downloads and likes, extensibly allowing for more facets in the future. - Add a facet selector (Downloads / Likes) shown on Compare page and in the single-package chart modal - Add server endpoint and utility for fetching per-package likes evolution from ATProto --- app/components/Compare/LineChart.vue | 4 +- app/components/Package/ChartModal.vue | 8 +- ...{DownloadAnalytics.vue => TrendsChart.vue} | 339 +++++++++++------- .../Package/WeeklyDownloadStats.vue | 11 +- app/composables/useCharts.ts | 192 ++++++---- i18n/locales/ar.json | 3 +- i18n/locales/az-AZ.json | 3 +- i18n/locales/bn-IN.json | 3 +- i18n/locales/cs-CZ.json | 3 +- i18n/locales/de-DE.json | 3 +- i18n/locales/en.json | 10 +- i18n/locales/es.json | 3 +- i18n/locales/fr-FR.json | 28 +- i18n/locales/hi-IN.json | 3 +- i18n/locales/hu-HU.json | 3 +- i18n/locales/id-ID.json | 3 +- i18n/locales/it-IT.json | 3 +- i18n/locales/ja-JP.json | 3 +- i18n/locales/ne-NP.json | 3 +- i18n/locales/no-NO.json | 3 +- i18n/locales/pl-PL.json | 3 +- i18n/locales/pt-BR.json | 3 +- i18n/locales/ru-RU.json | 3 +- i18n/locales/te-IN.json | 3 +- i18n/locales/uk-UA.json | 3 +- i18n/locales/zh-CN.json | 3 +- i18n/locales/zh-TW.json | 3 +- i18n/schema.json | 12 +- lunaria/files/ar-EG.json | 3 +- lunaria/files/az-AZ.json | 3 +- lunaria/files/bn-IN.json | 3 +- lunaria/files/cs-CZ.json | 3 +- lunaria/files/de-DE.json | 3 +- lunaria/files/en-GB.json | 10 +- lunaria/files/en-US.json | 10 +- lunaria/files/es-419.json | 3 +- lunaria/files/es-ES.json | 3 +- lunaria/files/fr-FR.json | 10 +- lunaria/files/hi-IN.json | 3 +- lunaria/files/hu-HU.json | 3 +- lunaria/files/id-ID.json | 3 +- lunaria/files/it-IT.json | 3 +- lunaria/files/ja-JP.json | 3 +- lunaria/files/ne-NP.json | 3 +- lunaria/files/no-NO.json | 3 +- lunaria/files/pl-PL.json | 3 +- lunaria/files/pt-BR.json | 3 +- lunaria/files/ru-RU.json | 3 +- lunaria/files/te-IN.json | 3 +- lunaria/files/uk-UA.json | 3 +- lunaria/files/zh-CN.json | 3 +- lunaria/files/zh-TW.json | 3 +- .../social/likes-evolution/[...pkg].get.ts | 12 + server/utils/atproto/utils/likes.ts | 96 ++++- test/nuxt/a11y.spec.ts | 22 +- .../PackageWeeklyDownloadStats.spec.ts | 2 +- test/nuxt/composables/use-charts.spec.ts | 74 ++++ test/unit/app/composables/use-charts.spec.ts | 156 ++++++++ .../unit/server/utils/likes-evolution.spec.ts | 172 +++++++++ 59 files changed, 945 insertions(+), 346 deletions(-) rename app/components/Package/{DownloadAnalytics.vue => TrendsChart.vue} (88%) create mode 100644 server/api/social/likes-evolution/[...pkg].get.ts create mode 100644 test/nuxt/composables/use-charts.spec.ts create mode 100644 test/unit/app/composables/use-charts.spec.ts create mode 100644 test/unit/server/utils/likes-evolution.spec.ts diff --git a/app/components/Compare/LineChart.vue b/app/components/Compare/LineChart.vue index 042dd9ed7..deeda8ed9 100644 --- a/app/components/Compare/LineChart.vue +++ b/app/components/Compare/LineChart.vue @@ -1,5 +1,5 @@ +