import React from "react";
import { LogActivityGroupedDayDTO } from "@griddo/api-types";
import ItemGroup from "../ItemGroup";
import EventItem from "./EventItem";

const ItemLog = (props: IItemLogProps) => {
	const { items, getLog } = props;
	const { date, items: dayItems, totalItems } = items;

	return (
		<ItemGroup date={date} count={totalItems}>
			{dayItems.map((item) => (
				<EventItem key={item.id} item={item} getLog={getLog} />
			))}
		</ItemGroup>
	);
};

interface IItemLogProps {
	items: LogActivityGroupedDayDTO;
	getLog(): void;
}

export default ItemLog;
