Skip to content

Full admin console revamp#1

Merged
Rezwoan merged 1 commit into
mainfrom
admin-revamp
Jun 10, 2026
Merged

Full admin console revamp#1
Rezwoan merged 1 commit into
mainfrom
admin-revamp

Conversation

@Rezwoan

@Rezwoan Rezwoan commented Jun 10, 2026

Copy link
Copy Markdown
Owner

@

Overview

A complete re-imagining of the admin panel — from a basic 4-tab CRUD screen into a proper Admin Console with org-wide insight, per-member drill-down, and richer plan management. Admins remain confined to admin-only surfaces (unchanged).

Frontend

Overview tab

  • 6 KPI cards: Members, Active, Pending, Sessions/week, Volume/week, Plans
  • 30-day training activity area chart (sessions per day) with "active this week" callout
  • Most-active leaderboard (last 30 days: sessions + volume)
  • Recent activity feed (who trained what, when) across all members
  • Quick actions (invite / create plan)

Members tab

  • Search + filter (all / active / pending) + sort (recent activity / name / onboarding / volume)
  • Member rows with avatar, status, onboarding progress bar, session count, last-active
  • Member detail modal: weekly-volume + body-weight + big-three charts, assigned plans (with inline assign), PRs, recent sessions, and per-member actions (weekly/monthly report, resend invite, reset password, delete)

Plans tab

  • Card grid showing focus, exercise list with sets×reps and warm-up indicators
  • Structured create/edit (JSON), duplicate, delete
  • Assign-to-members modal: pick individual members or assign to everyone

Insights tab

  • Member comparison: big-three 1RM bars + weekly volume trend (multi-series lines)

Backend

  • Enriched GET /admin/stats: sessions, volume (week + all-time), active-this-week, avg onboarding, plan count
  • New GET /admin/activity: per-day session counts, recent feed, most-active leaderboard
  • Richer GET /admin/users (session count, total volume, last active) and GET /admin/users/:id (weekly totals, body weight, assigned plans)
  • AdminModule now wires in ExercisesModule + BodyWeightModule

Testing

  • tsc --noEmit clean (frontend + backend)
  • next build and nest build both succeed
  • No breaking changes to existing user-facing features or endpoints

🤖 Generated with Claude Code
@

- Overview: 6 KPIs, 30-day activity area chart, most-active leaderboard, recent activity feed, quick actions
- Members: search + filter (all/active/pending) + sort (recent/name/onboarding/volume), onboarding progress bars, rich member detail modal (weekly volume, body weight, big-three charts, assigned plans, PRs, recent sessions, per-member actions)
- Plans: card grid with focus + exercise/warm-up summary, structured create/edit, duplicate, and assign-to-members modal (select or all)
- Insights: member comparison (big-three bars + weekly volume trend lines)
- Backend: enriched admin stats (sessions/volume/active/onboarding/plans), new /admin/activity endpoint, richer user detail (weekly totals, body weight, assigned plans)
Copilot AI review requested due to automatic review settings June 10, 2026 06:28
@Rezwoan
Rezwoan merged commit ddc711c into main Jun 10, 2026
1 check passed

Copilot AI 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.

Pull request overview

This PR replaces the existing admin panel with a more full-featured “Admin Console”, adding org-level KPIs/activity visualizations, richer member drill-down, improved plan management, and an insights comparison view, backed by new/enriched admin API responses.

Changes:

  • Adds a new admin activity endpoint (GET /admin/activity) and enriches admin stats/users payloads to support new UI surfaces.
  • Reworks the admin page into new tabs (Overview/Members/Plans/Insights) with charts, leaderboards, filtering/sorting, and modal-based workflows.
  • Introduces new admin modals for per-member detail drill-down and plan assignment to selected members.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
frontend/src/lib/api.ts Adds adminApi.getActivity() to call the new backend endpoint.
frontend/src/components/admin/member-detail-modal.tsx New member detail modal (KPIs, charts, assigned plans, member actions).
frontend/src/components/admin/assign-plan-modal.tsx New modal to assign a plan to all or selected members.
frontend/src/app/admin/page.tsx Major UI revamp of admin console tabs, activity views, filtering/sorting, and modals.
frontend/public/sw.js Updates generated service worker precache manifest/assets.
backend/src/admin/admin.service.ts Enriches admin endpoints and adds org-wide activity aggregation logic.
backend/src/admin/admin.module.ts Wires in Exercises/BodyWeight modules for new admin data needs.
backend/src/admin/admin.controller.ts Adds GET /admin/activity route under existing admin guards.
Files not reviewed (1)
  • frontend/public/sw.js: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const act = async (key: string, fn: () => Promise<any>, reload = false) => {
setBusy(key);
try { await fn(); if (reload) await load(); onChanged(); }
catch (e) { console.error(e); }
Comment on lines +49 to +50
await act('delete', () => adminApi.deleteUser(userId));
onClose();

const assign = async () => {
if (!assignPlanId) return;
await act('assign', () => adminApi.assignPlan(parseInt(assignPlanId), userId), true);
onClose();
};

const weekly = (d?.weeklyTotals || []).map((v: number, i: number, a: number[]) => ({ week: `W${i - a.length + 1 === 0 ? '' : ''}${i + 1}`, volume: Math.round(v) }));
{users.length === 0 && <p className="text-sm text-muted-foreground text-center py-6">No members to assign.</p>}
</div>

{done && <p className="text-sm text-success text-center">{done}</p>}
Comment on lines +154 to +157
return Array.from({ length: len }, (_, i) => {
const row: any = { week: `W${i + 1}` };
compareData.forEach((u) => { row[u.name] = Math.round(u.weeklyTotals?.[i] || 0); });
return row;
Comment on lines +42 to +45
const sessions = await this.workoutsService.getUserSessions(u.id); // sorted DESC
const completed = sessions.filter((s) => s.completedAt);
const totalVolume = completed.reduce((sum, s) => sum + volumeOf(s.sets), 0);
return {
Comment on lines +147 to +151
for (const u of users) {
onboardingSum += await this.usersService.computeOnboardingPercent(u.id);
const sessions = await this.workoutsService.getUserSessions(u.id);
const completed = sessions.filter((s) => s.completedAt);
totalSessions += completed.length;
Comment on lines +184 to +196
for (const u of users) {
const sessions = await this.workoutsService.getUserSessions(u.id);
for (const s of sessions.filter((x) => x.completedAt)) {
all.push({
userId: u.id,
name: u.name || u.email,
workoutType: s.workoutType,
startedAt: s.startedAt,
volume: Math.round(volumeOf(s.sets)),
sets: (s.sets || []).length,
});
}
}
@Rezwoan

Rezwoan commented Jun 10, 2026

Copy link
Copy Markdown
Owner Author

@

Added: Estimation tab + suggestion data collection

Per request — the estimation algorithm is unchanged; this adds evaluation + data collection so tuning can be decided from real data later.

  • Data collection: every working set now persists the suggestedWeight shown to the user (new column; warm-ups/off-plan excluded).
  • GET /admin/estimation returns two views:
    • Algorithm accuracy (retrospective): replays the (unchanged) double-progression predictor over existing history — predicts each session from the previous one and compares to what was actually lifted. KPIs (accuracy %, mean error, directional bias), an error-distribution chart, per-exercise bias/accuracy, and recent predicted→actual samples.
    • Live suggestion tracking: for newly collected data — how often members keep the suggestion vs increase/decrease it, mean override, and accuracy. Shows a "collecting…" state until data accrues.
  • Refactored the predictor into a shared predictExerciseWeight() so live suggestions and the analysis use the exact same logic.
    @

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.

2 participants