import 'package:flutter/material.dart';
import 'package:design_system/design_system.dart';
import 'package:core_localization/core_localization.dart';
import 'package:krow_domain/krow_domain.dart';
import 'timesheet_card.dart';

/// Displays the list of shift history or an empty state.
class ShiftHistoryList extends StatelessWidget {
  final List<TimeCard> timesheets;

  const ShiftHistoryList({super.key, required this.timesheets});

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Text(
          t.staff_time_card.shift_history,
          style: UiTypography.title2b.copyWith(
            color: UiColors.textPrimary,
          ),
        ),
        const SizedBox(height: UiConstants.space3),
        if (timesheets.isEmpty)
          Center(
            child: Padding(
              padding: const EdgeInsets.symmetric(vertical: UiConstants.space12),
              child: Column(
                children: [
                   const Icon(UiIcons.clock, size: 48, color: UiColors.iconSecondary),
                  const SizedBox(height: UiConstants.space3),
                  Text(
                    t.staff_time_card.no_shifts,
                    style: UiTypography.body1r.copyWith(color: UiColors.textSecondary),
                  ),
                ],
              ),
            ),
          )
        else
          ...timesheets.map((ts) => TimesheetCard(timesheet: ts)),
      ],
    );
  }
}
