feat(admin): Complete user insights - #113
Conversation
Main and administrative tables now share consistent presentation and paging behavior.
Administrators can inspect registration trends, user activity, and token consumption. Outreach history is available from the same paginated view.
Code Review SummaryThis PR implements a comprehensive admin console update, moving from client-side filtering to server-side pagination and search. It also introduces centralized UI components for data display and adds insights for AI usage. 🚀 Key Improvements
💡 Minor Suggestions
🚨 Critical Issues
|
|
|
||
| <script setup lang="ts"> | ||
| import { ref, computed, onMounted, h, defineAsyncComponent, type Component } from 'vue'; | ||
| import { ref, computed, onMounted, watch, h, defineAsyncComponent, type Component } from 'vue'; |
There was a problem hiding this comment.
Import onBeforeUnmount to ensure the search debounce timer can be properly cleaned up, preventing potential memory leaks or state updates after the component is destroyed.
| import { ref, computed, onMounted, watch, h, defineAsyncComponent, type Component } from 'vue'; | |
| import { ref, computed, onMounted, onBeforeUnmount, watch, h, defineAsyncComponent, type Component } from 'vue'; |
| }; | ||
|
|
||
| const formatDate = (iso: string): string => (iso ? new Date(iso).toLocaleDateString() : ''); | ||
| const formatDateTime = (iso: string): string => |
There was a problem hiding this comment.
The fmt helper is used in multiple places in the template (lines 171, 274, 296, 463) but is not defined in the script. This will result in a runtime error when rendering the user list or usage metrics. Adding a local formatter using Intl.NumberFormat is recommended.
| const formatDateTime = (iso: string): string => | |
| const formatDateTime = (iso: string): string => | |
| iso ? new Date(iso).toLocaleString([], { dateStyle: 'medium', timeStyle: 'short' }) : ''; | |
| const fmt = (val?: number | null): string => new Intl.NumberFormat().format(val ?? 0); |
Deploying trakli-dev with
|
| Latest commit: |
5a1de66
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://4ed10bbc.trakli-dev.pages.dev |
| Branch Preview URL: | https://feat-admin-engagement-insigh.trakli-dev.pages.dev |
User search no longer leaves a delayed request behind when the admin page closes.
| @@ -330,8 +391,34 @@ const loading = ref(true); | |||
| const metricsError = ref(''); | |||
There was a problem hiding this comment.
The metricByKey helper is used in multiple new computed properties and template locations (lines 274, 472, 485) but is not defined in the script block. This will cause a runtime error when accessing the AI usage or metrics overview.
| const metricsError = ref(''); | |
| const metricsError = ref(''); | |
| const report = ref<EngagementReport | null>(null); | |
| const metricByKey = (key: string) => | |
| report.value?.groups.flatMap((g) => g.metrics).find((m) => m.key === key); | |
| const users = ref<AdminUser[]>([]); |
Deploying webui with
|
| Latest commit: |
5a1de66
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d92c7e9f.webui-9fh.pages.dev |
| Branch Preview URL: | https://feat-admin-engagement-insigh.webui-9fh.pages.dev |
Completes the admin console with searchable, paginated user engagement and AI usage data. Shared table and pagination components keep the admin and main app consistent.