Skip to content

feat(admin): Complete user insights - #113

Merged
nfebe merged 3 commits into
devfrom
feat/admin-engagement-insights
Aug 19, 2026
Merged

nfebe merged 3 commits into
devfrom
feat/admin-engagement-insights

Conversation

@nfebe

@nfebe nfebe commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

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.

nfebe added 2 commits August 18, 2026 21:56
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.
@sourceant

sourceant Bot commented Aug 18, 2026

Copy link
Copy Markdown

Code Review Summary

This 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

  • Extracted table and pagination logic into TDataTable and TPagination for reuse in ContentTable.vue and pages/admin/index.vue.
  • Implemented server-side pagination and search for the user directory in services/api/adminApi.ts.
  • Added AI token usage tracking and visualization.

💡 Minor Suggestions

  • The is-default row styling in TDataTable relies on a specific CSS class name; consider making this more generic or configurable if the component is used outside the context of 'Default' items.
  • Ensure fmt is defined to avoid runtime errors (noted in previous feedback).

🚨 Critical Issues

  • Missing metricByKey helper in pages/admin/index.vue script section.

@sourceant sourceant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. See the overview comment for a summary.

Comment thread pages/admin/index.vue Outdated

<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';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
import { ref, computed, onMounted, watch, h, defineAsyncComponent, type Component } from 'vue';
import { ref, computed, onMounted, onBeforeUnmount, watch, h, defineAsyncComponent, type Component } from 'vue';

Comment thread pages/admin/index.vue
};

const formatDate = (iso: string): string => (iso ? new Date(iso).toLocaleDateString() : '');
const formatDateTime = (iso: string): string =>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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);

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploying trakli-dev with  Cloudflare Pages  Cloudflare Pages

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

View logs

User search no longer leaves a delayed request behind when the admin page closes.

@sourceant sourceant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. See the overview comment for a summary.

Comment thread pages/admin/index.vue
@@ -330,8 +391,34 @@ const loading = ref(true);
const metricsError = ref('');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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[]>([]);

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying webui with  Cloudflare Pages  Cloudflare Pages

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

View logs

@nfebe
nfebe merged commit 6f6a0d4 into dev Aug 19, 2026
6 checks passed
@nfebe
nfebe deleted the feat/admin-engagement-insights branch August 19, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant