Phase 3: hide mitra force-close (Akhiri) button in active sessions
Removes the Akhiri button + confirmation dialog + _endSession from the mitra active sessions screen. Backend POST .../end-early route and the early_end_mitra_enabled config flag are preserved — re-enable plan lives in requirement/phase3.6.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -33,34 +33,6 @@ class _ActiveSessionsScreenState extends ConsumerState<ActiveSessionsScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _endSession(String sessionId) async {
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('Akhiri Sesi?'),
|
||||
content: const Text('Apakah kamu yakin ingin mengakhiri sesi ini?'),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Navigator.of(ctx).pop(false), child: const Text('Batal')),
|
||||
TextButton(onPressed: () => Navigator.of(ctx).pop(true), child: const Text('Ya, Akhiri')),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
if (confirmed == true) {
|
||||
try {
|
||||
final apiClient = ref.read(apiClientProvider);
|
||||
await apiClient.post('/api/mitra/chat-requests/sessions/$sessionId/end');
|
||||
_loadSessions();
|
||||
} catch (_) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Gagal mengakhiri sesi.')),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -78,10 +50,7 @@ class _ActiveSessionsScreenState extends ConsumerState<ActiveSessionsScreen> {
|
||||
leading: const Icon(Icons.chat),
|
||||
title: Text(customerName),
|
||||
subtitle: Text('Status: ${session['status']}'),
|
||||
trailing: TextButton(
|
||||
onPressed: () => _endSession(session['id'] as String),
|
||||
child: const Text('Akhiri', style: TextStyle(color: Colors.red)),
|
||||
),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () => context.push(
|
||||
'/chat/session/${session['id']}',
|
||||
extra: {'customerName': customerName},
|
||||
|
||||
Reference in New Issue
Block a user