Files
tasq/lib/screens/programmer_tasks/programmer_drill_down_screen.dart
T
redz1029 7beb8e8713 feat(programmer): admin monitor tab + drill-down
- Add isStrictAdminProvider (role == 'admin' only)
- Add programmer_tasks_tabs.dart with ProgrammerTasksTab enum,
  programmerTasksTabsFor, parseProgrammerTasksTab, programmerTasksTabLabel
- Make ProgrammerTasksListScreen role-aware via initialTab param and
  programmerTasksTabsFor; admin sees Monitor/Mine/All tabs
- Add MonitorTab with AppStatusSummaryRow + responsive programmer grid
  (1/2/3 cols) + HelpPanel side/bottom
- Add ProgrammerMonitorCard with state pills (Working/Paused/Idle/On leave/Pass slip)
- Add HelpPanel ConsumerStatefulWidget with day stepper and help-edge rows
- Add ProgrammerDrillDownScreen (/programmer-tasks/programmers/:userId);
  non-admins see lock empty view
- Router: pass tab query param; add programmers/:userId before :id route
- Tests: 7/7 pass; analyze: 0 new issues

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-09-27 22:39:19 +08:00

53 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../models/profile.model.dart';
import '../../providers/profile_provider.dart';
import '../../widgets/app_state_view.dart';
import 'dashboard/programmer_dashboard.dart';
/// Admin-only drill-down screen that shows [ProgrammerDashboard] for a
/// specific user in read-only mode.
///
/// Route: /programmer-tasks/programmers/:userId
class ProgrammerDrillDownScreen extends ConsumerWidget {
const ProgrammerDrillDownScreen({
super.key,
required this.userId,
});
final String userId;
@override
Widget build(BuildContext context, WidgetRef ref) {
final isStrictAdmin = ref.watch(isStrictAdminProvider);
final profilesAsync = ref.watch(profilesProvider);
if (!isStrictAdmin) {
return Scaffold(
appBar: AppBar(title: const Text('Programmer')),
body: const AppEmptyView(
icon: Icons.lock_outline,
title: 'Admins only',
),
);
}
// Resolve the programmer's name for the AppBar title.
final profiles = profilesAsync.valueOrNull ?? <Profile>[];
Profile? profile;
for (final p in profiles) {
if (p.id == userId) {
profile = p;
break;
}
}
final name = profile?.fullName ?? 'Programmer';
return Scaffold(
appBar: AppBar(title: Text(name)),
body: ProgrammerDashboard(userId: userId, readOnly: true),
);
}
}