import 'package:flutter/material.dart';

import 'package:pshared/models/invitation/invitation.dart';

import 'package:pweb/pages/invitations/widgets/card/card.dart';

import 'package:pweb/generated/i18n/app_localizations.dart';


class InvitationListBody extends StatelessWidget {
  final List<Invitation> invitations;

  const InvitationListBody({super.key, required this.invitations});

  @override
  Widget build(BuildContext context) {
    final loc = AppLocalizations.of(context)!;

    if (invitations.isEmpty) {
      return Center(
        child: Padding(
          padding: const EdgeInsets.symmetric(vertical: 32),
          child: Text(loc.invitationListEmpty),
        ),
      );
    }

    return ListView.separated(
      shrinkWrap: true,
      physics: const NeverScrollableScrollPhysics(),
      itemCount: invitations.length,
      separatorBuilder: (_, _) => const SizedBox(height: 10),
      itemBuilder: (_, index) => InvitationsCard(invitation: invitations[index]),
    );
  }
}
