From e61486fae96d7580b317fce06f19fac5200175ca Mon Sep 17 00:00:00 2001 From: neon <18559658+neonsolstice@users.noreply.github.com> Date: Tue, 17 Mar 2026 23:38:29 -0600 Subject: [PATCH] feat(stats): introduce statistics with charts, KPI summary, and filter --- client/package.json | 4 +- client/src/App.vue | 23 +- client/src/assets/theme/tokens.css | 47 ++- client/src/components/AppSidebar.vue | 8 + .../features/statistics/api/statistics.api.ts | 72 +++++ .../components/BooksAddedOverTimeChart.vue | 133 ++++++++ .../statistics/components/ChartCard.vue | 72 +++++ .../components/FormatDistributionChart.vue | 52 ++++ .../components/GenreDistributionChart.vue | 61 ++++ .../components/LanguageDistributionChart.vue | 52 ++++ .../components/MetadataCompletenessChart.vue | 62 ++++ .../components/PublicationDecadeChart.vue | 63 ++++ .../statistics/components/StatisticsGrid.vue | 83 +++++ .../statistics/components/StatisticsPage.vue | 220 +++++++++++++ .../components/StatisticsSummaryCard.vue | 69 +++++ .../components/StorageByFormatChart.vue | 63 ++++ .../statistics/components/TopAuthorsChart.vue | 61 ++++ .../composables/useBooksAddedOverTime.ts | 29 ++ .../composables/useFormatDistribution.ts | 29 ++ .../composables/useGenreDistribution.ts | 29 ++ .../composables/useLanguageDistribution.ts | 29 ++ .../composables/useMetadataCompleteness.ts | 29 ++ .../composables/usePublicationDecade.ts | 29 ++ .../composables/useStatisticsConfig.ts | 121 ++++++++ .../composables/useStatisticsSummary.ts | 27 ++ .../composables/useStorageByFormat.ts | 29 ++ .../statistics/composables/useTopAuthors.ts | 29 ++ client/src/lib/echarts.ts | 59 ++++ client/src/main.ts | 1 + client/src/router/index.ts | 5 + packages/types/src/auth.ts | 1 + packages/types/src/index.ts | 1 + packages/types/src/statistics.ts | 94 ++++++ server/src/app.module.ts | 2 + .../dto/books-over-time-query.dto.ts | 15 + .../dto/statistics-filter-query.dto.ts | 11 + .../statistics/statistics.controller.ts | 57 ++++ .../modules/statistics/statistics.module.ts | 11 + .../statistics/statistics.repository.ts | 293 ++++++++++++++++++ .../modules/statistics/statistics.service.ts | 105 +++++++ 40 files changed, 2168 insertions(+), 12 deletions(-) create mode 100644 client/src/features/statistics/api/statistics.api.ts create mode 100644 client/src/features/statistics/components/BooksAddedOverTimeChart.vue create mode 100644 client/src/features/statistics/components/ChartCard.vue create mode 100644 client/src/features/statistics/components/FormatDistributionChart.vue create mode 100644 client/src/features/statistics/components/GenreDistributionChart.vue create mode 100644 client/src/features/statistics/components/LanguageDistributionChart.vue create mode 100644 client/src/features/statistics/components/MetadataCompletenessChart.vue create mode 100644 client/src/features/statistics/components/PublicationDecadeChart.vue create mode 100644 client/src/features/statistics/components/StatisticsGrid.vue create mode 100644 client/src/features/statistics/components/StatisticsPage.vue create mode 100644 client/src/features/statistics/components/StatisticsSummaryCard.vue create mode 100644 client/src/features/statistics/components/StorageByFormatChart.vue create mode 100644 client/src/features/statistics/components/TopAuthorsChart.vue create mode 100644 client/src/features/statistics/composables/useBooksAddedOverTime.ts create mode 100644 client/src/features/statistics/composables/useFormatDistribution.ts create mode 100644 client/src/features/statistics/composables/useGenreDistribution.ts create mode 100644 client/src/features/statistics/composables/useLanguageDistribution.ts create mode 100644 client/src/features/statistics/composables/useMetadataCompleteness.ts create mode 100644 client/src/features/statistics/composables/usePublicationDecade.ts create mode 100644 client/src/features/statistics/composables/useStatisticsConfig.ts create mode 100644 client/src/features/statistics/composables/useStatisticsSummary.ts create mode 100644 client/src/features/statistics/composables/useStorageByFormat.ts create mode 100644 client/src/features/statistics/composables/useTopAuthors.ts create mode 100644 client/src/lib/echarts.ts create mode 100644 packages/types/src/statistics.ts create mode 100644 server/src/modules/statistics/dto/books-over-time-query.dto.ts create mode 100644 server/src/modules/statistics/dto/statistics-filter-query.dto.ts create mode 100644 server/src/modules/statistics/statistics.controller.ts create mode 100644 server/src/modules/statistics/statistics.module.ts create mode 100644 server/src/modules/statistics/statistics.repository.ts create mode 100644 server/src/modules/statistics/statistics.service.ts diff --git a/client/package.json b/client/package.json index aa7b1b696..ff4c16a80 100644 --- a/client/package.json +++ b/client/package.json @@ -29,6 +29,7 @@ "@vueuse/core": "^14.2.1", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", + "echarts": "^6.0.0", "lucide-vue-next": "^0.577.0", "pdfjs-dist": "^5.5.207", "pinia": "^3.0.4", @@ -38,6 +39,7 @@ "tailwindcss": "^4.2.1", "vue": "^3.5.30", "vue-draggable-plus": "^0.6.1", + "vue-echarts": "^8.0.1", "vue-router": "^5.0.3", "vue-sonner": "^2.0.9", "vue-virtual-scroller": "^1.1.2" @@ -66,7 +68,7 @@ "vite": "^8.0.0", "vite-plugin-vue-devtools": "^8.1.0", "vitest": "^4.1.0", - "vue-tsc": "^3.2.5" + "vue-tsc": "^3.2.6" }, "engines": { "node": "^20.19.0 || >=22.12.0" diff --git a/client/src/App.vue b/client/src/App.vue index 458c497c8..413768c88 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -1,12 +1,33 @@