import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:niogu_app/core/components/top_back_bar_app.dart';
import 'package:niogu_app/features/customer/domain/entities/customer.dart';
import 'package:niogu_app/features/customer/presentation/widgets/customer_activity.dart';
import 'package:sizer/sizer.dart';

class CustomerActivitiesScreen extends ConsumerWidget {
  final bool isOnlineCustomer;
  final List<CustomerActivities> activities;

  const CustomerActivitiesScreen({
    super.key,
    required this.isOnlineCustomer,
    required this.activities,
  });

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    return LayoutBuilder(
      builder: (context, constraints) {
        return SafeArea(
          top: false,
          bottom: true,
          right: false,
          left: false,
          child: Scaffold(
            backgroundColor: const Color(0xFFF9FAFB),
            appBar: TopBackBarApp(
              title: "Aktivitas Pelanggan",
              onTap: () => context.pop(),
            ),
            body: ListView.builder(
              padding: EdgeInsets.all(5.w),
              itemCount: activities.length,
              itemBuilder: (context, index) {
                final activity = activities[index];
                return CustomerActivity(
                  isOnlineCustomer: isOnlineCustomer,
                  activity: activity,
                );
              },
            ),
          ),
        );
      },
    );
  }
}
